From 782067d0278612ee75d024b9b135c221c327e9e8 Mon Sep 17 00:00:00 2001 From: dim Date: Wed, 27 May 2015 18:44:32 +0000 Subject: Vendor import of llvm trunk r238337: https://llvm.org/svn/llvm-project/llvm/trunk@238337 --- include/llvm/Transforms/Utils/ModuleUtils.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include/llvm/Transforms/Utils/ModuleUtils.h') 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 // for std::pair + namespace llvm { class Module; class Function; class GlobalValue; class GlobalVariable; +class Constant; +class StringRef; +class Value; +class Type; template 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 &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 createSanitizerCtorAndInitFunctions( + Module &M, StringRef CtorName, StringRef InitName, + ArrayRef InitArgTypes, ArrayRef InitArgs); } // End llvm namespace #endif // LLVM_TRANSFORMS_UTILS_MODULEUTILS_H -- cgit v1.1