19 End =
SrcMgr.getFileOffset(FileRange.getEnd());
32 :
Level(InDiag.getLevel()),
ID(InDiag.getID()),
45 assert(!
Filename.empty() &&
"diagnostic with location has no source file?");
59 llvm::StringMap<SourceLocation> &SrcLocCache) {
60 const auto FileRef =
FileMgr.getOptionalFileRef(StandaloneDiag.
Filename);
67 auto It = SrcLocCache.find(StandaloneDiag.
Filename);
68 if (It != SrcLocCache.end()) {
69 FileLoc = It->getValue();
82 SrcLocCache[StandaloneDiag.
Filename] = FileLoc;
88 auto ConvertOffsetRange =
97 TranslatedRanges.reserve(StandaloneDiag.
Ranges.size());
98 transform(StandaloneDiag.
Ranges, std::back_inserter(TranslatedRanges),
102 TranslatedFixIts.reserve(StandaloneDiag.
FixIts.size());
103 for (
const auto &FixIt : StandaloneDiag.
FixIts) {
106 TranslatedFixIt.
RemoveRange = ConvertOffsetRange(FixIt.RemoveRange);
107 TranslatedFixIt.
InsertFromRange = ConvertOffsetRange(FixIt.InsertFromRange);
109 TranslatedFixIts.push_back(std::move(TranslatedFixIt));
113 StandaloneDiag.
Message, Loc, TranslatedRanges,
Represents a character-granular source range.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
bool BeforePreviousInsertions
CharSourceRange RemoveRange
Code that should be replaced to correct the error.
CharSourceRange InsertFromRange
Code in the specific range that should be inserted in the insertion location.
std::string CodeToInsert
The actual code to insert at the insertion location, as a string.
A SourceLocation and its associated SourceManager.
const SourceManager & getManager() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static CharSourceRange makeFileCharRange(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts)
Accepts a range and returns a character range with file locations.
Encodes a location in the source.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
Represents a diagnostic in a form that can be retained until its corresponding source manager is dest...
ArrayRef< FixItHint > getFixIts() const
ArrayRef< CharSourceRange > getRanges() const
const FullSourceLoc & getLocation() const
Public enums and private classes that are part of the SourceManager implementation.
The JSON file list parser is used to communicate input to InstallAPI.
for(const auto &A :T->param_types())
StoredDiagnostic translateStandaloneDiag(FileManager &FileMgr, SourceManager &SrcMgr, const StandaloneDiagnostic &StandaloneDiag, llvm::StringMap< SourceLocation > &SrcLocCache)
Translates StandaloneDiag into a StoredDiagnostic, associating it with the provided FileManager and S...
Represents a CharSourceRange within a StandaloneDiagnostic.
SourceOffsetRange(CharSourceRange Range, const SourceManager &SrcMgr, const LangOptions &LangOpts)
bool BeforePreviousInsertions
SourceOffsetRange RemoveRange
StandaloneFixIt(const SourceManager &SrcMgr, const LangOptions &LangOpts, const FixItHint &FixIt)
SourceOffsetRange InsertFromRange
Represents a StoredDiagnostic in a form that can be retained until after its SourceManager has been d...
SrcMgr::CharacteristicKind FileKind
std::vector< StandaloneFixIt > FixIts
StandaloneDiagnostic(const LangOptions &LangOpts, const StoredDiagnostic &InDiag)
std::vector< SourceOffsetRange > Ranges
DiagnosticsEngine::Level Level