#include "clang/Analysis/IssueHash.h"
#include "clang/Analysis/MacroExpansionContext.h"
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/PlistSupport.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Version.h"
#include "clang/CrossTU/CrossTranslationUnit.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/TokenConcatenation.h"
#include "clang/Rewrite/Core/HTMLRewrite.h"
#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Casting.h"
#include <memory>
#include <optional>
usingnamespaceclang;
usingnamespaceento;
usingnamespacemarkup;
namespace {
class PlistDiagnostics : public PathDiagnosticConsumer { … };
}
namespace {
class PlistPrinter { … };
}
static void printCoverage(const PathDiagnostic *D,
unsigned InputIndentLevel,
SmallVectorImpl<FileID> &Fids,
FIDMap &FM,
llvm::raw_fd_ostream &o);
static std::optional<StringRef> getExpandedMacro(
SourceLocation MacroLoc, const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions, const SourceManager &SM);
void PlistPrinter::EmitRanges(raw_ostream &o,
const ArrayRef<SourceRange> Ranges,
unsigned indent) { … }
void PlistPrinter::EmitMessage(raw_ostream &o, StringRef Message,
unsigned indent) { … }
void PlistPrinter::EmitFixits(raw_ostream &o, ArrayRef<FixItHint> fixits,
unsigned indent) { … }
void PlistPrinter::ReportControlFlow(raw_ostream &o,
const PathDiagnosticControlFlowPiece& P,
unsigned indent) { … }
void PlistPrinter::ReportEvent(raw_ostream &o, const PathDiagnosticEventPiece& P,
unsigned indent, unsigned depth,
bool isKeyEvent) { … }
void PlistPrinter::ReportCall(raw_ostream &o, const PathDiagnosticCallPiece &P,
unsigned indent,
unsigned depth) { … }
void PlistPrinter::ReportMacroSubPieces(raw_ostream &o,
const PathDiagnosticMacroPiece& P,
unsigned indent, unsigned depth) { … }
void PlistPrinter::ReportMacroExpansions(raw_ostream &o, unsigned indent) { … }
void PlistPrinter::ReportNote(raw_ostream &o, const PathDiagnosticNotePiece& P,
unsigned indent) { … }
void PlistPrinter::ReportPopUp(raw_ostream &o,
const PathDiagnosticPopUpPiece &P,
unsigned indent) { … }
static void printCoverage(const PathDiagnostic *D,
unsigned InputIndentLevel,
SmallVectorImpl<FileID> &Fids,
FIDMap &FM,
llvm::raw_fd_ostream &o) { … }
PlistDiagnostics::PlistDiagnostics(
PathDiagnosticConsumerOptions DiagOpts, const std::string &output,
const Preprocessor &PP, const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions, bool supportsMultipleFiles)
: … { … }
void ento::createPlistDiagnosticConsumer(
PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,
const std::string &OutputFile, const Preprocessor &PP,
const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions) { … }
void ento::createPlistMultiFileDiagnosticConsumer(
PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,
const std::string &OutputFile, const Preprocessor &PP,
const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions) { … }
void PlistDiagnostics::printBugPath(llvm::raw_ostream &o, const FIDMap &FM,
const PathPieces &Path) { … }
void PlistDiagnostics::FlushDiagnosticsImpl(
std::vector<const PathDiagnostic *> &Diags,
FilesMade *filesMade) { … }
static std::optional<StringRef>
getExpandedMacro(SourceLocation MacroExpansionLoc,
const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions,
const SourceManager &SM) { … }