]> granicus.if.org Git - clang/commitdiff
hwasan, codegen: Keep more lifetime markers used for hwasan
authorVitaly Buka <vitalybuka@google.com>
Mon, 26 Aug 2019 22:16:05 +0000 (22:16 +0000)
committerVitaly Buka <vitalybuka@google.com>
Mon, 26 Aug 2019 22:16:05 +0000 (22:16 +0000)
Reviewers: eugenis

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66697

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369980 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/lifetime-sanitizer.c
test/CodeGenCXX/lifetime-sanitizer.cpp

index 0e04a51456561829bf4dbb226e8c67bf485e958c..86ef0b8cdb9983c5a7a8f1672ba2c35070f44f8d 100644 (file)
@@ -521,6 +521,7 @@ EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *M) {
       ConditionalEvaluation *OldConditional = nullptr;
       CGBuilderTy::InsertPoint OldIP;
       if (isInConditionalBranch() && !E->getType().isDestructedType() &&
+          !SanOpts.has(SanitizerKind::HWAddress) &&
           !SanOpts.has(SanitizerKind::Memory) &&
           !CGM.getCodeGenOpts().SanitizeAddressUseAfterScope) {
         OldConditional = OutermostConditional;
index 228093044e14097bcf01878ee62e83a3eedc1e49..4b7986f7162f6911385de36d906c7ba20232ef80 100644 (file)
@@ -49,6 +49,7 @@ static bool shouldEmitLifetimeMarkers(const CodeGenOptions &CGOpts,
 
   // Sanitizers may use markers.
   if (CGOpts.SanitizeAddressUseAfterScope ||
+      LangOpts.Sanitize.has(SanitizerKind::HWAddress) ||
       LangOpts.Sanitize.has(SanitizerKind::Memory))
     return true;
 
index 04714d7a19cda4ac608a52216ef7424ed9165a35..95fa970c72bc8bf26f3964f74f288573da1405f9 100644 (file)
@@ -5,6 +5,9 @@
 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
 // RUN:     -fsanitize=memory %s | \
 // RUN:     FileCheck %s -check-prefix=LIFETIME
+// RUN: %clang -target aarch64-linux-gnu -S -emit-llvm -o - -O0 \
+// RUN:     -fsanitize=hwaddress %s | \
+// RUN:     FileCheck %s -check-prefix=LIFETIME
 
 extern int bar(char *A, int n);
 
index 7921483eeeefefe0e73138c795a14129f6e7e848..5b52e6e6aa649e0ecfe4d9b03d8ead7c5359a93e 100644 (file)
@@ -6,6 +6,9 @@
 // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
 // RUN:     -fsanitize=memory %s | \
 // RUN:     FileCheck %s -check-prefixes=CHECK,LIFETIME
+// RUN: %clang -w -target aarch64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
+// RUN:     -fsanitize=hwaddress %s | \
+// RUN:     FileCheck %s -check-prefixes=CHECK,LIFETIME
 
 extern int bar(char *A, int n);