summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/BoundsChecking.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-07-25 17:29:22 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-07-25 17:29:22 +0000
commite3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5 (patch)
tree86fed444bf0263f4cfc2a78f815c9b6c59e942f7 /lib/Transforms/Instrumentation/BoundsChecking.cpp
parenta536835230afcd334068bc6f5781a244938feaf9 (diff)
downloadllvm-e3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5.tar.gz
llvm-e3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5.tar.bz2
llvm-e3094283e38d9e6f6a4a7a14a3a5d0f2af67d5d5.tar.xz
MemoryBuiltins: add support to determine the size of strdup'ed non-constant strings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/BoundsChecking.cpp')
-rw-r--r--lib/Transforms/Instrumentation/BoundsChecking.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Instrumentation/BoundsChecking.cpp b/lib/Transforms/Instrumentation/BoundsChecking.cpp
index 09e0f14451..b209fff61d 100644
--- a/lib/Transforms/Instrumentation/BoundsChecking.cpp
+++ b/lib/Transforms/Instrumentation/BoundsChecking.cpp
@@ -24,6 +24,7 @@
#include "llvm/Support/TargetFolder.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Instrumentation.h"
using namespace llvm;
@@ -48,6 +49,7 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<TargetData>();
+ AU.addRequired<TargetLibraryInfo>();
}
private:
@@ -166,11 +168,12 @@ bool BoundsChecking::instrument(Value *Ptr, Value *InstVal) {
bool BoundsChecking::runOnFunction(Function &F) {
TD = &getAnalysis<TargetData>();
+ const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfo>();
TrapBB = 0;
BuilderTy TheBuilder(F.getContext(), TargetFolder(TD));
Builder = &TheBuilder;
- ObjectSizeOffsetEvaluator TheObjSizeEval(TD, F.getContext());
+ ObjectSizeOffsetEvaluator TheObjSizeEval(TD, TLI, F.getContext());
ObjSizeEval = &TheObjSizeEval;
// check HANDLE_MEMORY_INST in include/llvm/Instruction.def for memory