aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticPrinter.cpp
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
commit64b0cee15206d55913240dca676ed3f340c60926 (patch)
tree60b737b19038a6cfdcc7b8d50374f9433ef1d122 /lib/Frontend/TextDiagnosticPrinter.cpp
parent43202aee91646c9b5cd6d5cbea690b479075b67b (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 1f6ea30c7d..64a5c1bc9c 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/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;
}