[PATCH] Implement `createSanitizerCtor`, common helper function for all sanitizers

Alexey Samsonov vonosmas at gmail.com
Fri May 1 12:28:20 PDT 2015


Sorry for the late response.


================
Comment at: include/llvm/Transforms/Utils/ModuleUtils.h:54
@@ +53,3 @@
+/// function from it.
+Function *createSanitizerCtor(Module &M, StringRef CtorName, StringRef InitName,
+                              ArrayRef<Type *> InitType = ArrayRef<Type *>(),
----------------
This function looks overly complicated to me. Essentially, you create *both* sanitizer initialization function,
and sanitizer module constructor here. Consider splitting this function into two functions. Or rename it accordingly
and return std::pair<Function *, Function *> to clearly indicate that you create two objects. Note that in the latter case
you will not need an overload.

================
Comment at: include/llvm/Transforms/Utils/ModuleUtils.h:55
@@ +54,3 @@
+Function *createSanitizerCtor(Module &M, StringRef CtorName, StringRef InitName,
+                              ArrayRef<Type *> InitType = ArrayRef<Type *>(),
+                              ArrayRef<Value *> InitArgs = ArrayRef<Value *>(),
----------------
I'd rather not provide the default argument values - passing {} explicitly is easy.

http://reviews.llvm.org/D8777

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list