aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-12-03 19:12:58 +0000
committerAlexey Samsonov <samsonov@google.com>2012-12-03 19:12:58 +0000
commit91ecfa6af51836d3ccc90beddab1193b0c060739 (patch)
treefa449b3009c70868f0144c741656d1def1ce54f5 /lib/CodeGen/BackendUtil.cpp
parent12feb121146805a117c5d3439907a6a48ebc7365 (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/CodeGen/BackendUtil.cpp')
-rw-r--r--lib/CodeGen/BackendUtil.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index 4fe1c80e48..414f65ecf3 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -139,10 +139,13 @@ public:
// we add to the PassManagerBuilder.
class PassManagerBuilderWrapper : public PassManagerBuilder {
public:
- PassManagerBuilderWrapper(const LangOptions &LangOpts)
- : PassManagerBuilder(), LangOpts(LangOpts) {}
+ PassManagerBuilderWrapper(const CodeGenOptions &CGOpts,
+ const LangOptions &LangOpts)
+ : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {}
+ const CodeGenOptions &getCGOpts() const { return CGOpts; }
const LangOptions &getLangOpts() const { return LangOpts; }
private:
+ const CodeGenOptions &CGOpts;
const LangOptions &LangOpts;
};
@@ -172,11 +175,14 @@ static void addAddressSanitizerPasses(const PassManagerBuilder &Builder,
PassManagerBase &PM) {
const PassManagerBuilderWrapper &BuilderWrapper =
static_cast<const PassManagerBuilderWrapper&>(Builder);
+ const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
const LangOptions &LangOpts = BuilderWrapper.getLangOpts();
PM.add(createAddressSanitizerFunctionPass(LangOpts.SanitizeInitOrder,
LangOpts.SanitizeUseAfterReturn,
- LangOpts.SanitizeUseAfterScope));
- PM.add(createAddressSanitizerModulePass(LangOpts.SanitizeInitOrder));
+ LangOpts.SanitizeUseAfterScope,
+ CGOpts.SanitizerBlacklistFile));
+ PM.add(createAddressSanitizerModulePass(LangOpts.SanitizeInitOrder,
+ CGOpts.SanitizerBlacklistFile));
}
static void addMemorySanitizerPass(const PassManagerBuilder &Builder,
@@ -200,7 +206,7 @@ void EmitAssemblyHelper::CreatePasses(TargetMachine *TM) {
Inlining = CodeGenOpts.NoInlining;
}
- PassManagerBuilderWrapper PMBuilder(LangOpts);
+ PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts);
PMBuilder.OptLevel = OptLevel;
PMBuilder.SizeLevel = CodeGenOpts.OptimizeSize;