diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-12-03 19:12:58 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-12-03 19:12:58 +0000 |
commit | 91ecfa6af51836d3ccc90beddab1193b0c060739 (patch) | |
tree | fa449b3009c70868f0144c741656d1def1ce54f5 /lib/Driver/Tools.cpp | |
parent | 12feb121146805a117c5d3439907a6a48ebc7365 (diff) |
Add Clang flags -fsanitize-blacklist and -fno-sanitize-blacklist. Make this flag usable for ASan. Blacklisting can be used to disable sanitizer checks for particular file/function/object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 92c96b25c9..e93fa108d9 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1486,6 +1486,19 @@ SanitizerArgs::SanitizerArgs(const Driver &D, const ArgList &Args) { D.Diag(diag::err_drv_argument_only_allowed_with) << lastArgumentForKind(D, Args, NeedsAsanRt) << "-fsanitize=address"; + + // Parse -f(no-)sanitize-blacklist options. + if (Arg *BLArg = Args.getLastArg(options::OPT_fsanitize_blacklist, + options::OPT_fno_sanitize_blacklist)) { + if (BLArg->getOption().matches(options::OPT_fsanitize_blacklist)) { + std::string BLPath = BLArg->getValue(); + bool BLExists = false; + if (!llvm::sys::fs::exists(BLPath, BLExists) && BLExists) + BlacklistFile = BLPath; + else + D.Diag(diag::err_drv_no_such_file) << BLPath; + } + } } /// If AddressSanitizer is enabled, add appropriate linker flags (Linux). |