[cfe-commits] r159381 - in /cfe/trunk: lib/Frontend/TextDiagnostic.cpp test/Misc/diag-template-diffing-color.cpp

David Blaikie dblaikie at gmail.com
Thu Jun 28 14:46:08 PDT 2012


Author: dblaikie
Date: Thu Jun 28 16:46:07 2012
New Revision: 159381

URL: http://llvm.org/viewvc/llvm-project?rev=159381&view=rev
Log:
Fix template type diffing coloring (r159216) when forcing color output to a file (not a terminal)

Reviewed (over the shoulder) by Richard Trieu.

Added:
    cfe/trunk/test/Misc/diag-template-diffing-color.cpp
Modified:
    cfe/trunk/lib/Frontend/TextDiagnostic.cpp

Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=159381&r1=159380&r2=159381&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Thu Jun 28 16:46:07 2012
@@ -720,8 +720,11 @@
 
   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();

Added: cfe/trunk/test/Misc/diag-template-diffing-color.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing-color.cpp?rev=159381&view=auto
==============================================================================
--- cfe/trunk/test/Misc/diag-template-diffing-color.cpp (added)
+++ cfe/trunk/test/Misc/diag-template-diffing-color.cpp Thu Jun 28 16:46:07 2012
@@ -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





More information about the cfe-commits mailing list