Fix template type diffing coloring (r159216) when forcing color output to a file (not a terminal)

Reviewed (over the shoulder) by Richard Trieu.

llvm-svn: 159381
This commit is contained in:
David Blaikie 2012-06-28 21:46:07 +00:00
parent 1edf57639a
commit 9e55d74074
2 changed files with 13 additions and 2 deletions

View 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();

View File

@ -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