aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Frontend/ASTConsumers.cpp9
-rw-r--r--test/Tooling/clang-check-ast-dump.cpp3
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 882d400c42..c99dbf07dd 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -59,9 +59,12 @@ namespace {
bool TraverseDecl(Decl *D) {
if (D != NULL && filterMatches(D)) {
- Out.changeColor(llvm::raw_ostream::BLUE) <<
- (Dump ? "Dumping " : "Printing ") << getName(D) << ":\n";
- Out.resetColor();
+ bool ShowColors = Out.has_colors();
+ if (ShowColors)
+ Out.changeColor(llvm::raw_ostream::BLUE);
+ Out << (Dump ? "Dumping " : "Printing ") << getName(D) << ":\n";
+ if (ShowColors)
+ Out.resetColor();
if (Dump)
D->dump(Out);
else
diff --git a/test/Tooling/clang-check-ast-dump.cpp b/test/Tooling/clang-check-ast-dump.cpp
index 43686bd250..6e03f82d0f 100644
--- a/test/Tooling/clang-check-ast-dump.cpp
+++ b/test/Tooling/clang-check-ast-dump.cpp
@@ -8,7 +8,8 @@
// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::theMethod "%s" -- 2>&1 | FileCheck -check-prefix CHECK-FILTER %s
// CHECK-FILTER-NOT: namespace test_namespace
// CHECK-FILTER-NOT: class TheClass
-// CHECK-FILTER: int theMethod(int x) (CompoundStmt
+// CHECK-FILTER: {{^}}Dumping test_namespace::TheClass::theMethod
+// CHECK-FILTER-NEXT: {{^}}int theMethod(int x) (CompoundStmt
// CHECK-FILTER-NEXT: (ReturnStmt
// CHECK-FILTER-NEXT: (BinaryOperator
//