[PATCH] D108441: [clang] Fix JSON AST output when a filter is used
William Woodruff via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 20:15:42 PDT 2021
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108441.367701.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/6a33aa34/attachment-0001.bin>
More information about the cfe-commits
mailing list