[PATCH] D127448: [wip][pseudo] Implement guard extension.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 9 15:13:02 PDT 2022


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a subscriber: mgorny.
Herald added a project: All.
hokein requested review of this revision.
Herald added subscribers: cfe-commits, alextsao1999.
Herald added a project: clang-tools-extra.

- define a common data structure ParseLang which is a compiled result of the bnf grammar (output of clangPseudoCXX and clangPseudoCLI). It is defined in Language.h. The Language.h file is shared with differnt libraries;
- creates a clangPseudoCLI lib which defines a `grammar` commandline flag and expose a function to get the ParseLang. It supports --grammar=cxx, --grammmar=/path/to/file.bnf. It is used in clang-pseudo, fuzzer, and benchmark tools;
- implement two simple guards (contextual-override/final) for cxx.bnf;
- layering: clangPseudoCXX depends on clangPseudo (as the guard function need to access the TokenStream);

TODO:

- comments are missing;
- figure out better name for ParseLang;
- add lit&unit tests for the cxx guards;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127448

Files:
  clang-tools-extra/pseudo/benchmarks/Benchmark.cpp
  clang-tools-extra/pseudo/benchmarks/CMakeLists.txt
  clang-tools-extra/pseudo/fuzzer/CMakeLists.txt
  clang-tools-extra/pseudo/fuzzer/Fuzzer.cpp
  clang-tools-extra/pseudo/gen/Main.cpp
  clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
  clang-tools-extra/pseudo/include/clang-pseudo/Language.h
  clang-tools-extra/pseudo/include/clang-pseudo/cli/CLI.h
  clang-tools-extra/pseudo/include/clang-pseudo/cxx/CXX.h
  clang-tools-extra/pseudo/lib/CMakeLists.txt
  clang-tools-extra/pseudo/lib/GLR.cpp
  clang-tools-extra/pseudo/lib/cli/CLI.cpp
  clang-tools-extra/pseudo/lib/cli/CMakeLists.txt
  clang-tools-extra/pseudo/lib/cxx.bnf
  clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt
  clang-tools-extra/pseudo/lib/cxx/CXX.cpp
  clang-tools-extra/pseudo/tool/CMakeLists.txt
  clang-tools-extra/pseudo/tool/ClangPseudo.cpp
  clang-tools-extra/pseudo/unittests/GLRTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127448.435698.patch
Type: text/x-patch
Size: 32532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220609/5dde6af4/attachment-0001.bin>


More information about the cfe-commits mailing list