forked from OSchip/llvm-project
hwasan, codegen: Keep more lifetime markers used for hwasan
Reviewers: eugenis Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66697 llvm-svn: 369980
This commit is contained in:
parent
aeca56964f
commit
669d111c52
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue