[PATCH] D39239: [AST] Incorrectly qualified unscoped enumeration as template actual parameter.

Carlos Alberto Enciso via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 06:14:14 PDT 2017


CarlosAlbertoEnciso added a comment.

Hi Tamas,

Thanks very much for your message.

In https://reviews.llvm.org/D39239#910797, @tberghammer wrote:

> - Can you do a diff of the debug_info dump before and after your change? Understanding what have changed should give us a pretty good clue about the issue.


For this specific case, the debug_info is the same before and after my change, as the patch affects only unscoped enums.

  DW_TAG_compile_unit "main.cpp"
    DW_AT_producer "clang version 6.0.0 (trunk 316983)"
    DW_AT_comp_dir "/home/carlos/llvm-root/llvm/tools/lldb/packages/Python/lldbsuite/test/lang/cpp/template"
    ...
    DW_TAG_enumeration_type "EnumType"
      DW_AT_enum_class DW_FORM_flag_present
      DW_TAG_enumerator "Member"
      DW_TAG_enumerator "Subclass"
      ...
    DW_TAG_class_type "EnumTemplate<EnumType::Member>"
      ...
    DW_TAG_class_type "EnumTemplate<EnumType::Subclass>"
      ...

The DW_AT_name string for the templates are correctly generated, including the scoped information.

> - My first guess is that after your change we emit DW_TAG_enumeration_type for scoped enums (what seems to be the correct thing to do) instead of something else (not sure what) and you have to update https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp#L1512 to handle it correctly.

Thanks for the link.

Looking at:
https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp#L1512

  const char *DWARFDebugInfoEntry::GetQualifiedName(
      SymbolFileDWARF *dwarf2Data, DWARFCompileUnit *cu,
      const DWARFAttributes &attributes, std::string &storage) const {
  
    const char *name = GetName(dwarf2Data, cu);
    ...
    return storage.c_str();
  }

The values for 'name' and 'storage' are correct and include the full qualified name: 'EnumTemplate<EnumType::Member>'.

https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L926

During the processing of DW_TAG_enumeration_type, it seems that 'DW_AT_enum_class' is not processed.

  DW_TAG_enumeration_type "EnumType"
    ...
    DW_AT_enum_class DW_FORM_flag_present  
    ...
    DW_TAG_enumerator "Member"
    DW_TAG_enumerator "Subclass"

which at the end can have an impact on the name generated for the enumerators to be:

"EnumTemplate<EnumType::Member>"

or

"EnumTemplate<Member>"

Thanks.


https://reviews.llvm.org/D39239





More information about the cfe-commits mailing list