]> granicus.if.org Git - clang/commitdiff
Move -fsanitize-blacklist to LangOpts from CodeGenOpts. NFC.
authorAlexey Samsonov <vonosmas@gmail.com>
Wed, 15 Oct 2014 20:22:54 +0000 (20:22 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Wed, 15 Oct 2014 20:22:54 +0000 (20:22 +0000)
After http://reviews.llvm.org/D5687 is submitted, we will need
SanitizerBlacklist before the CodeGen phase, so make it a LangOpt
(as it will actually affect ABI / class layout).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219842 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.h
include/clang/Frontend/CodeGenOptions.h
lib/CodeGen/BackendUtil.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Frontend/CompilerInvocation.cpp

index 47a74f0614254550d786c1b67dfb48afabcdc812..f07c6c7d54d878998b7648a8e084c7ce1a3309b6 100644 (file)
@@ -30,6 +30,10 @@ struct SanitizerOptions {
   /// aggressive, 2: more aggressive).
   unsigned SanitizeAddressFieldPadding : 2;
 
+  /// \brief Path to blacklist file specifying which objects
+  /// (files, functions, variables) should not be instrumented.
+  std::string BlacklistFile;
+
   /// \brief Cached set of sanitizer options with all sanitizers disabled.
   static const SanitizerOptions Disabled;
 };
index aa4b1216b3b66c95600f1cabafacd613080acc0c..3940384cc134b11fc8b55db7ae2620ba484283fb 100644 (file)
@@ -137,9 +137,6 @@ public:
   /// The thread model to use
   std::string ThreadModel;
 
-  /// Path to blacklist file for sanitizers.
-  std::string SanitizerBlacklistFile;
-
   /// If not an empty string, trap intrinsics are lowered to calls to this
   /// function instead of to trap instructions.
   std::string TrapFuncName;
index 6db952613d206d3ad3036a8c015384f456414ee6..4f1f52ff6a10523834f6d68168bce3e56233ae3c 100644 (file)
@@ -214,8 +214,8 @@ static void addDataFlowSanitizerPass(const PassManagerBuilder &Builder,
                                      PassManagerBase &PM) {
   const PassManagerBuilderWrapper &BuilderWrapper =
       static_cast<const PassManagerBuilderWrapper&>(Builder);
-  const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
-  PM.add(createDataFlowSanitizerPass(CGOpts.SanitizerBlacklistFile));
+  const LangOptions &LangOpts = BuilderWrapper.getLangOpts();
+  PM.add(createDataFlowSanitizerPass(LangOpts.Sanitize.BlacklistFile));
 }
 
 static TargetLibraryInfo *createTLI(llvm::Triple &TargetTriple,
index 5d314f525cdaf56a2d0a8c06248e8f1d70033550..587fc13915046e26c5f188c4151db1d1c965ca12 100644 (file)
@@ -90,7 +90,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
       BlockObjectDispose(nullptr), BlockDescriptorType(nullptr),
       GenericBlockLiteralType(nullptr), LifetimeStartFn(nullptr),
       LifetimeEndFn(nullptr), SanitizerBL(llvm::SpecialCaseList::createOrDie(
-                                  CGO.SanitizerBlacklistFile)),
+                                  LangOpts.Sanitize.BlacklistFile)),
       SanitizerMD(new SanitizerMetadata(*this)) {
 
   // Initialize the type cache.
index 25d444eeb81a00fe84cd21b9a1aecb6743a3ec1e..19eecdbaedfb4f10b0fde6ebf76fb47f39e62b1f 100644 (file)
@@ -487,7 +487,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
   Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
   Opts.LinkBitcodeFile = Args.getLastArgValue(OPT_mlink_bitcode_file);
-  Opts.SanitizerBlacklistFile = Args.getLastArgValue(OPT_fsanitize_blacklist);
   Opts.SanitizeMemoryTrackOrigins =
       getLastArgIntValue(Args, OPT_fsanitize_memory_track_origins_EQ, 0, Diags);
   Opts.SanitizeUndefinedTrapOnError =
@@ -1631,6 +1630,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   // -fsanitize-address-field-padding=N has to be a LangOpt, parse it here.
   Opts.Sanitize.SanitizeAddressFieldPadding =
       getLastArgIntValue(Args, OPT_fsanitize_address_field_padding, 0, Diags);
+  Opts.Sanitize.BlacklistFile = Args.getLastArgValue(OPT_fsanitize_blacklist);
 }
 
 static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,