[clang] [clang-tools-extra] [llvm] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 28 19:16:01 PDT 2025
================
@@ -2189,8 +2222,9 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
assert(Tok.isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
tok::kw___builtin_omp_required_simd_align,
- tok::kw___builtin_vectorelements, tok::kw__Countof) &&
- "Not a sizeof/alignof/vec_step expression!");
+ tok::kw___builtin_vectorelements, tok::kw__Countof) ||
+ (getLangOpts().Reflection && Tok.is(tok::caretcaret)) &&
+ "Not a sizeof/alignof/vec_step expression!");
----------------
Sirraide wrote:
```suggestion
tok::kw___builtin_vectorelements, tok::kw__Countof, tok::caretcaret) &&
"Not a sizeof/alignof/vec_step expression!");
```
I feel like this is enough; we don’t need to assert we’re in reflexion mode *everywhere* where we use `tok::caretcaret`.
https://github.com/llvm/llvm-project/pull/164692
More information about the llvm-commits
mailing list