From: Douglas Gregor Date: Fri, 20 Aug 2010 03:17:33 +0000 (+0000) Subject: Eliminate some extraneous whitespace in the machine-parseable Fix-It output. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf5e09d185275a1942223ecb58e20c2d88dcc340;p=clang Eliminate some extraneous whitespace in the machine-parseable Fix-It output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111610 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.html b/docs/UsersManual.html index 98cef7d870..a52c404c5b 100644 --- a/docs/UsersManual.html +++ b/docs/UsersManual.html @@ -365,10 +365,10 @@ Print Fix-Its in a machine parseable form.

This option makes Clang print available Fix-Its in a machine parseable format at the end of diagnostics. The following example illustrates the format:

- fix-it: "t.cpp":{7:25-7:29}: "Gamma"
+ fix-it:"t.cpp":{7:25-7:29}:"Gamma"
 
-

The range printed is a half-open range, so in this example the characters at column 25 up to but not including column 29 on line 7 in t.cpp should be replaced with the string "Gamma". Either the range or the replacement string may be empty (representing strict insertions and strict erasures, respectively). Both the file name and the insertion string escape '\', tabs (as "\t"), newlines (as "\n"), double quotes(as "\"") and non-printable characters (as octal "\xxx").

+

The range printed is a half-open range, so in this example the characters at column 25 up to but not including column 29 on line 7 in t.cpp should be replaced with the string "Gamma". Either the range or the replacement string may be empty (representing strict insertions and strict erasures, respectively). Both the file name and the insertion string escape backslash (as "\"), tabs (as "\t"), newlines (as "\n"), double quotes(as "\"") and non-printable characters (as octal "\xxx").

diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index c971ca3b9d..1e453a08fd 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -567,13 +567,13 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, // We specifically do not do word-wrapping or tab-expansion here, // because this is supposed to be easy to parse. - OS << " fix-it: \""; + OS << "fix-it:\""; OS.write_escaped(SM.getPresumedLoc(B).getFilename()); OS << "\":{" << SM.getLineNumber(BInfo.first, BInfo.second) << ':' << SM.getColumnNumber(BInfo.first, BInfo.second) << '-' << SM.getLineNumber(EInfo.first, EInfo.second) << ':' << SM.getColumnNumber(EInfo.first, EInfo.second) - << "}: \""; + << "}:\""; OS.write_escaped(Hint->CodeToInsert); OS << "\"\n"; }