[PATCH] D80153: [AST] Mangle LambdaContextDecl for top level decl
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 18 13:00:58 PDT 2020
zequanwu created this revision.
zequanwu added reviewers: CaseyCarter, rnk.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Bug filed here: https://bugs.llvm.org/show_bug.cgi?id=45213
To resolve it, we could mangle the `LambdaContextDecl` if it is top level decl.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80153
Files:
clang/lib/AST/MicrosoftMangle.cpp
Index: clang/lib/AST/MicrosoftMangle.cpp
===================================================================
--- clang/lib/AST/MicrosoftMangle.cpp
+++ clang/lib/AST/MicrosoftMangle.cpp
@@ -948,11 +948,13 @@
mangleSourceName(Name);
// If the context of a closure type is an initializer for a class
- // member (static or nonstatic), it is encoded in a qualified name.
+ // member (static or nonstatic) or is a top level decl, it is encoded
+ // in a qualified name.
if (LambdaManglingNumber && LambdaContextDecl) {
if ((isa<VarDecl>(LambdaContextDecl) ||
isa<FieldDecl>(LambdaContextDecl)) &&
- LambdaContextDecl->getDeclContext()->isRecord()) {
+ (LambdaContextDecl->getDeclContext()->isRecord() ||
+ LambdaContextDecl->getDeclContext()->isTranslationUnit())) {
mangleUnqualifiedName(cast<NamedDecl>(LambdaContextDecl));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80153.264702.patch
Type: text/x-patch
Size: 1003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200518/b565377d/attachment.bin>
More information about the cfe-commits
mailing list