Hi Jonas, Since dw_tag_t is an enum now, in the switch statement at following mentioned location, default case needs to be added as well. It generates a warning that some enumeration values are not handled in switch. https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp#L35
On Wed, Sep 25, 2019 at 9:02 AM Jonas Devlieghere via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: jdevlieghere > Date: Wed Sep 25 09:04:38 2019 > New Revision: 372891 > > URL: http://llvm.org/viewvc/llvm-project?rev=372891&view=rev > Log: > [Dwarf] Make dw_tag_t a typedef for llvm::dwarf::Tag instead of uint16_t. > > Currently dw_tag_t is a typedef for uint16_t. This patch changes makes > dw_tag_t a typedef for llvm::dwarf::Tag. This enables us to use the full > power of the DWARF utilities in LLVM without having to do the cast every > time. With this approach, we only have to do the cast when reading the > ULEB value. > > Differential revision: https://reviews.llvm.org/D68005 > > Modified: > lldb/trunk/include/lldb/Core/dwarf.h > > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h > lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h > > Modified: lldb/trunk/include/lldb/Core/dwarf.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/include/lldb/Core/dwarf.h (original) > +++ lldb/trunk/include/lldb/Core/dwarf.h Wed Sep 25 09:04:38 2019 > @@ -22,7 +22,7 @@ typedef uint32_t dw_uleb128_t; > typedef int32_t dw_sleb128_t; > typedef uint16_t dw_attr_t; > typedef uint16_t dw_form_t; > -typedef uint16_t dw_tag_t; > +typedef llvm::dwarf::Tag dw_tag_t; > typedef uint64_t dw_addr_t; // Dwarf address define that must be big > enough for > // any addresses in the compile units that get > // parsed > > Modified: > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp > (original) > +++ > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp > Wed Sep 25 09:04:38 2019 > @@ -18,7 +18,8 @@ > using namespace lldb_private; > > DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() > - : m_code(InvalidCode), m_tag(0), m_has_children(0), m_attributes() {} > + : m_code(InvalidCode), m_tag(llvm::dwarf::DW_TAG_null), > m_has_children(0), > + m_attributes() {} > > DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration(dw_tag_t tag, > uint8_t > has_children) > @@ -33,7 +34,7 @@ DWARFAbbreviationDeclaration::extract(co > return DWARFEnumState::Complete; > > m_attributes.clear(); > - m_tag = data.GetULEB128(offset_ptr); > + m_tag = static_cast<dw_tag_t>(data.GetULEB128(offset_ptr)); > if (m_tag == DW_TAG_null) > return llvm::make_error<llvm::object::GenericBinaryError>( > "abbrev decl requires non-null tag."); > @@ -68,7 +69,7 @@ DWARFAbbreviationDeclaration::extract(co > } > > bool DWARFAbbreviationDeclaration::IsValid() { > - return m_code != 0 && m_tag != 0; > + return m_code != 0 && m_tag != llvm::dwarf::DW_TAG_null; > } > > uint32_t > > Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (original) > +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Wed Sep 25 > 09:04:38 2019 > @@ -30,7 +30,7 @@ dw_tag_t DWARFBaseDIE::Tag() const { > if (m_die) > return m_die->Tag(); > else > - return 0; > + return llvm::dwarf::DW_TAG_null; > } > > const char *DWARFBaseDIE::GetTagAsCString() const { > > Modified: > lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp > (original) > +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed > Sep 25 09:04:38 2019 > @@ -192,7 +192,7 @@ bool DWARFDebugInfoEntry::Extract(const > *offset_ptr = offset; > return true; > } else { > - m_tag = 0; > + m_tag = llvm::dwarf::DW_TAG_null; > m_has_children = false; > return true; // NULL debug tag entry > } > > Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h > (original) > +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Wed > Sep 25 09:04:38 2019 > @@ -31,7 +31,7 @@ public: > > DWARFDebugInfoEntry() > : m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0), > - m_has_children(false), m_abbr_idx(0), m_tag(0) {} > + m_has_children(false), m_abbr_idx(0), > m_tag(llvm::dwarf::DW_TAG_null) {} > > explicit operator bool() const { return m_offset != DW_INVALID_OFFSET; } > bool operator==(const DWARFDebugInfoEntry &rhs) const; > @@ -178,8 +178,9 @@ protected: > // a single NULL terminating child. > m_has_children : 1; > uint16_t m_abbr_idx; > - uint16_t m_tag; // A copy of the DW_TAG value so we don't have to go > through > - // the compile unit abbrev table > + /// A copy of the DW_TAG value so we don't have to go through the > compile > + /// unit abbrev table > + dw_tag_t m_tag = llvm::dwarf::DW_TAG_null; > }; > > #endif // SymbolFileDWARF_DWARFDebugInfoEntry_h_ > > Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h > (original) > +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h Wed Sep > 25 09:04:38 2019 > @@ -23,7 +23,7 @@ > class DWARFDeclContext { > public: > struct Entry { > - Entry() : tag(0), name(nullptr) {} > + Entry() : tag(llvm::dwarf::DW_TAG_null), name(nullptr) {} > Entry(dw_tag_t t, const char *n) : tag(t), name(n) {} > > bool NameMatches(const Entry &rhs) const { > > Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=372891&r1=372890&r2=372891&view=diff > > ============================================================================== > --- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original) > +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Wed Sep > 25 09:04:38 2019 > @@ -53,7 +53,7 @@ public: > > struct DIEInfo { > dw_offset_t die_offset = DW_INVALID_OFFSET; > - dw_tag_t tag = 0; > + dw_tag_t tag = llvm::dwarf::DW_TAG_null; > > /// Any flags for this DIEInfo. > uint32_t type_flags = 0; > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits >
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits