[PATCH] D56393: [DebugInfo] Don't emit DW_AT_enum_class unless it's actually an 'enum class'.

Zachary Turner via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 7 08:25:25 PST 2019


PDB/CodeView doesn’t doesn’t distinguish between various flavors of enums
On Mon, Jan 7, 2019 at 8:14 AM Paul Robinson via Phabricator <
reviews at reviews.llvm.org> wrote:

> probinson created this revision.
> probinson added reviewers: dblaikie, rnk, zturner.
> probinson added a project: debug-info.
> Herald added subscribers: cfe-commits, JDevlieghere, aprantl.
>
> The original fix for PR36168 would emit DW_AT_enum_class for both of these
> cases:
>
> enum Fixed : short { F1 <https://reviews.llvm.org/F1> = 1 };
> enum class Class { C1 = 1 };
>
> However, it really should be applied only to the latter case.
>
> I'd just do this, except I'm not sure whether PDB cares about this
> difference.  If it does, let me know and I guess we'll have to invent a new
> flag so the DWARF and PDB generators can each DTRT.
>
> If not, I'll follow up with NFC name changes so the flag becomes
> DIFlagEnumClass.
>
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D56393
>
> Files:
>   clang/lib/CodeGen/CGDebugInfo.cpp
>   clang/test/CodeGenCXX/debug-info-enum-class.cpp
>
>
> Index: clang/test/CodeGenCXX/debug-info-enum-class.cpp
> ===================================================================
> --- clang/test/CodeGenCXX/debug-info-enum-class.cpp
> +++ clang/test/CodeGenCXX/debug-info-enum-class.cpp
> @@ -52,6 +52,7 @@
>  // FIXME: this should just be a declaration under -fno-standalone-debug
>  // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
>  // CHECK-SAME:             scope: [[TEST2:![0-9]+]]
> +// CHECK-NOT:              DIFlagFixedEnum
>  // CHECK-SAME:             elements: [[TEST_ENUMS:![0-9]+]]
>  // CHECK-SAME:             identifier: "_ZTSN5test21EE"
>  // CHECK: [[TEST2]] = !DINamespace(name: "test2"
> @@ -67,6 +68,7 @@
>  // FIXME: this should just be a declaration under -fno-standalone-debug
>  // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
>  // CHECK-SAME:             scope: [[TEST3:![0-9]+]]
> +// CHECK-NOT:              DIFlagFixedEnum
>  // CHECK-SAME:             elements: [[TEST_ENUMS]]
>  // CHECK-SAME:             identifier: "_ZTSN5test31EE"
>  // CHECK: [[TEST3]] = !DINamespace(name: "test3"
> @@ -78,6 +80,7 @@
>  namespace test4 {
>  // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
>  // CHECK-SAME:             scope: [[TEST4:![0-9]+]]
> +// CHECK-NOT:              DIFlagFixedEnum
>  // CHECK-SAME:             elements: [[TEST_ENUMS]]
>  // CHECK-SAME:             identifier: "_ZTSN5test41EE"
>  // CHECK: [[TEST4]] = !DINamespace(name: "test4"
> Index: clang/lib/CodeGen/CGDebugInfo.cpp
> ===================================================================
> --- clang/lib/CodeGen/CGDebugInfo.cpp
> +++ clang/lib/CodeGen/CGDebugInfo.cpp
> @@ -2711,7 +2711,7 @@
>    llvm::DIType *ClassTy = getOrCreateType(ED->getIntegerType(), DefUnit);
>    return DBuilder.createEnumerationType(EnumContext, ED->getName(),
> DefUnit,
>                                          Line, Size, Align, EltArray,
> ClassTy,
> -                                        Identifier, ED->isFixed());
> +                                        Identifier, ED->isScoped());
>  }
>
>  llvm::DIMacro *CGDebugInfo::CreateMacro(llvm::DIMacroFile *Parent,
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190107/24fe4357/attachment.html>


More information about the cfe-commits mailing list