[clang] [Clang] [P2996] Support reflecting arbitrary types and aliases (PR #232074)

Ambrose Leeb via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 12:48:34 PDT 2026


================
@@ -315,6 +318,28 @@ ExprDependence clang::computeDependence(CXXUuidofExpr *E) {
   return turnTypeToValueDependence(E->getExprOperand()->getDependence());
 }
 
+ExprDependence clang::computeDependence(CXXReflectExpr *E) {
+  QualType QT = E->getTypeSourceInfo()->getType();
+  ExprDependence D =
+      turnTypeToValueDependence(toExprDependenceAsWritten(QT->getDependence()));
+  if (isTypeAliasAsReflectionName(QT)) {
+    const NamedDecl *Alias;
+    if (const auto *T = dyn_cast<TypedefType>(QT.getTypePtr())) {
+      Alias = T->getDecl();
+    } else {
+      const auto *TST = cast<TemplateSpecializationType>(QT.getTypePtr());
+      Alias = TST->getTemplateName().getAsTemplateDecl();
+      for (const auto &Arg : TST->template_arguments())
+        if (Arg.isDependent())
+          D |= ExprDependence::ValueInstantiation;
----------------
Sirraide wrote:

Actually, you mean what about e.g. `(^^A<Ts>, ...)`; that’s pretty terrible; I should add a test for that to see what happens

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


More information about the cfe-commits mailing list