[PATCH] D120724: [pseudo] Add a print-grammar option in the tool
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 1 06:58:29 PST 2022
hokein created this revision.
hokein added a reviewer: sammccall.
hokein requested review of this revision.
Herald added a project: clang.
This is helpful for debugging purposes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120724
Files:
clang/tools/clang-pseudo/ClangPseudo.cpp
Index: clang/tools/clang-pseudo/ClangPseudo.cpp
===================================================================
--- clang/tools/clang-pseudo/ClangPseudo.cpp
+++ clang/tools/clang-pseudo/ClangPseudo.cpp
@@ -24,6 +24,7 @@
static opt<std::string>
Grammar("grammar", desc("Parse and check a BNF grammar file."), init(""));
+static opt<bool> PrintGrammar("print-grammar", desc("Print the grammar."));
static opt<bool> PrintGraph("print-graph",
desc("Print the LR graph for the grammar"));
static opt<bool> PrintTable("print-table",
@@ -60,6 +61,8 @@
}
llvm::outs() << llvm::formatv("grammar file {0} is parsed successfully\n",
Grammar);
+ if (PrintGrammar)
+ llvm::outs() << G->dump();
if (PrintGraph)
llvm::outs() << clang::syntax::pseudo::LRGraph::buildLR0(*G).dumpForTests(
*G);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120724.412086.patch
Type: text/x-patch
Size: 896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220301/eb733746/attachment.bin>
More information about the cfe-commits
mailing list