#include "clang/Frontend/SerializedDiagnosticPrinter.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/DiagnosticRenderer.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/SerializedDiagnosticReader.h"
#include "clang/Frontend/SerializedDiagnostics.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitstream/BitCodes.h"
#include "llvm/Bitstream/BitstreamReader.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <utility>
usingnamespaceclang;
usingnamespaceclang::serialized_diags;
namespace {
class AbbreviationMap { … };
RecordData;
RecordDataImpl;
RecordDataRef;
class SDiagsWriter;
class SDiagsRenderer : public DiagnosticNoteRenderer { … };
AbbrevLookup;
class SDiagsMerger : SerializedDiagnosticReader { … };
class SDiagsWriter : public DiagnosticConsumer { … };
}
namespace clang {
namespace serialized_diags {
std::unique_ptr<DiagnosticConsumer>
create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords) { … }
}
}
static void EmitBlockID(unsigned ID, const char *Name,
llvm::BitstreamWriter &Stream,
RecordDataImpl &Record) { … }
static void EmitRecordID(unsigned ID, const char *Name,
llvm::BitstreamWriter &Stream,
RecordDataImpl &Record){ … }
void SDiagsWriter::AddLocToRecord(FullSourceLoc Loc, PresumedLoc PLoc,
RecordDataImpl &Record, unsigned TokSize) { … }
void SDiagsWriter::AddCharSourceRangeToRecord(CharSourceRange Range,
RecordDataImpl &Record,
const SourceManager &SM) { … }
unsigned SDiagsWriter::getEmitFile(const char *FileName){ … }
void SDiagsWriter::EmitCharSourceRange(CharSourceRange R,
const SourceManager &SM) { … }
void SDiagsWriter::EmitPreamble() { … }
static void AddSourceLocationAbbrev(llvm::BitCodeAbbrev &Abbrev) { … }
static void AddRangeLocationAbbrev(llvm::BitCodeAbbrev &Abbrev) { … }
void SDiagsWriter::EmitBlockInfoBlock() { … }
void SDiagsWriter::EmitMetaBlock() { … }
unsigned SDiagsWriter::getEmitCategory(unsigned int category) { … }
unsigned SDiagsWriter::getEmitDiagnosticFlag(DiagnosticsEngine::Level DiagLevel,
unsigned DiagID) { … }
unsigned SDiagsWriter::getEmitDiagnosticFlag(StringRef FlagName) { … }
void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info) { … }
static serialized_diags::Level getStableLevel(DiagnosticsEngine::Level Level) { … }
void SDiagsWriter::EmitDiagnosticMessage(FullSourceLoc Loc, PresumedLoc PLoc,
DiagnosticsEngine::Level Level,
StringRef Message,
DiagOrStoredDiag D) { … }
void SDiagsRenderer::emitDiagnosticMessage(
FullSourceLoc Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level,
StringRef Message, ArrayRef<clang::CharSourceRange> Ranges,
DiagOrStoredDiag D) { … }
void SDiagsWriter::EnterDiagBlock() { … }
void SDiagsWriter::ExitDiagBlock() { … }
void SDiagsRenderer::beginDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level) { … }
void SDiagsRenderer::endDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level) { … }
void SDiagsWriter::EmitCodeContext(SmallVectorImpl<CharSourceRange> &Ranges,
ArrayRef<FixItHint> Hints,
const SourceManager &SM) { … }
void SDiagsRenderer::emitCodeContext(FullSourceLoc Loc,
DiagnosticsEngine::Level Level,
SmallVectorImpl<CharSourceRange> &Ranges,
ArrayRef<FixItHint> Hints) { … }
void SDiagsRenderer::emitNote(FullSourceLoc Loc, StringRef Message) { … }
DiagnosticsEngine *SDiagsWriter::getMetaDiags() { … }
void SDiagsWriter::RemoveOldDiagnostics() { … }
void SDiagsWriter::finish() { … }
std::error_code SDiagsMerger::visitStartOfDiagnostic() { … }
std::error_code SDiagsMerger::visitEndOfDiagnostic() { … }
std::error_code
SDiagsMerger::visitSourceRangeRecord(const serialized_diags::Location &Start,
const serialized_diags::Location &End) { … }
std::error_code SDiagsMerger::visitDiagnosticRecord(
unsigned Severity, const serialized_diags::Location &Location,
unsigned Category, unsigned Flag, StringRef Message) { … }
std::error_code
SDiagsMerger::visitFixitRecord(const serialized_diags::Location &Start,
const serialized_diags::Location &End,
StringRef Text) { … }
std::error_code SDiagsMerger::visitFilenameRecord(unsigned ID, unsigned Size,
unsigned Timestamp,
StringRef Name) { … }
std::error_code SDiagsMerger::visitCategoryRecord(unsigned ID, StringRef Name) { … }
std::error_code SDiagsMerger::visitDiagFlagRecord(unsigned ID, StringRef Name) { … }