[clang] [clang-tools-extra] [llvm] [clang]: reflection operator parsing for global namespace and primitive types (PR #164692)

Daniel M. Katz via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 20:07:08 PDT 2025


================
@@ -2249,6 +2283,9 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
   else if (getLangOpts().C2y && OpTok.is(tok::kw__Countof))
     Diag(OpTok, diag::warn_c2y_compat_keyword) << OpTok.getName();
 
+  if (OpTok.is(tok::caretcaret))
+    return ParseCXXReflectExpression(OpTok.getLocation());
----------------
katzdm wrote:

I'm pretty sure I moved it into `ParseUnaryExprOrTypeTraitExpr` in my fork just because a _reflect-expression_ [is formally a _unary-expression_](https://eel.is/c++draft/expr#nt:unary-expression). Functionally, I don't know of any reason it wouldn't work okay in `ParseCastExpression` (and I'm pretty sure I had it there at some point). Depends how much we care to mirror the grammar into this call structure, I suppose.

https://github.com/llvm/llvm-project/pull/164692


More information about the llvm-commits mailing list