Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit 3f80e43

Browse files
committed
Apply readonly attribute to function pointer parameters only
1 parent dc6dc45 commit 3f80e43

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

omniscidb/QueryEngine/Optimization/AnnotateInternalFunctionsPass.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ class AnnotateInternalFunctionsPass
6565
fcn->addFnAttr(attr);
6666
}
6767
} else if (isReadOnlyFunction(fcn->getName())) {
68-
fcn->addFnAttr(llvm::Attribute::ReadOnly);
68+
for (size_t i = 0; i < fcn->arg_size(); i++) {
69+
const auto arg = fcn->getArg(i);
70+
CHECK(arg);
71+
if (arg->getType()->isPointerTy()) {
72+
fcn->addParamAttr(i, llvm::Attribute::ReadOnly);
73+
}
74+
}
6975
}
7076
}
7177

0 commit comments

Comments
 (0)