[PATCH] D47875: [MS ABI] Mangle unnamed empty enums (PR37723)
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 10 23:58:41 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL334388: [MS ABI] Mangle unnamed empty enums (PR37723) (authored by hans, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D47875?vs=150462&id=150677#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47875
Files:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
Index: cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
@@ -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 @@
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 at pr37723@@"
+// DBG-DAG: DW_TAG_enumeration_type{{.*}}identifier: ".?AW4<unnamed-type-$S3>@s at pr37723@@"
+s x;
+}
Index: cfe/trunk/lib/AST/MicrosoftMangle.cpp
===================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp
@@ -884,11 +884,13 @@
// 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";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47875.150677.patch
Type: text/x-patch
Size: 2243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/161bc65a/attachment.bin>
More information about the llvm-commits
mailing list