]> granicus.if.org Git - clang/commitdiff
Add new analyzer diagnostic mode where plists can have bugs that span multiple files.
authorTed Kremenek <kremenek@apple.com>
Mon, 12 Mar 2012 23:14:53 +0000 (23:14 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 12 Mar 2012 23:14:53 +0000 (23:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152586 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/Analyses.def
include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

index de33c52172cdf9d86f0b5a920fd607f0e74eab78..b5b9394af3d8be2fd923c7bc7d1c836b84283117 100644 (file)
@@ -30,6 +30,7 @@ ANALYSIS_CONSTRAINTS(RangeConstraints, "range", "Use constraint tracking of conc
 
 ANALYSIS_DIAGNOSTICS(HTML,  "html",  "Output analysis results using HTML",   createHTMLDiagnosticConsumer, false)
 ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", createPlistDiagnosticConsumer, true)
+ANALYSIS_DIAGNOSTICS(PLIST_MULTI_FILE, "plist-multi-file", "Output analysis results using Plists (allowing for mult-file bugs)", createPlistMultiFileDiagnosticConsumer, true)
 ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", "Output analysis results using HTML wrapped with Plists", createPlistHTMLDiagnosticConsumer, true)
 ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results", createTextPathDiagnosticConsumer, true)
 
index d1f5a7da55998722669479fa58e80095c63538fe..65be3a406b433d28c5526eafdd944e1299900d41 100644 (file)
@@ -31,6 +31,10 @@ PathDiagnosticConsumer*
 createPlistDiagnosticConsumer(const std::string& prefix, const Preprocessor &PP,
                               PathDiagnosticConsumer *SubPD = 0);
 
+PathDiagnosticConsumer*
+createPlistMultiFileDiagnosticConsumer(const std::string& prefix,
+                                       const Preprocessor &PP);
+
 PathDiagnosticConsumer*
 createTextPathDiagnosticConsumer(const std::string& prefix,
                                  const Preprocessor &PP);
index ee2b3f35fb7885840a581977fe86d4c8516d7dc0..e94b54c825be7e5256f322a2fa2032612383655f 100644 (file)
@@ -32,8 +32,10 @@ namespace {
     const LangOptions &LangOpts;
     OwningPtr<PathDiagnosticConsumer> SubPD;
     bool flushed;
+    const bool SupportsCrossFileDiagnostics;
   public:
     PlistDiagnostics(const std::string& prefix, const LangOptions &LangOpts,
+                     bool supportsMultipleFiles,
                      PathDiagnosticConsumer *subPD);
 
     virtual ~PlistDiagnostics() {}
@@ -49,18 +51,29 @@ namespace {
     bool supportsLogicalOpControlFlow() const { return true; }
     bool supportsAllBlockEdges() const { return true; }
     virtual bool useVerboseDescription() const { return false; }
+    virtual bool supportsCrossFileDiagnostics() const {
+      return SupportsCrossFileDiagnostics;
+    }
   };
 } // end anonymous namespace
 
 PlistDiagnostics::PlistDiagnostics(const std::string& output,
                                    const LangOptions &LO,
+                                   bool supportsMultipleFiles,
                                    PathDiagnosticConsumer *subPD)
-  : OutputFile(output), LangOpts(LO), SubPD(subPD), flushed(false) {}
+  : OutputFile(output), LangOpts(LO), SubPD(subPD), flushed(false),
+    SupportsCrossFileDiagnostics(supportsMultipleFiles) {}
 
 PathDiagnosticConsumer*
 ento::createPlistDiagnosticConsumer(const std::string& s, const Preprocessor &PP,
                                   PathDiagnosticConsumer *subPD) {
-  return new PlistDiagnostics(s, PP.getLangOpts(), subPD);
+  return new PlistDiagnostics(s, PP.getLangOpts(), false, subPD);
+}
+
+PathDiagnosticConsumer*
+ento::createPlistMultiFileDiagnosticConsumer(const std::string &s,
+                                              const Preprocessor &PP) {
+  return new PlistDiagnostics(s, PP.getLangOpts(), true, 0);
 }
 
 PathDiagnosticConsumer::PathGenerationScheme