summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-09-26 16:43:25 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-09-26 16:43:25 +0000
commit374eaa9c4e1a65b6238940a6511b80a891966223 (patch)
tree415482d8fc176cb1fe90145f5d38e8c88c83013d /clang/lib/Frontend
parent55f340eb6200dc9e47d44b2622237766f97c6780 (diff)
downloadbcm5719-llvm-374eaa9c4e1a65b6238940a6511b80a891966223.tar.gz
bcm5719-llvm-374eaa9c4e1a65b6238940a6511b80a891966223.zip
Add back support for a manually formatted section of the diagnostic
message. Specifically, we now only line-wrap the first line of te diagnostic message and assume the remainder is manually formatted. While adding it back, simplify the logic for doing this. Finally, add a test that ensures we actually preserve this feature. =D *Now* its not dead code. Thanks to Doug for the test case. llvm-svn: 140538
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/TextDiagnosticPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
index 1f6ea30c7d9..64a5c1bc9cf 100644
--- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -1097,7 +1097,7 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str,
unsigned Columns,
unsigned Column = 0,
unsigned Indentation = WordWrapIndentation) {
- const unsigned Length = Str.size();
+ const unsigned Length = std::min(Str.find('\n'), Str.size());
// The string used to indent each line.
llvm::SmallString<16> IndentStr;
@@ -1135,6 +1135,9 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str,
Wrapped = true;
}
+ // Append any remaning text from the message with its existing formatting.
+ OS << Str.substr(Length);
+
return Wrapped;
}
OpenPOWER on IntegriCloud