]> granicus.if.org Git - clang/commitdiff
Fix template type diffing coloring (r159216) when forcing color output to a file...
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 28 Jun 2012 21:46:07 +0000 (21:46 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 28 Jun 2012 21:46:07 +0000 (21:46 +0000)
Reviewed (over the shoulder) by Richard Trieu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159381 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/TextDiagnostic.cpp
test/Misc/diag-template-diffing-color.cpp [new file with mode: 0644]

index 8b7332dbeb5cfec77d6ff557b2888877398873c1..bd766d354c98699d3a5772d82d6532dfbd5d8b5a 100644 (file)
@@ -720,8 +720,11 @@ TextDiagnostic::printDiagnosticMessage(raw_ostream &OS,
 
   if (Columns)
     printWordWrapped(OS, Message, Columns, CurrentColumn);
-  else
-    OS << Message;
+  else {
+    bool Normal = true;
+    applyTemplateHighlighting(OS, Message, Normal);
+    assert(Normal && "Formatting should have returned to normal");
+  }
 
   if (ShowColors)
     OS.resetColor();
diff --git a/test/Misc/diag-template-diffing-color.cpp b/test/Misc/diag-template-diffing-color.cpp
new file mode 100644 (file)
index 0000000..edbf4c2
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -fcolor-diagnostics %s 2>&1 | FileCheck %s
+// XFAIL: cygwin,mingw32,win32
+template<typename> struct foo {};
+void func(foo<int>);
+int main() {
+  func(foo<double>());
+}
+// CHECK: {{.*}}candidate function not viable: no known conversion from 'foo<{{.}}[0;1;36mdouble{{.}}[0m>' to 'foo<{{.}}[0;1;36mint{{.}}[0m>' for 1st argument{{.}}[0m