[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 04:17:59 PST 2025


================
@@ -3636,18 +3644,23 @@ ExprResult Parser::ParseRequiresExpression() {
   // Start of requirement list
   llvm::SmallVector<concepts::Requirement *, 2> Requirements;
 
-  // C++2a [expr.prim.req]p2
-  //   Expressions appearing within a requirement-body are unevaluated operands.
-  EnterExpressionEvaluationContext Ctx(
-      Actions, Sema::ExpressionEvaluationContext::Unevaluated);
-
   ParseScope BodyScope(this, Scope::DeclScope);
   // Create a separate diagnostic pool for RequiresExprBodyDecl.
   // Dependent diagnostics are attached to this Decl and non-depenedent
   // diagnostics are surfaced after this parse.
   ParsingDeclRAIIObject ParsingBodyDecl(*this, ParsingDeclRAIIObject::NoParent);
-  RequiresExprBodyDecl *Body = Actions.ActOnStartRequiresExpr(
-      RequiresKWLoc, LocalParameterDecls, getCurScope());
+  RequiresExprBodyDecl *Body =
+      Actions.ActOnStartRequiresExpr(RequiresKWLoc, LocalParameterDecls,
+                                     getCurScope(), TemplateParameterDepth);
+
+  LocalInstantiationScope InstScope(getActions());
+  for (ParmVarDecl *D : LocalParameterDecls)
+    InstScope.InstantiatedLocal(D, D);
----------------
zyn0217 wrote:

Where would we use that?

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


More information about the cfe-commits mailing list