<div dir="ltr">Hi Artem,<div><br></div><div>Looks like this patch has some layer violations, I tried to fix that but there is a main issue not easy to fix -- the issue is that there is a cycle dependency:</div><div><br></div><div>1. PlistPathDiagnosticConsumer.cpp (now being moved to clangAnalysis target), and this file calls a method from clang::ASTUnit, so <b>clangAnalysis</b> should depend on <b>clangFrontend</b> (this is not listed in the CMake file).<br></div><div>2. <b>clangFrontend</b> depends on <b>clangSema</b></div><div>3. <b>clangSema</b> depends on <b>clangAnalysis</b></div><div><b><br></b></div><div>I'm going to revert this patch (to unblock our integration, sorry), feel free to land it again if you fix the issue. Thanks!</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 10, 2020 at 8:03 PM Artem Dergachev via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Artem Dergachev<br>
Date: 2020-12-10T11:02:54-08:00<br>
New Revision: ea6641085d025ca0a5cef940465ef14d0ccace02<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/ea6641085d025ca0a5cef940465ef14d0ccace02" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ea6641085d025ca0a5cef940465ef14d0ccace02</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/ea6641085d025ca0a5cef940465ef14d0ccace02.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/ea6641085d025ca0a5cef940465ef14d0ccace02.diff</a><br>
<br>
LOG: Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""""<br>
<br>
This reverts commit 6a89cb8136f3435bd977b419b683dc0acc98e61e.<br>
<br>
Added: <br>
    clang/include/clang/Analysis/PathDiagnosticConsumers.def<br>
    clang/include/clang/Analysis/PathDiagnosticConsumers.h<br>
    clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp<br>
    clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp<br>
    clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp<br>
    clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp<br>
    clang/lib/Analysis/TextPathDiagnosticConsumer.cpp<br>
<br>
Modified: <br>
    clang/include/clang/StaticAnalyzer/Core/Analyses.def<br>
    clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br>
    clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h<br>
    clang/include/clang/module.modulemap<br>
    clang/lib/Analysis/CMakeLists.txt<br>
    clang/lib/Frontend/CompilerInvocation.cpp<br>
    clang/lib/StaticAnalyzer/Core/CMakeLists.txt<br>
    clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
<br>
Removed: <br>
    clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h<br>
    clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br>
    clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br>
    clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp<br>
    clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp<br>
<br>
<br>
################################################################################<br>
diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def b/clang/include/clang/Analysis/PathDiagnosticConsumers.def<br>
new file mode 100644<br>
index 000000000000..33d2072fcf31<br>
--- /dev/null<br>
+++ b/clang/include/clang/Analysis/PathDiagnosticConsumers.def<br>
@@ -0,0 +1,50 @@<br>
+//===-- PathDiagnosticConsumers.def - Visualizing warnings ------*- C++ -*-===//<br>
+//<br>
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
+// See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This file defines the set of path diagnostic consumers - objects that<br>
+// implement <br>
diff erent representations of static analysis results.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef ANALYSIS_DIAGNOSTICS<br>
+#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)<br>
+#endif<br>
+<br>
+ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",<br>
+                     createHTMLDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(<br>
+    HTML_SINGLE_FILE, "html-single-file",<br>
+    "Output analysis results using HTML (not allowing for multi-file bugs)",<br>
+    createHTMLSingleFileDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists",<br>
+                     createPlistDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(<br>
+    PLIST_MULTI_FILE, "plist-multi-file",<br>
+    "Output analysis results using Plists (allowing for multi-file bugs)",<br>
+    createPlistMultiFileDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html",<br>
+                     "Output analysis results using HTML wrapped with Plists",<br>
+                     createPlistHTMLDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file",<br>
+                     createSarifDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr",<br>
+                     createTextPathDiagnosticConsumer)<br>
+<br>
+ANALYSIS_DIAGNOSTICS(TEXT_MINIMAL, "text-minimal",<br>
+                     "Emits minimal diagnostics to stderr, stating only the "<br>
+                     "warning message and the associated notes. Usually "<br>
+                     "used in addition to other analysis types",<br>
+                     createTextMinimalPathDiagnosticConsumer)<br>
+<br>
+#undef ANALYSIS_DIAGNOSTICS<br>
<br>
diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h b/clang/include/clang/Analysis/PathDiagnosticConsumers.h<br>
similarity index 89%<br>
rename from clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h<br>
rename to clang/include/clang/Analysis/PathDiagnosticConsumers.h<br>
index f40f88eb32ff..9f23bea1b4c1 100644<br>
--- a/clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h<br>
+++ b/clang/include/clang/Analysis/PathDiagnosticConsumers.h<br>
@@ -18,6 +18,8 @@<br>
 #include <string><br>
 #include <vector><br>
<br>
+#include "clang/Analysis/PathDiagnostic.h"<br>
+<br>
 namespace clang {<br>
<br>
 class AnalyzerOptions;<br>
@@ -29,14 +31,14 @@ class CrossTranslationUnitContext;<br>
 namespace ento {<br>
<br>
 class PathDiagnosticConsumer;<br>
-typedef std::vector<PathDiagnosticConsumer*> PathDiagnosticConsumers;<br>
+typedef std::vector<PathDiagnosticConsumer *> PathDiagnosticConsumers;<br>
<br>
 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)                    \<br>
   void CREATEFN(PathDiagnosticConsumerOptions Diagopts,                        \<br>
                 PathDiagnosticConsumers &C, const std::string &Prefix,         \<br>
                 const Preprocessor &PP,                                        \<br>
                 const cross_tu::CrossTranslationUnitContext &CTU);<br>
-#include "clang/StaticAnalyzer/Core/Analyses.def"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.def"<br>
<br>
 } // end 'ento' namespace<br>
 } // end 'clang' namespace<br>
<br>
diff  --git a/clang/include/clang/StaticAnalyzer/Core/Analyses.def b/clang/include/clang/StaticAnalyzer/Core/Analyses.def<br>
index c4e5f5be6fd7..2e98cbba4c9e 100644<br>
--- a/clang/include/clang/StaticAnalyzer/Core/Analyses.def<br>
+++ b/clang/include/clang/StaticAnalyzer/Core/Analyses.def<br>
@@ -28,42 +28,6 @@ ANALYSIS_CONSTRAINTS(RangeConstraints, "range",<br>
 ANALYSIS_CONSTRAINTS(Z3Constraints, "z3", "Use Z3 contraint solver",<br>
                      CreateZ3ConstraintManager)<br>
<br>
-#ifndef ANALYSIS_DIAGNOSTICS<br>
-#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)<br>
-#endif<br>
-<br>
-ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",<br>
-                     createHTMLDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(<br>
-    HTML_SINGLE_FILE, "html-single-file",<br>
-    "Output analysis results using HTML (not allowing for multi-file bugs)",<br>
-    createHTMLSingleFileDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists",<br>
-                     createPlistDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(<br>
-    PLIST_MULTI_FILE, "plist-multi-file",<br>
-    "Output analysis results using Plists (allowing for multi-file bugs)",<br>
-    createPlistMultiFileDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html",<br>
-                     "Output analysis results using HTML wrapped with Plists",<br>
-                     createPlistHTMLDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file",<br>
-                     createSarifDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr",<br>
-                     createTextPathDiagnosticConsumer)<br>
-<br>
-ANALYSIS_DIAGNOSTICS(TEXT_MINIMAL, "text-minimal",<br>
-                     "Emits minimal diagnostics to stderr, stating only the "<br>
-                     "warning message and the associated notes. Usually "<br>
-                     "used in addition to other analysis types",<br>
-                     createTextMinimalPathDiagnosticConsumer)<br>
-<br>
 #ifndef ANALYSIS_PURGE<br>
 #define ANALYSIS_PURGE(NAME, CMDFLAG, DESC)<br>
 #endif<br>
@@ -91,7 +55,6 @@ ANALYSIS_INLINING_MODE(<br>
<br>
 #undef ANALYSIS_STORE<br>
 #undef ANALYSIS_CONSTRAINTS<br>
-#undef ANALYSIS_DIAGNOSTICS<br>
 #undef ANALYSIS_PURGE<br>
 #undef ANALYSIS_INLINING_MODE<br>
 #undef ANALYSIS_IPA<br>
<br>
diff  --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br>
index e1093772e02c..aa334fed41fb 100644<br>
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br>
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h<br>
@@ -58,7 +58,7 @@ NumConstraints<br>
 ///  analysis results.<br>
 enum AnalysisDiagClients {<br>
 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME,<br>
-#include "clang/StaticAnalyzer/Core/Analyses.def"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.def"<br>
 PD_NONE,<br>
 NUM_ANALYSIS_DIAG_CLIENTS<br>
 };<br>
<br>
diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h<br>
index c76e9c0326af..7e8b9de3a942 100644<br>
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h<br>
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h<br>
@@ -16,10 +16,10 @@<br>
<br>
 #include "clang/Analysis/AnalysisDeclContext.h"<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/Lex/Preprocessor.h"<br>
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"<br>
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
<br>
 namespace clang {<br>
<br>
<br>
diff  --git a/clang/include/clang/module.modulemap b/clang/include/clang/module.modulemap<br>
index 332e533f0347..ec396e1532e0 100644<br>
--- a/clang/include/clang/module.modulemap<br>
+++ b/clang/include/clang/module.modulemap<br>
@@ -3,6 +3,7 @@ module Clang_Analysis {<br>
   umbrella "Analysis"<br>
<br>
   textual header "Analysis/Analyses/ThreadSafetyOps.def"<br>
+  textual header "Analysis/PathDiagnosticConsumers.def"<br>
<br>
   module * { export * }<br>
<br>
<br>
diff  --git a/clang/lib/Analysis/CMakeLists.txt b/clang/lib/Analysis/CMakeLists.txt<br>
index 6cad671a8a4d..a06e68835bc0 100644<br>
--- a/clang/lib/Analysis/CMakeLists.txt<br>
+++ b/clang/lib/Analysis/CMakeLists.txt<br>
@@ -17,14 +17,19 @@ add_clang_library(clangAnalysis<br>
   CodeInjector.cpp<br>
   Dominators.cpp<br>
   ExprMutationAnalyzer.cpp<br>
+  HTMLPathDiagnosticConsumer.cpp<br>
   IssueHash.cpp<br>
   LiveVariables.cpp<br>
   ObjCNoReturn.cpp<br>
   PathDiagnostic.cpp<br>
+  PlistPathDiagnosticConsumer.cpp<br>
+  PlistHTMLPathDiagnosticConsumer.cpp<br>
   PostOrderCFGView.cpp<br>
   ProgramPoint.cpp<br>
   ReachableCode.cpp<br>
   RetainSummaryManager.cpp<br>
+  SarifPathDiagnosticConsumer.cpp<br>
+  TextPathDiagnosticConsumer.cpp<br>
   ThreadSafety.cpp<br>
   ThreadSafetyCommon.cpp<br>
   ThreadSafetyLogical.cpp<br>
@@ -36,6 +41,8 @@ add_clang_library(clangAnalysis<br>
   clangASTMatchers<br>
   clangBasic<br>
   clangLex<br>
+  clangRewrite<br>
+  clangToolingCore<br>
<br>
   DEPENDS<br>
   omp_gen<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp<br>
similarity index 91%<br>
rename from clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br>
rename to clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp<br>
index 149459cf986a..de1a96ed283f 100644<br>
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp<br>
+++ b/clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp<br>
@@ -1,4 +1,4 @@<br>
-//===- HTMLDiagnostics.cpp - HTML Diagnostics for Paths -------------------===//<br>
+//===- HTMLPathDiagnosticConsumer.cpp - HTML Diagnostics for Paths --------===//<br>
 //<br>
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
 // See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
@@ -6,12 +6,13 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
 //<br>
-//  This file defines the HTMLDiagnostics object.<br>
+//  This file defines the HTMLPathDiagnosticConsumer object.<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "clang/Analysis/IssueHash.h"<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/AST/Decl.h"<br>
 #include "clang/AST/DeclBase.h"<br>
 #include "clang/AST/Stmt.h"<br>
@@ -24,7 +25,6 @@<br>
 #include "clang/Lex/Token.h"<br>
 #include "clang/Rewrite/Core/HTMLRewrite.h"<br>
 #include "clang/Rewrite/Core/Rewriter.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
 #include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/ADT/SmallString.h"<br>
 #include "llvm/ADT/StringRef.h"<br>
@@ -56,7 +56,7 @@ using namespace ento;<br>
<br>
 namespace {<br>
<br>
-class HTMLDiagnostics : public PathDiagnosticConsumer {<br>
+class HTMLPathDiagnosticConsumer : public PathDiagnosticConsumer {<br>
   PathDiagnosticConsumerOptions DiagOpts;<br>
   std::string Directory;<br>
   bool createdDir = false;<br>
@@ -65,20 +65,18 @@ class HTMLDiagnostics : public PathDiagnosticConsumer {<br>
   const bool SupportsCrossFileDiagnostics;<br>
<br>
 public:<br>
-  HTMLDiagnostics(PathDiagnosticConsumerOptions DiagOpts,<br>
-                  const std::string &OutputDir, const Preprocessor &pp,<br>
-                  bool supportsMultipleFiles)<br>
-      : DiagOpts(std::move(DiagOpts)), Directory(OutputDir), PP(pp),<br>
-        SupportsCrossFileDiagnostics(supportsMultipleFiles) {}<br>
+  HTMLPathDiagnosticConsumer(PathDiagnosticConsumerOptions DiagOpts,<br>
+                             const std::string &OutputDir,<br>
+                             const Preprocessor &PP, bool SupportsMultipleFiles)<br>
+      : DiagOpts(std::move(DiagOpts)), Directory(OutputDir), PP(PP),<br>
+        SupportsCrossFileDiagnostics(SupportsMultipleFiles) {}<br>
<br>
-  ~HTMLDiagnostics() override { FlushDiagnostics(nullptr); }<br>
+  ~HTMLPathDiagnosticConsumer() override { FlushDiagnostics(nullptr); }<br>
<br>
   void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,<br>
                             FilesMade *filesMade) override;<br>
<br>
-  StringRef getName() const override {<br>
-    return "HTMLDiagnostics";<br>
-  }<br>
+  StringRef getName() const override { return "HTMLPathDiagnosticConsumer"; }<br>
<br>
   bool supportsCrossFileDiagnostics() const override {<br>
     return SupportsCrossFileDiagnostics;<br>
@@ -148,7 +146,8 @@ void ento::createHTMLDiagnosticConsumer(<br>
   if (OutputDir.empty())<br>
     return;<br>
<br>
-  C.push_back(new HTMLDiagnostics(std::move(DiagOpts), OutputDir, PP, true));<br>
+  C.push_back(<br>
+      new HTMLPathDiagnosticConsumer(std::move(DiagOpts), OutputDir, PP, true));<br>
 }<br>
<br>
 void ento::createHTMLSingleFileDiagnosticConsumer(<br>
@@ -161,34 +160,22 @@ void ento::createHTMLSingleFileDiagnosticConsumer(<br>
   if (OutputDir.empty())<br>
     return;<br>
<br>
-  C.push_back(new HTMLDiagnostics(std::move(DiagOpts), OutputDir, PP, false));<br>
-}<br>
-<br>
-void ento::createPlistHTMLDiagnosticConsumer(<br>
-    PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,<br>
-    const std::string &prefix, const Preprocessor &PP,<br>
-    const cross_tu::CrossTranslationUnitContext &CTU) {<br>
-  createHTMLDiagnosticConsumer(<br>
-      DiagOpts, C, std::string(llvm::sys::path::parent_path(prefix)), PP,<br>
-      CTU);<br>
-  createPlistMultiFileDiagnosticConsumer(DiagOpts, C, prefix, PP, CTU);<br>
-  createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, prefix, PP,<br>
-                                          CTU);<br>
+  C.push_back(new HTMLPathDiagnosticConsumer(std::move(DiagOpts), OutputDir, PP,<br>
+                                             false));<br>
 }<br>
<br>
 //===----------------------------------------------------------------------===//<br>
 // Report processing.<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-void HTMLDiagnostics::FlushDiagnosticsImpl(<br>
-  std::vector<const PathDiagnostic *> &Diags,<br>
-  FilesMade *filesMade) {<br>
+void HTMLPathDiagnosticConsumer::FlushDiagnosticsImpl(<br>
+    std::vector<const PathDiagnostic *> &Diags, FilesMade *filesMade) {<br>
   for (const auto Diag : Diags)<br>
     ReportDiag(*Diag, filesMade);<br>
 }<br>
<br>
-void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,<br>
-                                 FilesMade *filesMade) {<br>
+void HTMLPathDiagnosticConsumer::ReportDiag(const PathDiagnostic &D,<br>
+                                            FilesMade *filesMade) {<br>
   // Create the HTML directory if it is missing.<br>
   if (!createdDir) {<br>
     createdDir = true;<br>
@@ -296,8 +283,11 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,<br>
   os << report;<br>
 }<br>
<br>
-std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,<br>
-    const SourceManager& SMgr, const PathPieces& path, const char *declName) {<br>
+std::string HTMLPathDiagnosticConsumer::GenerateHTML(const PathDiagnostic &D,<br>
+                                                     Rewriter &R,<br>
+                                                     const SourceManager &SMgr,<br>
+                                                     const PathPieces &path,<br>
+                                                     const char *declName) {<br>
   // Rewrite source files as HTML for every new file the path crosses<br>
   std::vector<FileID> FileIDs;<br>
   for (auto I : path) {<br>
@@ -369,9 +359,8 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,<br>
   return os.str();<br>
 }<br>
<br>
-void HTMLDiagnostics::dumpCoverageData(<br>
-    const PathDiagnostic &D,<br>
-    const PathPieces &path,<br>
+void HTMLPathDiagnosticConsumer::dumpCoverageData(<br>
+    const PathDiagnostic &D, const PathPieces &path,<br>
     llvm::raw_string_ostream &os) {<br>
<br>
   const FilesToLineNumsMap &ExecutedLines = D.getExecutedLines();<br>
@@ -395,8 +384,8 @@ void HTMLDiagnostics::dumpCoverageData(<br>
   os << "};";<br>
 }<br>
<br>
-std::string HTMLDiagnostics::showRelevantLinesJavascript(<br>
-      const PathDiagnostic &D, const PathPieces &path) {<br>
+std::string HTMLPathDiagnosticConsumer::showRelevantLinesJavascript(<br>
+    const PathDiagnostic &D, const PathPieces &path) {<br>
   std::string s;<br>
   llvm::raw_string_ostream os(s);<br>
   os << "<script type='text/javascript'>\n";<br>
@@ -460,9 +449,10 @@ document.addEventListener("DOMContentLoaded", function() {<br>
   return os.str();<br>
 }<br>
<br>
-void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,<br>
-    const SourceManager& SMgr, const PathPieces& path, FileID FID,<br>
-    const FileEntry *Entry, const char *declName) {<br>
+void HTMLPathDiagnosticConsumer::FinalizeHTML(<br>
+    const PathDiagnostic &D, Rewriter &R, const SourceManager &SMgr,<br>
+    const PathPieces &path, FileID FID, const FileEntry *Entry,<br>
+    const char *declName) {<br>
   // This is a cludge; basically we want to append either the full<br>
   // working directory if we have no directory information.  This is<br>
   // a work in progress.<br>
@@ -607,7 +597,7 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,<br>
   html::AddHeaderFooterInternalBuiltinCSS(R, FID, Entry->getName());<br>
 }<br>
<br>
-StringRef HTMLDiagnostics::showHelpJavascript() {<br>
+StringRef HTMLPathDiagnosticConsumer::showHelpJavascript() {<br>
   return R"<<<(<br>
 <script type='text/javascript'><br>
<br>
@@ -690,8 +680,9 @@ static void HandlePopUpPieceEndTag(Rewriter &R,<br>
   }<br>
 }<br>
<br>
-void HTMLDiagnostics::RewriteFile(Rewriter &R,<br>
-                                  const PathPieces& path, FileID FID) {<br>
+void HTMLPathDiagnosticConsumer::RewriteFile(Rewriter &R,<br>
+                                             const PathPieces &path,<br>
+                                             FileID FID) {<br>
   // Process the path.<br>
   // Maintain the counts of extra note pieces separately.<br>
   unsigned TotalPieces = path.size();<br>
@@ -769,10 +760,9 @@ void HTMLDiagnostics::RewriteFile(Rewriter &R,<br>
   html::HighlightMacros(R, FID, PP);<br>
 }<br>
<br>
-void HTMLDiagnostics::HandlePiece(Rewriter &R, FileID BugFileID,<br>
-                                  const PathDiagnosticPiece &P,<br>
-                                  const std::vector<SourceRange> &PopUpRanges,<br>
-                                  unsigned num, unsigned max) {<br>
+void HTMLPathDiagnosticConsumer::HandlePiece(<br>
+    Rewriter &R, FileID BugFileID, const PathDiagnosticPiece &P,<br>
+    const std::vector<SourceRange> &PopUpRanges, unsigned num, unsigned max) {<br>
   // For now, just draw a box above the line in question, and emit the<br>
   // warning.<br>
   FullSourceLoc Pos = P.getLocation().asLocation();<br>
@@ -1004,9 +994,8 @@ static void EmitAlphaCounter(raw_ostream &os, unsigned n) {<br>
   os << char('a' + x);<br>
 }<br>
<br>
-unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream &os,<br>
-                                            const PathDiagnosticMacroPiece& P,<br>
-                                            unsigned num) {<br>
+unsigned HTMLPathDiagnosticConsumer::ProcessMacroPiece(<br>
+    raw_ostream &os, const PathDiagnosticMacroPiece &P, unsigned num) {<br>
   for (const auto &subPiece : P.subPieces) {<br>
     if (const auto *MP = dyn_cast<PathDiagnosticMacroPiece>(subPiece.get())) {<br>
       num = ProcessMacroPiece(os, *MP, num);<br>
@@ -1028,10 +1017,10 @@ unsigned HTMLDiagnostics::ProcessMacroPiece(raw_ostream &os,<br>
   return num;<br>
 }<br>
<br>
-void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID,<br>
-                                     SourceRange Range,<br>
-                                     const char *HighlightStart,<br>
-                                     const char *HighlightEnd) {<br>
+void HTMLPathDiagnosticConsumer::HighlightRange(Rewriter &R, FileID BugFileID,<br>
+                                                SourceRange Range,<br>
+                                                const char *HighlightStart,<br>
+                                                const char *HighlightEnd) {<br>
   SourceManager &SM = R.getSourceMgr();<br>
   const LangOptions &LangOpts = R.getLangOpts();<br>
<br>
@@ -1066,7 +1055,7 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID,<br>
   html::HighlightRange(R, InstantiationStart, E, HighlightStart, HighlightEnd);<br>
 }<br>
<br>
-StringRef HTMLDiagnostics::generateKeyboardNavigationJavascript() {<br>
+StringRef HTMLPathDiagnosticConsumer::generateKeyboardNavigationJavascript() {<br>
   return R"<<<(<br>
 <script type='text/javascript'><br>
 var digitMatcher = new RegExp("[0-9]+");<br>
<br>
diff  --git a/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp b/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp<br>
new file mode 100644<br>
index 000000000000..60be1077f9de<br>
--- /dev/null<br>
+++ b/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp<br>
@@ -0,0 +1,31 @@<br>
+//===--- PlistHTMLDiagnostics.cpp - The Plist-HTML Diagnostic Consumer. ---===//<br>
+//<br>
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
+// See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+//<br>
+// This diagnostic consumer produces both the HTML output and the Plist output.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
+#include "clang/Basic/SourceManager.h"<br>
+#include "clang/CrossTU/CrossTranslationUnit.h"<br>
+#include "clang/Lex/Preprocessor.h"<br>
+<br>
+using namespace clang;<br>
+using namespace ento;<br>
+<br>
+void ento::createPlistHTMLDiagnosticConsumer(<br>
+    PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,<br>
+    const std::string &Prefix, const Preprocessor &PP,<br>
+    const cross_tu::CrossTranslationUnitContext &CTU) {<br>
+  createHTMLDiagnosticConsumer(<br>
+      DiagOpts, C, std::string(llvm::sys::path::parent_path(Prefix)), PP, CTU);<br>
+  createPlistMultiFileDiagnosticConsumer(DiagOpts, C, Prefix, PP, CTU);<br>
+  createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, Prefix, PP,<br>
+                                          CTU);<br>
+}<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp<br>
similarity index 97%<br>
rename from clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br>
rename to clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp<br>
index 35e320c7755f..4863b645254d 100644<br>
--- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp<br>
+++ b/clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp<br>
@@ -1,4 +1,4 @@<br>
-//===--- PlistDiagnostics.cpp - Plist Diagnostics for Paths -----*- C++ -*-===//<br>
+//===--- PlistPathDiagnosticConsumer.cpp - Plist Diagnostics ----*- C++ -*-===//<br>
 //<br>
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
 // See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
@@ -6,12 +6,13 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
 //<br>
-//  This file defines the PlistDiagnostics object.<br>
+//  This file defines the PlistPathDiagnosticConsumer object.<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "clang/Analysis/IssueHash.h"<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/Basic/FileManager.h"<br>
 #include "clang/Basic/PlistSupport.h"<br>
 #include "clang/Basic/SourceManager.h"<br>
@@ -21,7 +22,6 @@<br>
 #include "clang/Lex/Preprocessor.h"<br>
 #include "clang/Lex/TokenConcatenation.h"<br>
 #include "clang/Rewrite/Core/HTMLRewrite.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
 #include "llvm/ADT/SmallPtrSet.h"<br>
 #include "llvm/ADT/SmallVector.h"<br>
 #include "llvm/ADT/Statistic.h"<br>
@@ -38,7 +38,7 @@ using namespace markup;<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 namespace {<br>
-  class PlistDiagnostics : public PathDiagnosticConsumer {<br>
+  class PlistPathDiagnosticConsumer : public PathDiagnosticConsumer {<br>
     PathDiagnosticConsumerOptions DiagOpts;<br>
     const std::string OutputFile;<br>
     const Preprocessor &PP;<br>
@@ -49,18 +49,18 @@ namespace {<br>
                       const PathPieces &Path);<br>
<br>
   public:<br>
-    PlistDiagnostics(PathDiagnosticConsumerOptions DiagOpts,<br>
+    PlistPathDiagnosticConsumer(PathDiagnosticConsumerOptions DiagOpts,<br>
                      const std::string &OutputFile, const Preprocessor &PP,<br>
                      const cross_tu::CrossTranslationUnitContext &CTU,<br>
                      bool supportsMultipleFiles);<br>
<br>
-    ~PlistDiagnostics() override {}<br>
+    ~PlistPathDiagnosticConsumer() override {}<br>
<br>
     void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,<br>
                               FilesMade *filesMade) override;<br>
<br>
     StringRef getName() const override {<br>
-      return "PlistDiagnostics";<br>
+      return "PlistPathDiagnosticConsumer";<br>
     }<br>
<br>
     PathGenerationScheme getGenerationScheme() const override {<br>
@@ -516,10 +516,10 @@ static void printCoverage(const PathDiagnostic *D,<br>
 }<br>
<br>
 //===----------------------------------------------------------------------===//<br>
-// Methods of PlistDiagnostics.<br>
+// Methods of PlistPathDiagnosticConsumer.<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-PlistDiagnostics::PlistDiagnostics(<br>
+PlistPathDiagnosticConsumer::PlistPathDiagnosticConsumer(<br>
     PathDiagnosticConsumerOptions DiagOpts, const std::string &output,<br>
     const Preprocessor &PP, const cross_tu::CrossTranslationUnitContext &CTU,<br>
     bool supportsMultipleFiles)<br>
@@ -538,8 +538,8 @@ void ento::createPlistDiagnosticConsumer(<br>
   if (OutputFile.empty())<br>
     return;<br>
<br>
-  C.push_back(new PlistDiagnostics(DiagOpts, OutputFile, PP, CTU,<br>
-                                   /*supportsMultipleFiles=*/false));<br>
+  C.push_back(new PlistPathDiagnosticConsumer(DiagOpts, OutputFile, PP, CTU,<br>
+                                              /*supportsMultipleFiles=*/false));<br>
   createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, OutputFile,<br>
                                           PP, CTU);<br>
 }<br>
@@ -553,14 +553,15 @@ void ento::createPlistMultiFileDiagnosticConsumer(<br>
   if (OutputFile.empty())<br>
     return;<br>
<br>
-  C.push_back(new PlistDiagnostics(DiagOpts, OutputFile, PP, CTU,<br>
-                                   /*supportsMultipleFiles=*/true));<br>
+  C.push_back(new PlistPathDiagnosticConsumer(DiagOpts, OutputFile, PP, CTU,<br>
+                                              /*supportsMultipleFiles=*/true));<br>
   createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, OutputFile,<br>
                                           PP, CTU);<br>
 }<br>
<br>
-void PlistDiagnostics::printBugPath(llvm::raw_ostream &o, const FIDMap &FM,<br>
-                                    const PathPieces &Path) {<br>
+void PlistPathDiagnosticConsumer::printBugPath(llvm::raw_ostream &o,<br>
+                                               const FIDMap &FM,<br>
+                                               const PathPieces &Path) {<br>
   PlistPrinter Printer(FM, PP, CTU);<br>
   assert(std::is_partitioned(Path.begin(), Path.end(),<br>
                              [](const PathDiagnosticPieceRef &E) {<br>
@@ -603,9 +604,8 @@ void PlistDiagnostics::printBugPath(llvm::raw_ostream &o, const FIDMap &FM,<br>
   o << "   </array>\n";<br>
 }<br>
<br>
-void PlistDiagnostics::FlushDiagnosticsImpl(<br>
-                                    std::vector<const PathDiagnostic *> &Diags,<br>
-                                    FilesMade *filesMade) {<br>
+void PlistPathDiagnosticConsumer::FlushDiagnosticsImpl(<br>
+    std::vector<const PathDiagnostic *> &Diags, FilesMade *filesMade) {<br>
   // Build up a set of FIDs that we use by scanning the locations and<br>
   // ranges of the diagnostics.<br>
   FIDMap FM;<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp<br>
similarity index 93%<br>
rename from clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp<br>
rename to clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp<br>
index f93d04ccd61a..9d85aad5d258 100644<br>
--- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp<br>
+++ b/clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp<br>
@@ -1,4 +1,4 @@<br>
-//===--- SarifDiagnostics.cpp - Sarif Diagnostics for Paths -----*- C++ -*-===//<br>
+//===--- SarifPathDiagnosticConsumer.cpp - Sarif Diagnostics  ---*- C++ -*-===//<br>
 //<br>
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
 // See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
@@ -6,15 +6,15 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
 //<br>
-//  This file defines the SarifDiagnostics object.<br>
+//  This file defines the SarifPathDiagnosticConsumer object.<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/Basic/FileManager.h"<br>
 #include "clang/Basic/Version.h"<br>
 #include "clang/Lex/Preprocessor.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/ADT/StringMap.h"<br>
 #include "llvm/Support/ConvertUTF.h"<br>
@@ -26,19 +26,19 @@ using namespace clang;<br>
 using namespace ento;<br>
<br>
 namespace {<br>
-class SarifDiagnostics : public PathDiagnosticConsumer {<br>
+class SarifPathDiagnosticConsumer : public PathDiagnosticConsumer {<br>
   std::string OutputFile;<br>
   const LangOptions &LO;<br>
<br>
 public:<br>
-  SarifDiagnostics(const std::string &Output, const LangOptions &LO)<br>
+  SarifPathDiagnosticConsumer(const std::string &Output, const LangOptions &LO)<br>
       : OutputFile(Output), LO(LO) {}<br>
-  ~SarifDiagnostics() override = default;<br>
+  ~SarifPathDiagnosticConsumer() override = default;<br>
<br>
   void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,<br>
                             FilesMade *FM) override;<br>
<br>
-  StringRef getName() const override { return "SarifDiagnostics"; }<br>
+  StringRef getName() const override { return "SarifPathDiagnosticConsumer"; }<br>
   PathGenerationScheme getGenerationScheme() const override { return Minimal; }<br>
   bool supportsLogicalOpControlFlow() const override { return true; }<br>
   bool supportsCrossFileDiagnostics() const override { return true; }<br>
@@ -54,7 +54,7 @@ void ento::createSarifDiagnosticConsumer(<br>
   if (Output.empty())<br>
     return;<br>
<br>
-  C.push_back(new SarifDiagnostics(Output, PP.getLangOpts()));<br>
+  C.push_back(new SarifPathDiagnosticConsumer(Output, PP.getLangOpts()));<br>
   createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, Output, PP,<br>
                                           CTU);<br>
 }<br>
@@ -299,6 +299,9 @@ static json::Object createResult(const LangOptions &LO,<br>
 }<br>
<br>
 static StringRef getRuleDescription(StringRef CheckName) {<br>
+  // FIXME: This is a layering violation; it only works for the particular<br>
+  // use-case of clang static analyzer. This info should be provided<br>
+  // as part of PathDiagnostic itself.<br>
   return llvm::StringSwitch<StringRef>(CheckName)<br>
 #define GET_CHECKERS<br>
 #define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN)                 \<br>
@@ -310,6 +313,9 @@ static StringRef getRuleDescription(StringRef CheckName) {<br>
 }<br>
<br>
 static StringRef getRuleHelpURIStr(StringRef CheckName) {<br>
+  // FIXME: This is a layering violation; it only works for the particular<br>
+  // use-case of clang static analyzer. This info should be provided<br>
+  // as part of PathDiagnostic itself.<br>
   return llvm::StringSwitch<StringRef>(CheckName)<br>
 #define GET_CHECKERS<br>
 #define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN)                 \<br>
@@ -377,7 +383,7 @@ static json::Object createRun(const LangOptions &LO,<br>
                       {"columnKind", "unicodeCodePoints"}};<br>
 }<br>
<br>
-void SarifDiagnostics::FlushDiagnosticsImpl(<br>
+void SarifPathDiagnosticConsumer::FlushDiagnosticsImpl(<br>
     std::vector<const PathDiagnostic *> &Diags, FilesMade *) {<br>
   // We currently overwrite the file if it already exists. However, it may be<br>
   // useful to add a feature someday that allows the user to append a run to an<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp b/clang/lib/Analysis/TextPathDiagnosticConsumer.cpp<br>
similarity index 83%<br>
rename from clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp<br>
rename to clang/lib/Analysis/TextPathDiagnosticConsumer.cpp<br>
index ae2bad7ee77c..21e89548636e 100644<br>
--- a/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp<br>
+++ b/clang/lib/Analysis/TextPathDiagnosticConsumer.cpp<br>
@@ -1,4 +1,4 @@<br>
-//===--- TextDiagnostics.cpp - Text Diagnostics for Paths -------*- C++ -*-===//<br>
+//===--- TextPathDiagnosticConsumer.cpp - Text Diagnostics ------*- C++ -*-===//<br>
 //<br>
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br>
 // See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br>
@@ -6,19 +6,18 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
 //<br>
-//  This file defines the TextDiagnostics object.<br>
+//  This file defines the TextPathDiagnosticConsumer object.<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/Basic/SourceManager.h"<br>
 #include "clang/Basic/Version.h"<br>
 #include "clang/CrossTU/CrossTranslationUnit.h"<br>
 #include "clang/Frontend/ASTUnit.h"<br>
 #include "clang/Lex/Preprocessor.h"<br>
 #include "clang/Rewrite/Core/Rewriter.h"<br>
-#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
 #include "clang/Tooling/Core/Replacement.h"<br>
 #include "clang/Tooling/Tooling.h"<br>
 #include "llvm/ADT/SmallPtrSet.h"<br>
@@ -33,21 +32,21 @@ namespace {<br>
 /// Emitsd minimal diagnostics (report message + notes) for the 'none' output<br>
 /// type to the standard error, or to to compliment many others. Emits detailed<br>
 /// diagnostics in textual format for the 'text' output type.<br>
-class TextDiagnostics : public PathDiagnosticConsumer {<br>
+class TextPathDiagnosticConsumer : public PathDiagnosticConsumer {<br>
   PathDiagnosticConsumerOptions DiagOpts;<br>
   DiagnosticsEngine &DiagEng;<br>
   const LangOptions &LO;<br>
   bool ShouldDisplayPathNotes;<br>
<br>
 public:<br>
-  TextDiagnostics(PathDiagnosticConsumerOptions DiagOpts,<br>
-                  DiagnosticsEngine &DiagEng, const LangOptions &LO,<br>
-                  bool ShouldDisplayPathNotes)<br>
+  TextPathDiagnosticConsumer(PathDiagnosticConsumerOptions DiagOpts,<br>
+                             DiagnosticsEngine &DiagEng, const LangOptions &LO,<br>
+                             bool ShouldDisplayPathNotes)<br>
       : DiagOpts(std::move(DiagOpts)), DiagEng(DiagEng), LO(LO),<br>
         ShouldDisplayPathNotes(ShouldDisplayPathNotes) {}<br>
-  ~TextDiagnostics() override {}<br>
+  ~TextPathDiagnosticConsumer() override {}<br>
<br>
-  StringRef getName() const override { return "TextDiagnostics"; }<br>
+  StringRef getName() const override { return "TextPathDiagnosticConsumer"; }<br>
<br>
   bool supportsLogicalOpControlFlow() const override { return true; }<br>
   bool supportsCrossFileDiagnostics() const override { return true; }<br>
@@ -140,16 +139,16 @@ void ento::createTextPathDiagnosticConsumer(<br>
     PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,<br>
     const std::string &Prefix, const clang::Preprocessor &PP,<br>
     const cross_tu::CrossTranslationUnitContext &CTU) {<br>
-  C.emplace_back(new TextDiagnostics(std::move(DiagOpts), PP.getDiagnostics(),<br>
-                                     PP.getLangOpts(),<br>
-                                     /*ShouldDisplayPathNotes=*/true));<br>
+  C.emplace_back(new TextPathDiagnosticConsumer(<br>
+      std::move(DiagOpts), PP.getDiagnostics(), PP.getLangOpts(),<br>
+      /*ShouldDisplayPathNotes=*/true));<br>
 }<br>
<br>
 void ento::createTextMinimalPathDiagnosticConsumer(<br>
     PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,<br>
     const std::string &Prefix, const clang::Preprocessor &PP,<br>
     const cross_tu::CrossTranslationUnitContext &CTU) {<br>
-  C.emplace_back(new TextDiagnostics(std::move(DiagOpts), PP.getDiagnostics(),<br>
-                                     PP.getLangOpts(),<br>
-                                     /*ShouldDisplayPathNotes=*/false));<br>
+  C.emplace_back(new TextPathDiagnosticConsumer(<br>
+      std::move(DiagOpts), PP.getDiagnostics(), PP.getLangOpts(),<br>
+      /*ShouldDisplayPathNotes=*/false));<br>
 }<br>
<br>
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp<br>
index be5a64464bf1..6e3bf603b190 100644<br>
--- a/clang/lib/Frontend/CompilerInvocation.cpp<br>
+++ b/clang/lib/Frontend/CompilerInvocation.cpp<br>
@@ -444,7 +444,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,<br>
     AnalysisDiagClients Value = llvm::StringSwitch<AnalysisDiagClients>(Name)<br>
 #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) \<br>
       .Case(CMDFLAG, PD_##NAME)<br>
-#include "clang/StaticAnalyzer/Core/Analyses.def"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.def"<br>
       .Default(NUM_ANALYSIS_DIAG_CLIENTS);<br>
     if (Value == NUM_ANALYSIS_DIAG_CLIENTS) {<br>
       Diags.Report(diag::err_drv_invalid_value)<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt<br>
index d947d415ad6e..b1f527ed75d5 100644<br>
--- a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt<br>
+++ b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt<br>
@@ -30,16 +30,13 @@ add_clang_library(clangStaticAnalyzerCore<br>
   ExprEngineCallAndReturn.cpp<br>
   ExprEngineObjC.cpp<br>
   FunctionSummary.cpp<br>
-  HTMLDiagnostics.cpp<br>
   LoopUnrolling.cpp<br>
   LoopWidening.cpp<br>
   MemRegion.cpp<br>
-  PlistDiagnostics.cpp<br>
   ProgramState.cpp<br>
   RangeConstraintManager.cpp<br>
   RangedConstraintManager.cpp<br>
   RegionStore.cpp<br>
-  SarifDiagnostics.cpp<br>
   SimpleConstraintManager.cpp<br>
   SimpleSValBuilder.cpp<br>
   SMTConstraintManager.cpp<br>
@@ -47,7 +44,6 @@ add_clang_library(clangStaticAnalyzerCore<br>
   SValBuilder.cpp<br>
   SVals.cpp<br>
   SymbolManager.cpp<br>
-  TextDiagnostics.cpp<br>
   WorkList.cpp<br>
<br>
   LINK_LIBS<br>
<br>
diff  --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
index f2a19b2ccc90..1e94950ca097 100644<br>
--- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
+++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp<br>
@@ -21,6 +21,7 @@<br>
 #include "clang/Analysis/CallGraph.h"<br>
 #include "clang/Analysis/CodeInjector.h"<br>
 #include "clang/Analysis/PathDiagnostic.h"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.h"<br>
 #include "clang/Basic/SourceManager.h"<br>
 #include "clang/CrossTU/CrossTranslationUnit.h"<br>
 #include "clang/Frontend/CompilerInstance.h"<br>
@@ -30,7 +31,6 @@<br>
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"<br>
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"<br>
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"<br>
-#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"<br>
 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"<br>
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"<br>
 #include "llvm/ADT/PostOrderIterator.h"<br>
@@ -152,7 +152,7 @@ class AnalysisConsumer : public AnalysisASTConsumer,<br>
   case PD_##NAME:                                                              \<br>
     CREATEFN(Opts->getDiagOpts(), PathConsumers, OutDir, PP, CTU);             \<br>
     break;<br>
-#include "clang/StaticAnalyzer/Core/Analyses.def"<br>
+#include "clang/Analysis/PathDiagnosticConsumers.def"<br>
     default:<br>
       llvm_unreachable("Unknown analyzer output type!");<br>
     }<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>