19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/DenseMap.h"
21#include "llvm/ADT/SmallString.h"
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/Support/raw_ostream.h"
34 : LangOpts(LangOpts), DiagOpts(DiagOpts), LastLevel() {}
45 : MergedFixits(MergedFixits) {}
62 for (
const auto &Hint : FixItHints)
63 if (Hint.CodeToInsert.empty()) {
64 if (Hint.InsertFromRange.isValid())
66 Hint.InsertFromRange,
false,
67 Hint.BeforePreviousInsertions);
69 commit.
remove(Hint.RemoveRange);
71 if (Hint.RemoveRange.isTokenRange() ||
72 Hint.RemoveRange.getBegin() != Hint.RemoveRange.getEnd())
73 commit.
replace(Hint.RemoveRange, Hint.CodeToInsert);
75 commit.
insert(Hint.RemoveRange.getBegin(), Hint.CodeToInsert,
76 false, Hint.BeforePreviousInsertions);
80 if (Editor.
commit(commit)) {
81 FixitReceiver Rec(MergedFixits);
104 if (!FixItHints.empty()) {
106 FixItHints = MergedFixits;
109 for (
const auto &Hint : FixItHints)
110 if (Hint.RemoveRange.isValid())
111 MutableRanges.push_back(Hint.RemoveRange);
122 emitIncludeStack(
Loc, PLoc, Level);
126 emitCaret(
Loc, Level, MutableRanges, FixItHints);
131 emitMacroExpansions(UnexpandedLoc, Level, MutableRanges, FixItHints);
147void DiagnosticRenderer::emitBasicNote(StringRef Message) {
179 emitIncludeStackRecursively(IncludeLoc);
181 emitModuleBuildStack(
Loc.getManager());
182 emitImportStack(
Loc);
190 emitModuleBuildStack(
Loc.getManager());
201 std::pair<FullSourceLoc, StringRef> Imported =
Loc.getModuleImportLoc();
202 if (!Imported.second.empty()) {
204 emitImportStackRecursively(Imported.first, Imported.second);
209 emitIncludeStackRecursively(