summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
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
commit262f05bab07bde0d59e2a19493d8ffc86cddd37c (patch)
tree5e059a8635c549e297c3797b040e72be381969da /clang/lib/CodeGen
parentb5dad75e38d449a1421d5f14ccf55857fe5599fe (diff)
downloadbcm5719-llvm-262f05bab07bde0d59e2a19493d8ffc86cddd37c.tar.gz
bcm5719-llvm-262f05bab07bde0d59e2a19493d8ffc86cddd37c.zip
[ASan] Emit lifetime markers for local variables in -fsanitize=use-after-scope mode
llvm-svn: 178538
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index d59c876d71c..1255e654dc4 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud