mirror of https://github.com/microsoft/clang.git
[MS ABI] Mangle unnamed empty enums (PR37723)
Differential Revision: https://reviews.llvm.org/D47875 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334388 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
adc6bb61d2
commit
31ffb93ee6
|
@ -884,11 +884,13 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
|
|||
// associate typedef mangled in if they have one.
|
||||
Name += "<unnamed-type-";
|
||||
Name += TND->getName();
|
||||
} else if (auto *ED = dyn_cast<EnumDecl>(TD)) {
|
||||
auto EnumeratorI = ED->enumerator_begin();
|
||||
assert(EnumeratorI != ED->enumerator_end());
|
||||
} else if (isa<EnumDecl>(TD) &&
|
||||
cast<EnumDecl>(TD)->enumerator_begin() !=
|
||||
cast<EnumDecl>(TD)->enumerator_end()) {
|
||||
// Anonymous non-empty enums mangle in the first enumerator.
|
||||
auto *ED = cast<EnumDecl>(TD);
|
||||
Name += "<unnamed-enum-";
|
||||
Name += EnumeratorI->getName();
|
||||
Name += ED->enumerator_begin()->getName();
|
||||
} else {
|
||||
// Otherwise, number the types using a $S prefix.
|
||||
Name += "<unnamed-type-$S";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 -fms-compatibility-version=19.00 | FileCheck %s --check-prefix=CHECK --check-prefix=MSVC2015
|
||||
// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 -fms-compatibility-version=18.00 | FileCheck %s --check-prefix=CHECK --check-prefix=MSVC2013
|
||||
// RUN: %clang_cc1 -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=i386-pc-win32 -gcodeview -debug-info-kind=limited | FileCheck %s --check-prefix=DBG
|
||||
|
||||
namespace FTypeWithQuals {
|
||||
template <typename T>
|
||||
|
@ -350,3 +351,10 @@ enum { enumerator };
|
|||
void f(decltype(enumerator)) {}
|
||||
// CHECK-DAG: define internal void @"?f@@YAXW4<unnamed-enum-enumerator>@@@Z"(
|
||||
void use_f() { f(enumerator); }
|
||||
|
||||
namespace pr37723 {
|
||||
struct s { enum {}; enum {}; };
|
||||
// DBG-DAG: DW_TAG_enumeration_type{{.*}}identifier: ".?AW4<unnamed-type-$S2>@s@pr37723@@"
|
||||
// DBG-DAG: DW_TAG_enumeration_type{{.*}}identifier: ".?AW4<unnamed-type-$S3>@s@pr37723@@"
|
||||
s x;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue