summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-05-08 21:11:55 +0000
committerVedant Kumar <vsk@apple.com>2017-05-08 21:11:55 +0000
commita9d8be68c1c3b6081ceef7eceb889fa429e626b2 (patch)
treede2e72f1813786e7d9f1ae40fe0c601d59b576c4 /clang/lib
parentd0c4676f3971572eda0f6659178e70d4da7530fa (diff)
downloadbcm5719-llvm-a9d8be68c1c3b6081ceef7eceb889fa429e626b2.tar.gz
bcm5719-llvm-a9d8be68c1c3b6081ceef7eceb889fa429e626b2.zip
[Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled
When enabling any sanitizer, -fsanitize-use-after-scope is enabled by default. This doesn't actually turn ASan on, because we've been getting lucky and there are extra checks in BackendUtil that stop this from happening. However, this has been causing a behavior change: extra lifetime markers are emitted in some cases where they aren't needed or expected. llvm-svn: 302468
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/SanitizerArgs.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index c298302c477..b1f5f860d42 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -563,12 +563,11 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
}
}
- if (Arg *A = Args.getLastArg(
- options::OPT_fsanitize_address_use_after_scope,
- options::OPT_fno_sanitize_address_use_after_scope)) {
- AsanUseAfterScope = A->getOption().getID() ==
- options::OPT_fsanitize_address_use_after_scope;
- }
+ AsanUseAfterScope = Args.hasFlag(
+ options::OPT_fsanitize_address_use_after_scope,
+ options::OPT_fno_sanitize_address_use_after_scope, AsanUseAfterScope);
+ } else {
+ AsanUseAfterScope = false;
}
// Parse -link-cxx-sanitizer flag.
OpenPOWER on IntegriCloud