[PATCH] D132487: [pseudo] Placeholder disambiguation strategy: always choose second

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 26 04:10:05 PDT 2022


sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: clang-tools-extra/pseudo/tool/ClangPseudo.cpp:231
+
+    if (Disambiguate && PrintForest) {
+      ForestNode *DisambigRoot = &Root;
----------------
hokein wrote:
> nit: we're going to print the forest *and* the disambiguated tree, is that intended? IMO, if we specify the `disambiguate` flag, I'd not print the forest as well.
I guess you're right. My use case was debugging disambiguation with `-print-forest -disambiguate -debug=only=Disambiguate.cpp` - I think we need the before + after + log.

However we can log the "before" with `LLVM_DEBUG()` inside disambiguate() instead.


================
Comment at: clang-tools-extra/pseudo/unittests/DisambiguateTest.cpp:28
+protected:
+  // Greatly simplified C++ grammar.
+  enum Symbol : SymbolID {
----------------
hokein wrote:
> nit: it seems like we write a lot of boilerplate code just for creating a Forest for a single `a*b;` case below, it is fine currently, but if we're going to add some more unittests , we might want an automate way to do that.
Hmm, maybe. It's not obvious to me that you can do much better (other approaches have tradeoffs, e.g. I think having all the nodes/rules/symbols as named variables is clearer than what we've done in some other places, and I think depending on the C++ grammar would confuse things).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132487/new/

https://reviews.llvm.org/D132487



More information about the cfe-commits mailing list