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
commit4db87abf0f068a5995125004540279ac6abc6813 (patch)
tree781a94709de21c39c7cf6c372f00d56894e1975b
parenta68ad10a90e9baadbcead821caf8cd1d9170eb51 (diff)
downloadbcm5719-llvm-4db87abf0f068a5995125004540279ac6abc6813.tar.gz
bcm5719-llvm-4db87abf0f068a5995125004540279ac6abc6813.zip
DiagnosticRenderer: emit basic notes as real diagnostics
Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear when using emitBasicNote(). llvm-svn: 211448
-rw-r--r--clang/include/clang/Frontend/DiagnosticRenderer.h7
-rw-r--r--clang/include/clang/Frontend/TextDiagnostic.h2
-rw-r--r--clang/lib/Frontend/DiagnosticRenderer.cpp11
-rw-r--r--clang/lib/Frontend/TextDiagnostic.cpp6
4 files changed, 8 insertions, 18 deletions
diff --git a/clang/include/clang/Frontend/DiagnosticRenderer.h b/clang/include/clang/Frontend/DiagnosticRenderer.h
index 019eec5e0e1..ce1dc904655 100644
--- a/clang/include/clang/Frontend/DiagnosticRenderer.h
+++ b/clang/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/clang/include/clang/Frontend/TextDiagnostic.h b/clang/include/clang/Frontend/TextDiagnostic.h
index a76c2bb9844..acebb90b707 100644
--- a/clang/include/clang/Frontend/TextDiagnostic.h
+++ b/clang/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/clang/lib/Frontend/DiagnosticRenderer.cpp b/clang/lib/Frontend/DiagnosticRenderer.cpp
index ce9fc0548c1..cff32b852bf 100644
--- a/clang/lib/Frontend/DiagnosticRenderer.cpp
+++ b/clang/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/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 840c280b518..847acf114e1 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud