[clang-tools-extra] 5f0a054 - [pseudo] Remove duplicated code in ClangPseudo.cpp
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 4 02:33:42 PDT 2022
Author: Haojian Wu
Date: 2022-07-04T11:32:56+02:00
New Revision: 5f0a054f8954d83aea66bac0ffa27887ff2eaade
URL: https://github.com/llvm/llvm-project/commit/5f0a054f8954d83aea66bac0ffa27887ff2eaade
DIFF: https://github.com/llvm/llvm-project/commit/5f0a054f8954d83aea66bac0ffa27887ff2eaade.diff
LOG: [pseudo] Remove duplicated code in ClangPseudo.cpp
The code was added accidently during the rebase when landing fe66aebd.
Added:
Modified:
clang-tools-extra/pseudo/tool/ClangPseudo.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/pseudo/tool/ClangPseudo.cpp b/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
index 521af05d5babf..295b7dc1d0087 100644
--- a/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
+++ b/clang-tools-extra/pseudo/tool/ClangPseudo.cpp
@@ -151,39 +151,21 @@ int main(int argc, char *argv[]) {
if (PrintForest)
llvm::outs() << Root.dumpRecursive(Lang.G, /*Abbreviated=*/true);
- if (ParseableStream) {
- clang::pseudo::ForestArena Arena;
- clang::pseudo::GSS GSS;
- llvm::Optional<clang::pseudo::SymbolID> StartSymID =
- Lang.G.findNonterminal(StartSymbol);
- if (!StartSymID) {
- llvm::errs() << llvm::formatv(
- "The start symbol {0} doesn't exit in the grammar!\n", StartSymbol);
- return 2;
- }
- auto &Root =
- glrParse(*ParseableStream,
- clang::pseudo::ParseParams{Lang.G, Lang.Table, Arena, GSS},
- *StartSymID);
- if (PrintForest)
- llvm::outs() << Root.dumpRecursive(Lang.G, /*Abbreviated=*/true);
-
- if (PrintStatistics) {
- llvm::outs() << "Forest bytes: " << Arena.bytes()
- << " nodes: " << Arena.nodeCount() << "\n";
- llvm::outs() << "GSS bytes: " << GSS.bytes()
- << " nodes: " << GSS.nodesCreated() << "\n";
-
- for (auto &P :
- {std::make_pair("Ambiguous", clang::pseudo::ForestNode::Ambiguous),
- std::make_pair("Opaque", clang::pseudo::ForestNode::Opaque)}) {
- clang::pseudo::NodeStats Stats(
- Root, [&](const auto &N) { return N.kind() == P.second; });
- llvm::outs() << "\n" << Stats.Total << " " << P.first << " nodes:\n";
- for (const auto &S : Stats.BySymbol)
- llvm::outs() << llvm::formatv(" {0,3} {1}\n", S.second,
- Lang.G.symbolName(S.first));
- }
+ if (PrintStatistics) {
+ llvm::outs() << "Forest bytes: " << Arena.bytes()
+ << " nodes: " << Arena.nodeCount() << "\n";
+ llvm::outs() << "GSS bytes: " << GSS.bytes()
+ << " nodes: " << GSS.nodesCreated() << "\n";
+
+ for (auto &P :
+ {std::make_pair("Ambiguous", clang::pseudo::ForestNode::Ambiguous),
+ std::make_pair("Opaque", clang::pseudo::ForestNode::Opaque)}) {
+ clang::pseudo::NodeStats Stats(
+ Root, [&](const auto &N) { return N.kind() == P.second; });
+ llvm::outs() << "\n" << Stats.Total << " " << P.first << " nodes:\n";
+ for (const auto &S : Stats.BySymbol)
+ llvm::outs() << llvm::formatv(" {0,3} {1}\n", S.second,
+ Lang.G.symbolName(S.first));
}
}
}
More information about the cfe-commits
mailing list