aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-04-02 13:19:46 +0000
committerAlexey Samsonov <samsonov@google.com>2013-04-02 13:19:46 +0000
commit4f01ed4205a7189520f6a481fe2113856833421f (patch)
tree8f8757c1d13d1bc2afe8e776342e12fc30e2292d /lib/CodeGen/CGDecl.cpp
parentf52d52790708132cc1a3b5c3aef1bed17eb6ff13 (diff)
[ASan] Emit lifetime markers for local variables in -fsanitize=use-after-scope mode
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index d59c876d71..1255e654dc 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -786,6 +786,9 @@ static bool shouldUseMemSetPlusStoresToInitialize(llvm::Constant *Init,
/// Should we use the LLVM lifetime intrinsics for the given local variable?
static bool shouldUseLifetimeMarkers(CodeGenFunction &CGF, const VarDecl &D,
unsigned Size) {
+ // Always emit lifetime markers in -fsanitize=use-after-scope mode.
+ if (CGF.getLangOpts().Sanitize.UseAfterScope)
+ return true;
// For now, only in optimized builds.
if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0)
return false;