[PATCH] D97362: [clang][parser] Allow attributes in explicit template instantiations

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 24 01:00:44 PDT 2021


tbaeder added a comment.

I'm gonna continue the conversation here if that's ok, the inline comments are rather cramped and confusing.

So, I just double-checked this and `Attrs.Range.getBegin()` returns the location of the first `[`, which is correct and not a problem. `Lexer::getRawToken(Attrs.Range.getBegin(), ...)` then returns the token as expected, no problem either.

The test code I'm looking at now is:

  template<typename> struct Template {};
  template struct [[]] Template<char>;

and `Attrs.Range.getBegin()` correctly returns line 2, column 17 and `.getEnd()` is line 2 column 20. All correct.

But using `Lexer::findLocationAfterToken()` will return column 19, not 18, so the first `]`. However, it seems like directly calling `Lexer::findNextToken()` with the location of the first token (without a `Lexer::findLocationAfterToken()` in betwee) will return column 19, so the second `[`.


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

https://reviews.llvm.org/D97362



More information about the cfe-commits mailing list