diff options
Diffstat (limited to 'include/llvm/Transforms/Utils/ModuleUtils.h')
-rw-r--r-- | include/llvm/Transforms/Utils/ModuleUtils.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/ModuleUtils.h b/include/llvm/Transforms/Utils/ModuleUtils.h index 16904f1..622265b 100644 --- a/include/llvm/Transforms/Utils/ModuleUtils.h +++ b/include/llvm/Transforms/Utils/ModuleUtils.h @@ -14,12 +14,19 @@ #ifndef LLVM_TRANSFORMS_UTILS_MODULEUTILS_H #define LLVM_TRANSFORMS_UTILS_MODULEUTILS_H +#include "llvm/ADT/ArrayRef.h" +#include <utility> // for std::pair + namespace llvm { class Module; class Function; class GlobalValue; class GlobalVariable; +class Constant; +class StringRef; +class Value; +class Type; template <class PtrType> class SmallPtrSetImpl; /// Append F to the list of global ctors of module M with the given Priority. @@ -36,6 +43,20 @@ void appendToGlobalDtors(Module &M, Function *F, int Priority); GlobalVariable *collectUsedGlobalVariables(Module &M, SmallPtrSetImpl<GlobalValue *> &Set, bool CompilerUsed); + +// Validate the result of Module::getOrInsertFunction called for an interface +// function of given sanitizer. If the instrumented module defines a function +// with the same name, their prototypes must match, otherwise +// getOrInsertFunction returns a bitcast. +Function *checkSanitizerInterfaceFunction(Constant *FuncOrBitcast); + +/// \brief Creates sanitizer constructor function, and calls sanitizer's init +/// function from it. +/// \return Returns pair of pointers to constructor, and init functions +/// respectively. +std::pair<Function *, Function *> createSanitizerCtorAndInitFunctions( + Module &M, StringRef CtorName, StringRef InitName, + ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs); } // End llvm namespace #endif // LLVM_TRANSFORMS_UTILS_MODULEUTILS_H |