[PATCH] D42734: [DebugInfo] Improvements to representation of enumeration types (PR36168)

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 06:31:40 PST 2018


chill created this revision.
chill added reviewers: dblaikie, keith.walker.arm.
Herald added subscribers: JDevlieghere, aprantl.

This patch is the LLVM part of fixing the issues, described in https://bugs.llvm.org/show_bug.cgi?id=36168

- The representation of enumerator values in the debug info metadata now contains a boolean flag `isSigned`, which

determines how the bits of the `value` are interpreted.

- The DW_TAG_enumeration type DIE now always (for DWARF version >= 3) includes a `DW_AT_type` attribute, which refers to the underlying integer type, as suggested in DWARFv4 (5.7 Enumeration Type Entries).
- The debug info metadata for enumeration type contains (in flags) indication whether this is a C++11 "fixed enum".
- For C++11 enumeration with a fixed underlying type, the DIE also includes the `DW_AT_enum_class` attribute (for DWARF version >= 4).
- Encoding of enumerator constants uses `DW_FORM_sdata` for signed values and `DW_FORM_udata` for unsigned values, as suggested by DWARFv4 (7.5.4 Attribute Encodings).

The changes should be backwards compatible:

- the `isSigned` attribute is optional and defaults to `true`
- if the underlying type for the enumeration  is not available, the enumerator values are considered signed
- the `FixedEnum` flag defaults to clear

There are corresponding changes to `clang` (I'll submit them shortly), however this patch in isolation
 ought to not break build or introduce regressions.


Repository:
  rL LLVM

https://reviews.llvm.org/D42734

Files:
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/DIBuilder.h
  include/llvm/IR/DebugInfoFlags.def
  include/llvm/IR/DebugInfoMetadata.h
  lib/AsmParser/LLParser.cpp
  lib/Bitcode/Reader/MetadataLoader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/IR/AsmWriter.cpp
  lib/IR/DIBuilder.cpp
  lib/IR/DebugInfoMetadata.cpp
  lib/IR/LLVMContextImpl.h
  test/DebugInfo/Generic/debug-info-enum.ll
  test/DebugInfo/X86/enum-class.ll
  unittests/IR/MetadataTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42734.132150.patch
Type: text/x-patch
Size: 27457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/0e78dfdc/attachment.bin>


More information about the llvm-commits mailing list