mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-11 04:06:20 +00:00
[MS ABI] Number unnamed TagDecls which aren't externally visible
TagDecls (structs, enums, etc.) may have the same name for linkage purposes of one another; to disambiguate, we add a number to the mangled named. However, we didn't do this if the TagDecl has a pseudo-name for linkage purposes (it was defined alongside a DeclaratorDecl or a TypeNameDecl). This fixes PR24651. llvm-svn: 246659
This commit is contained in:
parent
fbcd189f8a
commit
b33cd908d4
@ -180,7 +180,9 @@ public:
|
||||
|
||||
// Anonymous tags are already numbered.
|
||||
if (const TagDecl *Tag = dyn_cast<TagDecl>(ND)) {
|
||||
if (Tag->getName().empty() && !Tag->getTypedefNameForAnonDecl())
|
||||
if (!Tag->hasNameForLinkage() &&
|
||||
!getASTContext().getDeclaratorForUnnamedTagDecl(Tag) &&
|
||||
!getASTContext().getTypedefNameForUnnamedTagDecl(Tag))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -261,3 +261,19 @@ struct B {
|
||||
void f(decltype(B<int>::e)) {}
|
||||
// CHECK-DAG: @"\01?f@UnnamedType@@YAXPAW4<unnamed-type-e>@?$B@H@1@@Z
|
||||
}
|
||||
|
||||
namespace PR24651 {
|
||||
template <typename T>
|
||||
void f(T) {}
|
||||
|
||||
void g() {
|
||||
enum {} E;
|
||||
f(E);
|
||||
{
|
||||
enum {} E;
|
||||
f(E);
|
||||
}
|
||||
}
|
||||
// CHECK-DAG: @"\01??$f@W4<unnamed-type-E>@?1??g@PR24651@@YAXXZ@@PR24651@@YAXW4<unnamed-type-E>@?1??g@0@YAXXZ@@Z"
|
||||
// CHECK-DAG: @"\01??$f@W4<unnamed-type-E>@?2??g@PR24651@@YAXXZ@@PR24651@@YAXW4<unnamed-type-E>@?2??g@0@YAXXZ@@Z"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user