[PATCH] Add an IsLiteral parameter to SpecialCaseList (Clang side).

Peter Collingbourne peter at pcc.me.uk
Wed Aug 6 16:45:02 PDT 2014


Hi samsonov,

http://reviews.llvm.org/D4818

Files:
  include/clang/CodeGen/BackendUtil.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Driver/SanitizerArgs.cpp

Index: include/clang/CodeGen/BackendUtil.h
===================================================================
--- include/clang/CodeGen/BackendUtil.h
+++ include/clang/CodeGen/BackendUtil.h
@@ -34,7 +34,7 @@
   };
 
   std::unique_ptr<llvm::SpecialCaseList>
-  CreateSpecialCaseList(const CodeGenOptions &CGOpts);
+  CreateSpecialCaseList(const LangOptions &LOpts, const CodeGenOptions &CGOpts);
 
   void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts,
                          const TargetOptions &TOpts, const LangOptions &LOpts,
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -216,8 +216,9 @@
                                      PassManagerBase &PM) {
   const PassManagerBuilderWrapper &BuilderWrapper =
       static_cast<const PassManagerBuilderWrapper&>(Builder);
+  const LangOptions &LOpts = BuilderWrapper.getLangOpts();
   const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
-  PM.add(createDataFlowSanitizerPass(CreateSpecialCaseList(CGOpts)));
+  PM.add(createDataFlowSanitizerPass(CreateSpecialCaseList(LOpts, CGOpts)));
 }
 
 void EmitAssemblyHelper::CreatePasses() {
@@ -590,11 +591,14 @@
   }
 }
 
-std::unique_ptr<SpecialCaseList> clang::CreateSpecialCaseList(const CodeGenOptions &CGOpts) {
+std::unique_ptr<SpecialCaseList>
+clang::CreateSpecialCaseList(const LangOptions &LOpts,
+                             const CodeGenOptions &CGOpts) {
   auto SCL = llvm::make_unique<SpecialCaseList>();
   for (const auto &Path : CGOpts.SanitizerBlacklistFiles) {
     std::string Error;
-    if (!SCL->loadFromFile(Path, Error)) {
+    if (!SCL->loadFromFile(Path, /*IsLiteral=*/LOpts.Sanitize.DataFlow,
+                           Error)) {
       report_fatal_error(Error);
     }
   }
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -90,7 +90,7 @@
       NSConcreteStackBlock(nullptr), BlockObjectAssign(nullptr),
       BlockObjectDispose(nullptr), BlockDescriptorType(nullptr),
       GenericBlockLiteralType(nullptr), LifetimeStartFn(nullptr),
-      LifetimeEndFn(nullptr), SanitizerBL(CreateSpecialCaseList(CGO)),
+      LifetimeEndFn(nullptr), SanitizerBL(CreateSpecialCaseList(LangOpts, CGO)),
       SanitizerMD(new SanitizerMetadata(*this)) {
 
   // Initialize the type cache.
Index: lib/Driver/SanitizerArgs.cpp
===================================================================
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -165,7 +165,7 @@
   // Validate the blacklist format.
   std::string BLError;
   llvm::SpecialCaseList SCL;
-  if (!SCL.loadFromFile(BLPath, BLError))
+  if (!SCL.loadFromFile(BLPath, /*IsLiteral=*/false, BLError))
     D.Diag(diag::err_drv_malformed_sanitizer_blacklist) << BLError;
   else
     BlacklistFiles.push_back(BLPath);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4818.12259.patch
Type: text/x-patch
Size: 2995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140806/4b596609/attachment.bin>


More information about the cfe-commits mailing list