[PATCH] D108756: [clang] Add '-ast-dump-filter=' support

Tommy Chiang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 26 04:05:47 PDT 2021


oToToT created this revision.
oToToT added reviewers: rsmith, alexfh.
oToToT added a project: clang.
Herald added a subscriber: dang.
oToToT requested review of this revision.
Herald added a subscriber: cfe-commits.

Before this patch, we only support syntax like
`clang -cc1 -ast-dump -ast-dump-filter main a.c`
or
`clang -Xclang -ast-dump -Xclang -ast-dump-filter -Xclang main a.c`
when using ast-dump-filter.

It is helpful to also support `-ast-dump-filter=` syntax, so we can do something like
`clang -cc1 -ast-dump -ast-dump-filter=main a.c`
or
`clang -Xclang -ast-dump -Xclang -ast-dump-filter=main a.c`

It is more cleaner when passing arguments through `-Xclang` in this case.

Also, **clang-check** do support this syntax, and I think people might be confused when they found they can't use `-ast-dump-filter` with clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108756

Files:
  clang/include/clang/Driver/Options.td


Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5277,6 +5277,8 @@
            " nodes having a certain substring in a qualified name. Use"
            " -ast-list to list all filterable declaration node names.">,
   MarshallingInfoString<FrontendOpts<"ASTDumpFilter">>;
+def ast_dump_filter_EQ : Joined<["-"], "ast-dump-filter=">,
+  Alias<ast_dump_filter>;
 def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">,
   HelpText<"Do not automatically generate or update the global module index">,
   MarshallingInfoNegativeFlag<FrontendOpts<"UseGlobalModuleIndex">>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108756.368839.patch
Type: text/x-patch
Size: 734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210826/eecdd3dd/attachment.bin>


More information about the cfe-commits mailing list