r211448 - DiagnosticRenderer: emit basic notes as real diagnostics
Alp Toker
alp at nuanti.com
Sat Jun 21 16:32:00 PDT 2014
Author: alp
Date: Sat Jun 21 18:31:59 2014
New Revision: 211448
URL: http://llvm.org/viewvc/llvm-project?rev=211448&view=rev
Log:
DiagnosticRenderer: emit basic notes as real diagnostics
Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear
when using emitBasicNote().
Modified:
cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h
cfe/trunk/include/clang/Frontend/TextDiagnostic.h
cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
Modified: cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h?rev=211448&r1=211447&r2=211448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h (original)
+++ cfe/trunk/include/clang/Frontend/DiagnosticRenderer.h Sat Jun 21 18:31:59 2014
@@ -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;
Modified: cfe/trunk/include/clang/Frontend/TextDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnostic.h?rev=211448&r1=211447&r2=211448&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnostic.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnostic.h Sat Jun 21 18:31:59 2014
@@ -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;
Modified: cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp?rev=211448&r1=211447&r2=211448&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp (original)
+++ cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp Sat Jun 21 18:31:59 2014
@@ -190,6 +190,12 @@ void DiagnosticRenderer::emitStoredDiagn
&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::emitBuildingModu
Message << "while building module '" << ModuleName << ":";
emitNote(Loc, Message.str(), &SM);
}
-
-
-void DiagnosticNoteRenderer::emitBasicNote(StringRef Message) {
- emitNote(SourceLocation(), Message, nullptr);
-}
Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=211448&r1=211447&r2=211448&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Sat Jun 21 18:31:59 2014
@@ -870,12 +870,6 @@ void TextDiagnostic::emitDiagnosticLoc(S
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) {
More information about the cfe-commits
mailing list