Skip to content

Commit 0334b67

Browse files
committed
tweak logic
1 parent f448a60 commit 0334b67

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,10 +1034,6 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
10341034
StableABI = Args.hasFlag(options::OPT_fsanitize_stable_abi,
10351035
options::OPT_fno_sanitize_stable_abi, false);
10361036

1037-
AsanUseAfterScope = Args.hasFlag(
1038-
options::OPT_fsanitize_address_use_after_scope,
1039-
options::OPT_fno_sanitize_address_use_after_scope, AsanUseAfterScope);
1040-
10411037
AsanPoisonCustomArrayCookie = Args.hasFlag(
10421038
options::OPT_fsanitize_address_poison_custom_array_cookie,
10431039
options::OPT_fno_sanitize_address_poison_custom_array_cookie,
@@ -1099,13 +1095,6 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
10991095
}
11001096

11011097
} else {
1102-
if (AllAddedKinds & SanitizerKind::KernelAddress) {
1103-
AsanUseAfterScope = Args.hasFlag(
1104-
options::OPT_fsanitize_address_use_after_scope,
1105-
options::OPT_fno_sanitize_address_use_after_scope, AsanUseAfterScope);
1106-
} else {
1107-
AsanUseAfterScope = false;
1108-
}
11091098
// -fsanitize=pointer-compare/pointer-subtract requires -fsanitize=address.
11101099
SanitizerMask DetectInvalidPointerPairs =
11111100
SanitizerKind::PointerCompare | SanitizerKind::PointerSubtract;
@@ -1119,6 +1108,15 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
11191108
}
11201109
}
11211110

1111+
if (AllAddedKinds &
1112+
(SanitizerKind::Address | SanitizerKind::KernelAddress)) {
1113+
AsanUseAfterScope = Args.hasFlag(
1114+
options::OPT_fsanitize_address_use_after_scope,
1115+
options::OPT_fno_sanitize_address_use_after_scope, AsanUseAfterScope);
1116+
} else {
1117+
AsanUseAfterScope = false;
1118+
}
1119+
11221120
if (AllAddedKinds & SanitizerKind::HWAddress) {
11231121
if (Arg *HwasanAbiArg =
11241122
Args.getLastArg(options::OPT_fsanitize_hwaddress_abi_EQ)) {

0 commit comments

Comments
 (0)