woodruffw created this revision. woodruffw added reviewers: klimek, rsmith. woodruffw added a project: clang. woodruffw requested review of this revision. Herald added a subscriber: cfe-commits.
Without this, the combination of `-ast-dump=json` and `-ast-dump-filter FILTER` produces invalid JSON: the first line is a string that says `Dumping $SOME_DECL_NAME: `. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D108441 Files: clang/lib/Frontend/ASTConsumers.cpp Index: clang/lib/Frontend/ASTConsumers.cpp =================================================================== --- clang/lib/Frontend/ASTConsumers.cpp +++ clang/lib/Frontend/ASTConsumers.cpp @@ -57,8 +57,11 @@ bool ShowColors = Out.has_colors(); if (ShowColors) Out.changeColor(raw_ostream::BLUE); - Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D) - << ":\n"; + + if (OutputFormat == ADOF_Default) + Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D) + << ":\n"; + if (ShowColors) Out.resetColor(); print(D);
Index: clang/lib/Frontend/ASTConsumers.cpp =================================================================== --- clang/lib/Frontend/ASTConsumers.cpp +++ clang/lib/Frontend/ASTConsumers.cpp @@ -57,8 +57,11 @@ bool ShowColors = Out.has_colors(); if (ShowColors) Out.changeColor(raw_ostream::BLUE); - Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D) - << ":\n"; + + if (OutputFormat == ADOF_Default) + Out << (OutputKind != Print ? "Dumping " : "Printing ") << getName(D) + << ":\n"; + if (ShowColors) Out.resetColor(); print(D);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits