[Lldb-commits] [PATCH] D75481: [lldb] Don't iterate over a std::set<Type*> in SymbolFileDWARF::GetTypes to make it deterministic

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 2 15:39:26 PST 2020


teemperor updated this revision to Diff 247733.
teemperor added a comment.
This revision is now accepted and ready to land.

- Use SetVector instead.
- Remove now unused include to <set>


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75481/new/

https://reviews.llvm.org/D75481

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -12,11 +12,11 @@
 #include <list>
 #include <map>
 #include <mutex>
-#include <set>
 #include <unordered_map>
 #include <vector>
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SetVector.h"
 #include "llvm/Support/Threading.h"
 
 #include "lldb/Core/UniqueCStringMap.h"
@@ -439,7 +439,7 @@
 
   bool FixupAddress(lldb_private::Address &addr);
 
-  typedef std::set<lldb_private::Type *> TypeSet;
+  typedef llvm::SetVector<lldb_private::Type *> TypeSet;
 
   void GetTypes(const DWARFDIE &die, dw_offset_t min_die_offset,
                 dw_offset_t max_die_offset, uint32_t type_mask,
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -324,10 +324,8 @@
       if (add_type) {
         const bool assert_not_being_parsed = true;
         Type *type = ResolveTypeUID(die, assert_not_being_parsed);
-        if (type) {
-          if (type_set.find(type) == type_set.end())
-            type_set.insert(type);
-        }
+        if (type)
+          type_set.insert(type);
       }
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75481.247733.patch
Type: text/x-patch
Size: 1455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200302/803218ac/attachment.bin>


More information about the lldb-commits mailing list