#include "clang/Analysis/MacroExpansionContext.h"
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/Sarif.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Version.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
usingnamespacellvm;
usingnamespaceclang;
usingnamespaceento;
namespace {
class SarifDiagnostics : public PathDiagnosticConsumer { … };
}
void ento::createSarifDiagnosticConsumer(
PathDiagnosticConsumerOptions DiagOpts, PathDiagnosticConsumers &C,
const std::string &Output, const Preprocessor &PP,
const cross_tu::CrossTranslationUnitContext &CTU,
const MacroExpansionContext &MacroExpansions) { … }
static StringRef getRuleDescription(StringRef CheckName) { … }
static StringRef getRuleHelpURIStr(StringRef CheckName) { … }
static ThreadFlowImportance
calculateImportance(const PathDiagnosticPiece &Piece) { … }
static CharSourceRange convertTokenRangeToCharRange(const SourceRange &R,
const SourceManager &SM,
const LangOptions &LO) { … }
static SmallVector<ThreadFlow, 8> createThreadFlows(const PathDiagnostic *Diag,
const LangOptions &LO) { … }
static StringMap<uint32_t>
createRuleMapping(const std::vector<const PathDiagnostic *> &Diags,
SarifDocumentWriter &SarifWriter) { … }
static SarifResult createResult(const PathDiagnostic *Diag,
const StringMap<uint32_t> &RuleMapping,
const LangOptions &LO) { … }
void SarifDiagnostics::FlushDiagnosticsImpl(
std::vector<const PathDiagnostic *> &Diags, FilesMade *) { … }