[PATCH] D130337: [pseudo] Eliminate multiple-specified-types ambiguities using guards

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 23 00:56:07 PDT 2022


sammccall added a comment.

In D130337#3671614 <https://reviews.llvm.org/D130337#3671614>, @hokein wrote:

> If we look at the existing guard implementations, we have a few of these usages:
>
> - in `isFunctionDeclarator`, we enumerate all rules of `noptr_declarator`, `ptr_declarator`, `declarator` ;
> - in `hasExclusiveType`, we enumerate all rules of `decl_specifier`, `simple_type_specifier`, `type_specifier`, `type_specifier_seq` etc;

In both cases, we're enumerating all the rules of *multiple* nonterminals.
To get the compiler to verify exhaustiveness, we'd have to first switch over target symbol, then switch over rule ID. I expect this to be both a readability and performance hit, so I'm not sure we'll actually do it.
Still, `rule::simple_declaration::decl_specifier_seq__declarator-seq__SEMI` is a step up in readability and code-completion IMO. Sent https://reviews.llvm.org/D130414


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130337



More information about the cfe-commits mailing list