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
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 1f6ea30..64a5c1b 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -1097,7 +1097,7 @@
                              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 @@
     Wrapped = true;
   }
 
+  // Append any remaning text from the message with its existing formatting.
+  OS << Str.substr(Length);
+
   return Wrapped;
 }