diff options
author | Kostya Serebryany <kcc@google.com> | 2012-11-29 08:57:20 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-11-29 08:57:20 +0000 |
commit | 5085eb80abe29320fa8922c10b36249f5163f45d (patch) | |
tree | ba17b40c787eccc25fea234bc7970f92cb28957b /lib/Transforms | |
parent | a18d377e73d3dd96233011e9da9789861fb8f315 (diff) | |
download | llvm-5085eb80abe29320fa8922c10b36249f5163f45d.tar.gz llvm-5085eb80abe29320fa8922c10b36249f5163f45d.tar.bz2 llvm-5085eb80abe29320fa8922c10b36249f5163f45d.tar.xz |
[asan] when checking the noreturn attribute on the call, also check it on the callee
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 24dc0f267a..444add65c5 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -845,6 +845,14 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) { return false; } +// Check both the call and the callee for doesNotReturn(). +static bool isNoReturnCall(CallInst *CI) { + if (CI->doesNotReturn()) return true; + Function *F = CI->getCalledFunction(); + if (F && F->doesNotReturn()) return true; + return false; +} + bool AddressSanitizer::runOnFunction(Function &F) { if (BL->isIn(F)) return false; if (&F == AsanCtorFunction) return false; @@ -885,7 +893,7 @@ bool AddressSanitizer::runOnFunction(Function &F) { if (CallInst *CI = dyn_cast<CallInst>(BI)) { // A call inside BB. TempsToInstrument.clear(); - if (CI->doesNotReturn()) { + if (isNoReturnCall(CI)) { NoReturnCalls.push_back(CI); } } |