aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/SerializedDiagnosticPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/SerializedDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/SerializedDiagnosticPrinter.cpp39
1 files changed, 10 insertions, 29 deletions
diff --git a/lib/Frontend/SerializedDiagnosticPrinter.cpp b/lib/Frontend/SerializedDiagnosticPrinter.cpp
index 649f294bf8..7a8edf7f5c 100644
--- a/lib/Frontend/SerializedDiagnosticPrinter.cpp
+++ b/lib/Frontend/SerializedDiagnosticPrinter.cpp
@@ -48,7 +48,7 @@ typedef llvm::SmallVectorImpl<uint64_t> RecordDataImpl;
class SDiagsWriter;
-class SDiagsRenderer : public DiagnosticRenderer {
+class SDiagsRenderer : public DiagnosticNoteRenderer {
SDiagsWriter &Writer;
RecordData &Record;
public:
@@ -56,7 +56,7 @@ public:
const SourceManager &SM,
const LangOptions &LangOpts,
const DiagnosticOptions &DiagOpts)
- : DiagnosticRenderer(SM, LangOpts, DiagOpts),
+ : DiagnosticNoteRenderer(SM, LangOpts, DiagOpts),
Writer(Writer), Record(Record){}
virtual ~SDiagsRenderer() {}
@@ -67,27 +67,22 @@ protected:
DiagnosticsEngine::Level Level,
StringRef Message,
ArrayRef<CharSourceRange> Ranges,
- const Diagnostic *Info);
+ DiagOrStoredDiag D);
virtual void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
DiagnosticsEngine::Level Level,
ArrayRef<CharSourceRange> Ranges) {}
- virtual void emitBasicNote(StringRef Message);
-
void emitNote(SourceLocation Loc, StringRef Message);
- virtual void emitIncludeLocation(SourceLocation Loc,
- PresumedLoc PLoc);
-
virtual void emitCodeContext(SourceLocation Loc,
DiagnosticsEngine::Level Level,
SmallVectorImpl<CharSourceRange>& Ranges,
ArrayRef<FixItHint> Hints);
- virtual void beginDiagnostic(const Diagnostic *Info,
+ virtual void beginDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level);
- virtual void endDiagnostic(const Diagnostic *Info,
+ virtual void endDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level);
};
@@ -505,14 +500,14 @@ SDiagsRenderer::emitDiagnosticMessage(SourceLocation Loc,
DiagnosticsEngine::Level Level,
StringRef Message,
ArrayRef<clang::CharSourceRange> Ranges,
- const Diagnostic *Info) {
+ DiagOrStoredDiag D) {
// Emit the RECORD_DIAG record.
Writer.Record.clear();
Writer.Record.push_back(RECORD_DIAG);
Writer.Record.push_back(Level);
Writer.AddLocToRecord(Loc, SM, PLoc, Record);
- if (Info) {
+ if (const Diagnostic *Info = D.dyn_cast<const Diagnostic*>()) {
// Emit the category string lazily and get the category ID.
unsigned DiagID = DiagnosticIDs::getCategoryNumberForDiag(Info->getID());
Writer.Record.push_back(Writer.getEmitCategory(DiagID));
@@ -529,14 +524,14 @@ SDiagsRenderer::emitDiagnosticMessage(SourceLocation Loc,
Writer.Record, Message);
}
-void SDiagsRenderer::beginDiagnostic(const Diagnostic *Info,
+void SDiagsRenderer::beginDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level) {
Writer.Stream.EnterSubblock(BLOCK_DIAG, 4);
}
-void SDiagsRenderer::endDiagnostic(const Diagnostic *Info,
+void SDiagsRenderer::endDiagnostic(DiagOrStoredDiag D,
DiagnosticsEngine::Level Level) {
- if (Info && Level != DiagnosticsEngine::Note)
+ if (D && Level != DiagnosticsEngine::Note)
return;
Writer.Stream.ExitBlock();
}
@@ -581,20 +576,6 @@ void SDiagsRenderer::emitNote(SourceLocation Loc, StringRef Message) {
Writer.Stream.ExitBlock();
}
-void SDiagsRenderer::emitIncludeLocation(SourceLocation Loc,
- PresumedLoc PLoc) {
- // Generate a note indicating the include location.
- SmallString<200> MessageStorage;
- llvm::raw_svector_ostream Message(MessageStorage);
- Message << "in file included from " << PLoc.getFilename() << ':'
- << PLoc.getLine() << ":";
- emitNote(Loc, Message.str());
-}
-
-void SDiagsRenderer::emitBasicNote(StringRef Message) {
- emitNote(SourceLocation(), Message);
-}
-
void SDiagsWriter::finish() {
if (inNonNoteDiagnostic) {
// Finish off any diagnostics we were in the process of emitting.