[cfe-commits] r140497 - /cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
Douglas Gregor
dgregor at apple.com
Mon Sep 26 08:16:19 PDT 2011
On Sep 25, 2011, at 6:44 PM, Chandler Carruth wrote:
> Author: chandlerc
> Date: Sun Sep 25 20:44:29 2011
> New Revision: 140497
>
> URL: http://llvm.org/viewvc/llvm-project?rev=140497&view=rev
> Log:
> Remove support for splitting word-wrapped diagnostic messages on newline
> characters. I could find no newline character in a diagnostic message,
> and adding an assert to this code never fires in the testsuite.
>
> I think this code is essentially dead, and was previously used for
> a different purpose. If I just don't understand how it is we can end up
> with a newline here please let me know (with a test case?) and I'll
> revert.
It wasn't dead code. At least, it shouldn't have been :)
Here's a test case:
struct B {
void f();
};
struct D1 : B { };
struct D2 : B { };
struct DD : D1, D2 {
void g() { f(); }
};
the diagnostic we used to get:
t.cpp:9:14: error: non-static member 'f' found in multiple base-class subobjects
of type 'B':
struct DD -> struct D1 -> struct B
struct DD -> struct D2 -> struct B
void g() { f(); }
^
t.cpp:2:8: note: member found by ambiguous name lookup
void f();
^
and we now get:
t.cpp:9:14: error: non-static member 'f' found in multiple base-class subobjects
of type 'B': struct DD -> struct D1 -> struct B struct DD -> struct D2 ->
struct B
void g() { f(); }
^
t.cpp:2:8: note: member found by ambiguous name lookup
void f();
^
You couldn't find the newline because they are generated by Sema.
- Doug
> Modified:
> cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
>
> Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=140497&r1=140496&r2=140497&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
> +++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sun Sep 25 20:44:29 2011
> @@ -1100,17 +1100,7 @@
> unsigned Columns,
> unsigned Column = 0,
> unsigned Indentation = WordWrapIndentation) {
> - unsigned Length = Str.size();
> -
> - // If there is a newline in this message somewhere, find that
> - // newline and split the message into the part before the newline
> - // (which will be word-wrapped) and the part from the newline one
> - // (which will be emitted unchanged).
> - for (unsigned I = 0; I != Length; ++I)
> - if (Str[I] == '\n') {
> - Length = I;
> - break;
> - }
> + const unsigned Length = Str.size();
>
> // The string used to indent each line.
> llvm::SmallString<16> IndentStr;
> @@ -1148,13 +1138,7 @@
> Wrapped = true;
> }
>
> - if (Length == Str.size())
> - return Wrapped; // We're done.
> -
> - // There is a newline in the message, followed by something that
> - // will not be word-wrapped. Print that.
> - OS.write(&Str[Length], Str.size() - Length);
> - return true;
> + return Wrapped;
> }
>
> void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list