<div dir="ltr">Hi Jonas,<br><br>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 <span style="color:rgb(0,0,0);white-space:pre-wrap">enumeration values are not handled in switch.

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