summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-02-19 11:25:29 +0000
committerAlexey Samsonov <samsonov@google.com>2013-02-19 11:25:29 +0000
commitd26b3334b1e9bac59f56718329b9648d8d85fd86 (patch)
treef87bbf841ae67097c1b0401f7c70116401ea9a7e /clang/lib/Driver
parentadaca585268d813075051cfcad175697d5d1904f (diff)
downloadbcm5719-llvm-d26b3334b1e9bac59f56718329b9648d8d85fd86.tar.gz
bcm5719-llvm-d26b3334b1e9bac59f56718329b9648d8d85fd86.zip
[Sanitizer] If -fsanitize-blacklist= option is not explicitly specified, make Clang look for the default sanitizer-specific blacklist in the resource directory.
llvm-svn: 175505
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/SanitizerArgs.h13
-rw-r--r--clang/lib/Driver/Tools.cpp8
2 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.h b/clang/lib/Driver/SanitizerArgs.h
index bc3aa58331d..8e3f9461f38 100644
--- a/clang/lib/Driver/SanitizerArgs.h
+++ b/clang/lib/Driver/SanitizerArgs.h
@@ -15,6 +15,7 @@
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/Path.h"
namespace clang {
namespace driver {
@@ -189,6 +190,18 @@ class SanitizerArgs {
llvm_unreachable("arg didn't provide expected value");
}
+
+ static bool getDefaultBlacklistForKind(const Driver &D, unsigned Kind,
+ std::string &BLPath) {
+ // For now, specify the default blacklist location for ASan only.
+ if (Kind & NeedsAsanRt) {
+ SmallString<64> Path(D.ResourceDir);
+ llvm::sys::path::append(Path, "asan_blacklist.txt");
+ BLPath = Path.str();
+ return true;
+ }
+ return false;
+ }
};
} // namespace driver
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index ba61292acca..ad4fd6cd53b 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1543,6 +1543,14 @@ SanitizerArgs::SanitizerArgs(const Driver &D, const ArgList &Args)
else
D.Diag(diag::err_drv_no_such_file) << BLPath;
}
+ } else {
+ // If no -fsanitize-blacklist option is specified, try to look up for
+ // blacklist in the resource directory.
+ std::string BLPath;
+ bool BLExists = false;
+ if (getDefaultBlacklistForKind(D, Kind, BLPath) &&
+ !llvm::sys::fs::exists(BLPath, BLExists) && BLExists)
+ BlacklistFile = BLPath;
}
// Parse -f(no-)sanitize-memory-track-origins options.
OpenPOWER on IntegriCloud