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

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 11:08:35 PDT 2024


================
@@ -18770,12 +18832,6 @@ bool Sema::tryCaptureVariable(
   if (CapturingFunctionScopes == 0 && (!BuildAndDiagnose || VarDC == DC))
     return true;
 
-  // Exception: Function parameters are not tied to the function's DeclContext
-  // until we enter the function definition. Capturing them anyway would result
-  // in an out-of-bounds error while traversing DC and its parents.
-  if (isa<ParmVarDecl>(Var) && !VarDC->isFunctionOrMethod())
----------------
mizvekov wrote:

We still do need to reparent them the old way, but this is going to change once I give them a ContextDecl too.

The difference right now is that we don't create the ParmVarDecls always at the translation unit context anymore, we just create them at the CurContext.

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


More information about the cfe-commits mailing list