sammccall planned changes to this revision.
sammccall added a comment.

As discussed offline:

We agree on the goal of disallowing duplicate types in decl-specifier-seq, but 
the grammar changes are too intrusive if a guard-based approach can work 
instead.
The concern with guards on `seq` nodes is duplicate work (a tree walk at every 
level).
Since ForestNodes are immutable and reasonable in number we can introduce 
fairly cheap caching, e.g. of whether a decl-specifier[-seq] contains an 
exclusive type definition. This is a reusable building block for guards etc, so 
we should build it into the contract.

The other idea I was playing with of guarding `simple-declaration := 
decl-specifier-seq /*no declarators*/ ;` by requiring the decl-specifier-seq to 
declare a type (disallow "declaration declares nothing") is inferior as a) the 
code is technically legal, b) it doesn't address `std::string x;` misparsing as 
`Type{std} Type{::string} Declarator{x};`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130150

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to