summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-21 23:31:59 +0000
committerAlp Toker <alp@nuanti.com>2014-06-21 23:31:59 +0000
commit47f76959dbc864aac90c3ee86faa844a2a973f39 (patch)
treefb96378a6901fe94604b6e6da7a2ff70aca408b3
parent339f28387aa3c334a3290561c89fba6bbe458494 (diff)
DiagnosticRenderer: emit basic notes as real diagnostics
Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear when using emitBasicNote(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211448 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Frontend/DiagnosticRenderer.h7
-rw-r--r--include/clang/Frontend/TextDiagnostic.h2
-rw-r--r--lib/Frontend/DiagnosticRenderer.cpp11
-rw-r--r--lib/Frontend/TextDiagnostic.cpp6
4 files changed, 8 insertions, 18 deletions
diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h
index 019eec5e0e..ce1dc90465 100644
--- a/include/clang/Frontend/DiagnosticRenderer.h
+++ b/include/clang/Frontend/DiagnosticRenderer.h
@@ -83,9 +83,7 @@ protected:
DiagnosticsEngine::Level Level,
ArrayRef<CharSourceRange> Ranges,
const SourceManager &SM) = 0;
-
- virtual void emitBasicNote(StringRef Message) = 0;
-
+
virtual void emitCodeContext(SourceLocation Loc,
DiagnosticsEngine::Level Level,
SmallVectorImpl<CharSourceRange>& Ranges,
@@ -108,6 +106,7 @@ protected:
private:
+ void emitBasicNote(StringRef Message);
void emitIncludeStack(SourceLocation Loc, PresumedLoc PLoc,
DiagnosticsEngine::Level Level, const SourceManager &SM);
void emitIncludeStackRecursively(SourceLocation Loc, const SourceManager &SM);
@@ -159,8 +158,6 @@ public:
virtual ~DiagnosticNoteRenderer();
- void emitBasicNote(StringRef Message) override;
-
void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc,
const SourceManager &SM) override;
diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h
index a76c2bb984..acebb90b70 100644
--- a/include/clang/Frontend/TextDiagnostic.h
+++ b/include/clang/Frontend/TextDiagnostic.h
@@ -95,8 +95,6 @@ protected:
emitSnippetAndCaret(Loc, Level, Ranges, Hints, SM);
}
- void emitBasicNote(StringRef Message) override;
-
void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc,
const SourceManager &SM) override;
diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp
index ce9fc0548c..cff32b852b 100644
--- a/lib/Frontend/DiagnosticRenderer.cpp
+++ b/lib/Frontend/DiagnosticRenderer.cpp
@@ -190,6 +190,12 @@ void DiagnosticRenderer::emitStoredDiagnostic(StoredDiagnostic &Diag) {
&Diag);
}
+void DiagnosticRenderer::emitBasicNote(StringRef Message) {
+ emitDiagnosticMessage(
+ SourceLocation(), PresumedLoc(), DiagnosticsEngine::Note, Message,
+ ArrayRef<CharSourceRange>(), nullptr, DiagOrStoredDiag());
+}
+
/// \brief Prints an include stack when appropriate for a particular
/// diagnostic level and location.
///
@@ -506,8 +512,3 @@ DiagnosticNoteRenderer::emitBuildingModuleLocation(SourceLocation Loc,
Message << "while building module '" << ModuleName << ":";
emitNote(Loc, Message.str(), &SM);
}
-
-
-void DiagnosticNoteRenderer::emitBasicNote(StringRef Message) {
- emitNote(SourceLocation(), Message, nullptr);
-}
diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp
index 840c280b51..847acf114e 100644
--- a/lib/Frontend/TextDiagnostic.cpp
+++ b/lib/Frontend/TextDiagnostic.cpp
@@ -870,12 +870,6 @@ void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
OS << ' ';
}
-void TextDiagnostic::emitBasicNote(StringRef Message) {
- // FIXME: Emit this as a real note diagnostic.
- // FIXME: Format an actual diagnostic rather than a hard coded string.
- OS << "note: " << Message << "\n";
-}
-
void TextDiagnostic::emitIncludeLocation(SourceLocation Loc,
PresumedLoc PLoc,
const SourceManager &SM) {