diff --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h deleted file mode 100644 index ba2562b430555e..00000000000000 --- a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h +++ /dev/null @@ -1,41 +0,0 @@ -//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU ------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H -#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H - -#include "llvm/ADT/Optional.h" -#include "clang/Basic/SourceManager.h" - -namespace clang { - -class ASTUnit; - -/// This class is an abstract interface acting as a bridge between -/// an analysis that requires lookups across translation units (a user -/// of that interface) and the facility that implements such lookups -/// (an implementation of that interface). This is useful to break direct -/// link-time dependencies between the (possibly shared) libraries in which -/// the user and the implementation live. -class CrossTUAnalysisHelper { -public: - /// Determine the original source location in the original TU for an - /// imported source location. - /// \p ToLoc Source location in the imported-to AST. - /// \return Source location in the imported-from AST and the corresponding - /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit - /// object that is returned here). - /// If any error happens (ToLoc is a non-imported source location) empty is - /// returned. - virtual llvm::Optional> - getImportedFromSourceLocation(SourceLocation ToLoc) const = 0; - - virtual ~CrossTUAnalysisHelper() {} -}; -} // namespace clang - -#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H diff --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def b/clang/include/clang/Analysis/PathDiagnosticConsumers.def deleted file mode 100644 index 33d2072fcf31d1..00000000000000 --- a/clang/include/clang/Analysis/PathDiagnosticConsumers.def +++ /dev/null @@ -1,50 +0,0 @@ -//===-- PathDiagnosticConsumers.def - Visualizing warnings ------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the set of path diagnostic consumers - objects that -// implement different representations of static analysis results. -// -//===----------------------------------------------------------------------===// - -#ifndef ANALYSIS_DIAGNOSTICS -#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN) -#endif - -ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML", - createHTMLDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS( - HTML_SINGLE_FILE, "html-single-file", - "Output analysis results using HTML (not allowing for multi-file bugs)", - createHTMLSingleFileDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", - createPlistDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS( - PLIST_MULTI_FILE, "plist-multi-file", - "Output analysis results using Plists (allowing for multi-file bugs)", - createPlistMultiFileDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", - "Output analysis results using HTML wrapped with Plists", - createPlistHTMLDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file", - createSarifDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr", - createTextPathDiagnosticConsumer) - -ANALYSIS_DIAGNOSTICS(TEXT_MINIMAL, "text-minimal", - "Emits minimal diagnostics to stderr, stating only the " - "warning message and the associated notes. Usually " - "used in addition to other analysis types", - createTextMinimalPathDiagnosticConsumer) - -#undef ANALYSIS_DIAGNOSTICS diff --git a/clang/include/clang/CrossTU/CrossTranslationUnit.h b/clang/include/clang/CrossTU/CrossTranslationUnit.h index 2926ad288dbbaf..027c6f16430bec 100644 --- a/clang/include/clang/CrossTU/CrossTranslationUnit.h +++ b/clang/include/clang/CrossTU/CrossTranslationUnit.h @@ -14,7 +14,6 @@ #ifndef LLVM_CLANG_CROSSTU_CROSSTRANSLATIONUNIT_H #define LLVM_CLANG_CROSSTU_CROSSTRANSLATIONUNIT_H -#include "clang/Analysis/CrossTUAnalysisHelper.h" #include "clang/AST/ASTImporterSharedState.h" #include "clang/Basic/LLVM.h" #include "llvm/ADT/DenseMap.h" @@ -121,10 +120,10 @@ bool containsConst(const VarDecl *VD, const ASTContext &ACtx); /// the locations of the AST files for each definition. /// /// Note that this class also implements caching. -class CrossTranslationUnitContext : public CrossTUAnalysisHelper { +class CrossTranslationUnitContext { public: CrossTranslationUnitContext(CompilerInstance &CI); - ~CrossTranslationUnitContext() override; + ~CrossTranslationUnitContext(); /// This function loads a function or variable definition from an /// external AST file and merges it into the original AST. @@ -192,7 +191,7 @@ class CrossTranslationUnitContext : public CrossTUAnalysisHelper { /// If any error happens (ToLoc is a non-imported source location) empty is /// returned. llvm::Optional> - getImportedFromSourceLocation(SourceLocation ToLoc) const override; + getImportedFromSourceLocation(const clang::SourceLocation &ToLoc) const; private: using ImportedFileIDMap = diff --git a/clang/include/clang/StaticAnalyzer/Core/Analyses.def b/clang/include/clang/StaticAnalyzer/Core/Analyses.def index 2e98cbba4c9e87..c4e5f5be6fd7d0 100644 --- a/clang/include/clang/StaticAnalyzer/Core/Analyses.def +++ b/clang/include/clang/StaticAnalyzer/Core/Analyses.def @@ -28,6 +28,42 @@ ANALYSIS_CONSTRAINTS(RangeConstraints, "range", ANALYSIS_CONSTRAINTS(Z3Constraints, "z3", "Use Z3 contraint solver", CreateZ3ConstraintManager) +#ifndef ANALYSIS_DIAGNOSTICS +#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN) +#endif + +ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML", + createHTMLDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS( + HTML_SINGLE_FILE, "html-single-file", + "Output analysis results using HTML (not allowing for multi-file bugs)", + createHTMLSingleFileDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", + createPlistDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS( + PLIST_MULTI_FILE, "plist-multi-file", + "Output analysis results using Plists (allowing for multi-file bugs)", + createPlistMultiFileDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", + "Output analysis results using HTML wrapped with Plists", + createPlistHTMLDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS(SARIF, "sarif", "Output analysis results in a SARIF file", + createSarifDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results to stderr", + createTextPathDiagnosticConsumer) + +ANALYSIS_DIAGNOSTICS(TEXT_MINIMAL, "text-minimal", + "Emits minimal diagnostics to stderr, stating only the " + "warning message and the associated notes. Usually " + "used in addition to other analysis types", + createTextMinimalPathDiagnosticConsumer) + #ifndef ANALYSIS_PURGE #define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) #endif @@ -55,6 +91,7 @@ ANALYSIS_INLINING_MODE( #undef ANALYSIS_STORE #undef ANALYSIS_CONSTRAINTS +#undef ANALYSIS_DIAGNOSTICS #undef ANALYSIS_PURGE #undef ANALYSIS_INLINING_MODE #undef ANALYSIS_IPA diff --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h index aa334fed41fb21..e1093772e02c34 100644 --- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -58,7 +58,7 @@ NumConstraints /// analysis results. enum AnalysisDiagClients { #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) PD_##NAME, -#include "clang/Analysis/PathDiagnosticConsumers.def" +#include "clang/StaticAnalyzer/Core/Analyses.def" PD_NONE, NUM_ANALYSIS_DIAG_CLIENTS }; diff --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.h b/clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h similarity index 78% rename from clang/include/clang/Analysis/PathDiagnosticConsumers.h rename to clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h index fde2e34982160d..f40f88eb32ff4d 100644 --- a/clang/include/clang/Analysis/PathDiagnosticConsumers.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h @@ -18,24 +18,25 @@ #include #include -#include "clang/Analysis/PathDiagnostic.h" - namespace clang { class AnalyzerOptions; class Preprocessor; -class CrossTUAnalysisHelper; +namespace cross_tu { +class CrossTranslationUnitContext; +} namespace ento { class PathDiagnosticConsumer; -typedef std::vector PathDiagnosticConsumers; +typedef std::vector PathDiagnosticConsumers; #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN) \ void CREATEFN(PathDiagnosticConsumerOptions Diagopts, \ PathDiagnosticConsumers &C, const std::string &Prefix, \ - const Preprocessor &PP, const CrossTUAnalysisHelper &CTU); -#include "clang/Analysis/PathDiagnosticConsumers.def" + const Preprocessor &PP, \ + const cross_tu::CrossTranslationUnitContext &CTU); +#include "clang/StaticAnalyzer/Core/Analyses.def" } // end 'ento' namespace } // end 'clang' namespace diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index 7e8b9de3a94213..c76e9c0326afe7 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -16,10 +16,10 @@ #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/PathDiagnostic.h" -#include "clang/Analysis/PathDiagnosticConsumers.h" #include "clang/Lex/Preprocessor.h" #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" +#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h" namespace clang { diff --git a/clang/include/clang/module.modulemap b/clang/include/clang/module.modulemap index ec396e1532e0c4..332e533f03477a 100644 --- a/clang/include/clang/module.modulemap +++ b/clang/include/clang/module.modulemap @@ -3,7 +3,6 @@ module Clang_Analysis { umbrella "Analysis" textual header "Analysis/Analyses/ThreadSafetyOps.def" - textual header "Analysis/PathDiagnosticConsumers.def" module * { export * } diff --git a/clang/lib/Analysis/CMakeLists.txt b/clang/lib/Analysis/CMakeLists.txt index a06e68835bc038..6cad671a8a4d91 100644 --- a/clang/lib/Analysis/CMakeLists.txt +++ b/clang/lib/Analysis/CMakeLists.txt @@ -17,19 +17,14 @@ add_clang_library(clangAnalysis CodeInjector.cpp Dominators.cpp ExprMutationAnalyzer.cpp - HTMLPathDiagnosticConsumer.cpp IssueHash.cpp LiveVariables.cpp ObjCNoReturn.cpp PathDiagnostic.cpp - PlistPathDiagnosticConsumer.cpp - PlistHTMLPathDiagnosticConsumer.cpp PostOrderCFGView.cpp ProgramPoint.cpp ReachableCode.cpp RetainSummaryManager.cpp - SarifPathDiagnosticConsumer.cpp - TextPathDiagnosticConsumer.cpp ThreadSafety.cpp ThreadSafetyCommon.cpp ThreadSafetyLogical.cpp @@ -41,8 +36,6 @@ add_clang_library(clangAnalysis clangASTMatchers clangBasic clangLex - clangRewrite - clangToolingCore DEPENDS omp_gen diff --git a/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp b/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp deleted file mode 100644 index 4a9d2fe84e3853..00000000000000 --- a/clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===--- PlistHTMLDiagnostics.cpp - The Plist-HTML Diagnostic Consumer. ---===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This diagnostic consumer produces both the HTML output and the Plist output. -// -//===----------------------------------------------------------------------===// - -#include "clang/Analysis/PathDiagnostic.h" -#include "clang/Analysis/PathDiagnosticConsumers.h" -#include "clang/Basic/SourceManager.h" -#include "clang/CrossTU/CrossTranslationUnit.h" -#include "clang/Lex/Preprocessor.h" - -using namespace clang; -using namespace ento; - -namespace clang { -class CrossTUAnalysisHelper; -} - -void ento::createPlistHTMLDiagnosticConsumer( - PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C, - const std::string &Prefix, const Preprocessor &PP, - const CrossTUAnalysisHelper &CTU) { - createHTMLDiagnosticConsumer( - DiagOpts, C, std::string(llvm::sys::path::parent_path(Prefix)), PP, CTU); - createPlistMultiFileDiagnosticConsumer(DiagOpts, C, Prefix, PP, CTU); - createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, Prefix, PP, - CTU); -} diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index b7dc43cf9aac28..45a2a91616b8c3 100644 --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -765,7 +765,7 @@ CrossTranslationUnitContext::getOrCreateASTImporter(ASTUnit *Unit) { llvm::Optional> CrossTranslationUnitContext::getImportedFromSourceLocation( - SourceLocation ToLoc) const { + const clang::SourceLocation &ToLoc) const { const SourceManager &SM = Context.getSourceManager(); auto DecToLoc = SM.getDecomposedLoc(ToLoc); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 6e3bf603b19041..be5a64464bf195 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -444,7 +444,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, AnalysisDiagClients Value = llvm::StringSwitch(Name) #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN) \ .Case(CMDFLAG, PD_##NAME) -#include "clang/Analysis/PathDiagnosticConsumers.def" +#include "clang/StaticAnalyzer/Core/Analyses.def" .Default(NUM_ANALYSIS_DIAG_CLIENTS); if (Value == NUM_ANALYSIS_DIAG_CLIENTS) { Diags.Report(diag::err_drv_invalid_value) diff --git a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt index b1f527ed75d551..d947d415ad6e06 100644 --- a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt +++ b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt @@ -30,13 +30,16 @@ add_clang_library(clangStaticAnalyzerCore ExprEngineCallAndReturn.cpp ExprEngineObjC.cpp FunctionSummary.cpp + HTMLDiagnostics.cpp LoopUnrolling.cpp LoopWidening.cpp MemRegion.cpp + PlistDiagnostics.cpp ProgramState.cpp RangeConstraintManager.cpp RangedConstraintManager.cpp RegionStore.cpp + SarifDiagnostics.cpp SimpleConstraintManager.cpp SimpleSValBuilder.cpp SMTConstraintManager.cpp @@ -44,6 +47,7 @@ add_clang_library(clangStaticAnalyzerCore SValBuilder.cpp SVals.cpp SymbolManager.cpp + TextDiagnostics.cpp WorkList.cpp LINK_LIBS diff --git a/clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp similarity index 91% rename from clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp rename to clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index fb60819b1c156b..149459cf986a74 100644 --- a/clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -1,4 +1,4 @@ -//===- HTMLPathDiagnosticConsumer.cpp - HTML Diagnostics for Paths --------===// +//===- HTMLDiagnostics.cpp - HTML Diagnostics for Paths -------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,13 +6,12 @@ // //===----------------------------------------------------------------------===// // -// This file defines the HTMLPathDiagnosticConsumer object. +// This file defines the HTMLDiagnostics object. // //===----------------------------------------------------------------------===// #include "clang/Analysis/IssueHash.h" #include "clang/Analysis/PathDiagnostic.h" -#include "clang/Analysis/PathDiagnosticConsumers.h" #include "clang/AST/Decl.h" #include "clang/AST/DeclBase.h" #include "clang/AST/Stmt.h" @@ -25,6 +24,7 @@ #include "clang/Lex/Token.h" #include "clang/Rewrite/Core/HTMLRewrite.h" #include "clang/Rewrite/Core/Rewriter.h" +#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" @@ -50,17 +50,13 @@ using namespace clang; using namespace ento; -namespace clang { -class CrossTUAnalysisHelper; -} - //===----------------------------------------------------------------------===// // Boilerplate. //===----------------------------------------------------------------------===// namespace { -class HTMLPathDiagnosticConsumer : public PathDiagnosticConsumer { +class HTMLDiagnostics : public PathDiagnosticConsumer { PathDiagnosticConsumerOptions DiagOpts; std::string Directory; bool createdDir = false; @@ -69,18 +65,20 @@ class HTMLPathDiagnosticConsumer : public PathDiagnosticConsumer { const bool SupportsCrossFileDiagnostics; public: - HTMLPathDiagnosticConsumer(PathDiagnosticConsumerOptions DiagOpts, - const std::string &OutputDir, - const Preprocessor &PP, bool SupportsMultipleFiles) - : DiagOpts(std::move(DiagOpts)), Directory(OutputDir), PP(PP), - SupportsCrossFileDiagnostics(SupportsMultipleFiles) {} + HTMLDiagnostics(PathDiagnosticConsumerOptions DiagOpts, + const std::string &OutputDir, const Preprocessor &pp, + bool supportsMultipleFiles) + : DiagOpts(std::move(DiagOpts)), Directory(OutputDir), PP(pp), + SupportsCrossFileDiagnostics(supportsMultipleFiles) {} - ~HTMLPathDiagnosticConsumer() override { FlushDiagnostics(nullptr); } + ~HTMLDiagnostics() override { FlushDiagnostics(nullptr); } void FlushDiagnosticsImpl(std::vector &Diags, FilesMade *filesMade) override; - StringRef getName() const override { return "HTMLPathDiagnosticConsumer"; } + StringRef getName() const override { + return "HTMLDiagnostics"; + } bool supportsCrossFileDiagnostics() const override { return SupportsCrossFileDiagnostics; @@ -137,7 +135,7 @@ class HTMLPathDiagnosticConsumer : public PathDiagnosticConsumer { void ento::createHTMLDiagnosticConsumer( PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C, const std::string &OutputDir, const Preprocessor &PP, - const CrossTUAnalysisHelper &CTU) { + const cross_tu::CrossTranslationUnitContext &CTU) { // FIXME: HTML is currently our default output type, but if the output // directory isn't specified, it acts like if it was in the minimal text @@ -150,36 +148,47 @@ void ento::createHTMLDiagnosticConsumer( if (OutputDir.empty()) return; - C.push_back( - new HTMLPathDiagnosticConsumer(std::move(DiagOpts), OutputDir, PP, true)); + C.push_back(new HTMLDiagnostics(std::move(DiagOpts), OutputDir, PP, true)); } void ento::createHTMLSingleFileDiagnosticConsumer( PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C, const std::string &OutputDir, const Preprocessor &PP, - const CrossTUAnalysisHelper &CTU) { + const cross_tu::CrossTranslationUnitContext &CTU) { createTextMinimalPathDiagnosticConsumer(DiagOpts, C, OutputDir, PP, CTU); // TODO: Emit an error here. if (OutputDir.empty()) return; - C.push_back(new HTMLPathDiagnosticConsumer(std::move(DiagOpts), OutputDir, PP, - false)); + C.push_back(new HTMLDiagnostics(std::move(DiagOpts), OutputDir, PP, false)); +} + +void ento::createPlistHTMLDiagnosticConsumer( + PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C, + const std::string &prefix, const Preprocessor &PP, + const cross_tu::CrossTranslationUnitContext &CTU) { + createHTMLDiagnosticConsumer( + DiagOpts, C, std::string(llvm::sys::path::parent_path(prefix)), PP, + CTU); + createPlistMultiFileDiagnosticConsumer(DiagOpts, C, prefix, PP, CTU); + createTextMinimalPathDiagnosticConsumer(std::move(DiagOpts), C, prefix, PP, + CTU); } //===----------------------------------------------------------------------===// // Report processing. //===----------------------------------------------------------------------===// -void HTMLPathDiagnosticConsumer::FlushDiagnosticsImpl( - std::vector &Diags, FilesMade *filesMade) { +void HTMLDiagnostics::FlushDiagnosticsImpl( + std::vector &Diags, + FilesMade *filesMade) { for (const auto Diag : Diags) ReportDiag(*Diag, filesMade); } -void HTMLPathDiagnosticConsumer::ReportDiag(const PathDiagnostic &D, - FilesMade *filesMade) { +void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, + FilesMade *filesMade) { // Create the HTML directory if it is missing. if (!createdDir) { createdDir = true; @@ -287,11 +296,8 @@ void HTMLPathDiagnosticConsumer::ReportDiag(const PathDiagnostic &D, os << report; } -std::string HTMLPathDiagnosticConsumer::GenerateHTML(const PathDiagnostic &D, - Rewriter &R, - const SourceManager &SMgr, - const PathPieces &path, - const char *declName) { +std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R, + const SourceManager& SMgr, const PathPieces& path, const char *declName) { // Rewrite source files as HTML for every new file the path crosses std::vector FileIDs; for (auto I : path) { @@ -363,8 +369,9 @@ std::string HTMLPathDiagnosticConsumer::GenerateHTML(const PathDiagnostic &D, return os.str(); } -void HTMLPathDiagnosticConsumer::dumpCoverageData( - const PathDiagnostic &D, const PathPieces &path, +void HTMLDiagnostics::dumpCoverageData( + const PathDiagnostic &D, + const PathPieces &path, llvm::raw_string_ostream &os) { const FilesToLineNumsMap &ExecutedLines = D.getExecutedLines(); @@ -388,8 +395,8 @@ void HTMLPathDiagnosticConsumer::dumpCoverageData( os << "};"; } -std::string HTMLPathDiagnosticConsumer::showRelevantLinesJavascript( - const PathDiagnostic &D, const PathPieces &path) { +std::string HTMLDiagnostics::showRelevantLinesJavascript( + const PathDiagnostic &D, const PathPieces &path) { std::string s; llvm::raw_string_ostream os(s); os << "