[clang] Fix Lambda Mangling in Namespace-Scope Variable Initializers. (PR #159115)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 17 11:23:46 PDT 2025
================
@@ -356,7 +356,7 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC) {
return std::make_tuple(&Context.getManglingNumberContext(DC), nullptr);
}
- return std::make_tuple(nullptr, nullptr);
+ return std::make_tuple(nullptr, ManglingContextDecl);
----------------
tahonermann wrote:
Github won't let me add a comment in the right place, so anchoring it here...
I think we should update the comments for the function declaration (in `clang/include/clang/Sema/Sema.h`) to explain this behavior. Something like this:
```
/// Compute the mangling number context for a lambda expression or
/// block literal that appears in the specified declaration context in
/// consideration of the current expression evaluation and template
/// instantiation contexts. If the mangling context requires external linkage,
/// then a mangling number context is returned in the first tuple
/// element. If the mangling context is non-normal (specialized for
/// lambda and block types relative to other entities), the overriding
/// declaration is returned in the second tuple element.
///
/// \param DC - The DeclContext containing the lambda expression or
/// block literal.
```
https://github.com/llvm/llvm-project/pull/159115
More information about the cfe-commits
mailing list