[clang] [clang] Don't use `VarDecl` of local variables as `ManglingContextDecl` for lambdas (PR #179035)

Jan Kokemüller via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 14 01:37:49 PST 2026


================
@@ -322,7 +308,8 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC) {
         if (LexicalDC->isRecord())
           return DefaultArgument;
     } else if (VarDecl *Var = dyn_cast<VarDecl>(ManglingContextDecl)) {
-      if (Var->getMostRecentDecl()->isInline())
+      if (Var->getMostRecentDecl()->isInline() ||
+          IsExternallyVisibleInModulePurview(Var))
         return InlineVariable;
----------------
jiixyj wrote:

OK, for readability I have split this out into a new context kind `ExternallyVisibleVariableInModulePurview` that is treated the same as `InlineVariable` and `TemplatedVariable` below.

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


More information about the cfe-commits mailing list