max-winkler wrote: Thanks for the review. I’ve pushed an update.
**Tests for clang:** As proposed by @ArcsinX I added two tests in `clang/unittests/Tooling/RecursiveASTVisitorTests/PackIndexingTypeLoc.cpp` that check that the template type parameter pack `T` is visited in a variable declaration (`T...[0] x;`) and in an alias declaration (`using U = T...[0]`). Both tests pass with the fix and fail if either the change in `SemaType.cpp` or the one in `RecursiveASTVisitor.h` is omitted. **Ellipsis location:** I added a FIXME in `TypeSpecLocFiller::VisitPackIndexingTypeLoc` instead of changing this here, because fixing this would require a change in the parser. For `T...[0] x;` at the start of the statement, `Parser::ParsePackIndexingType` [(here)](https://github.com/llvm/llvm-project/blob/1c04bc6fc5c018b7029425c3e94f2e944db7cb57/clang/lib/Parse/ParseDeclCXX.cpp#L1126) is called twice. First, with a `tok::identifier`: the ellipsis location is parsed and stored in the `DeclSpec`, but this `DeclSpec` is only used in `Parser::ParseOptionalCXXScopeSpecifier` to build a `QualType` (`Sema::ActOnPackIndexingType` which does not use the ellipsis location), and only this type is stored in the annotation via `Parser::AnnotateExistingIndexedTypeNamePack` [(here)](https://github.com/llvm/llvm-project/blob/4400e2d4ae4bfb672558060a8bddecafc769ef4a/clang/lib/Parse/ParseDeclCXX.cpp#L1280). The second call of `Parser::ParsePackIndexingType` happens with a `tok::annot_pack_indexing_type` and this branch has no ellipsis location available and does not write one into the `DeclSpec` that `TypeSpecLocFiller` later uses. I havent't checked other contexts. I’m not aware of anything that currently relies on the ellipsis location, so I don’t have a test case or a user-visible symptom to demonstrate a fix. That’s another reason I kept it as a FIXME for now. https://github.com/llvm/llvm-project/pull/231191 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
