[Lldb-commits] [PATCH] D63268: Make UniqueCStringMap work with non-default-constructible types and other improvements/cleanups

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 13 07:39:54 PDT 2019


labath created this revision.
labath added reviewers: JDevlieghere, sgraenitz.
Herald added subscribers: aprantl, mgorny.

The motivation for this was me wanting to make the validity of dwarf
DIERefs explicit (via llvm::Optional<DIERef>). This meant that the class
would no longer have a default constructor. As the DIERef was being
stored in a UniqueCStringMap, this meant that this container (like all
standard containers) needed to work with non-default-constructible types
too.

This part is achieved by removing die default constructors for the map
entry types, and providing appropriate comparison overloads so that we
can search for map entries without constructing a dummy entry. While
doing that, I took the opportunity to modernize the code, and add some
tests. Functions that were completely unused are deleted.

This required also some changes in the Symtab code, as it was default
constructing map entries, which was not impossible even though its
value type was default-constructible. Technically, these changes could
be avoided with some SFINAE on the entry type, but I felt that the code
is cleaner this way anyway.


https://reviews.llvm.org/D63268

Files:
  include/lldb/Core/UniqueCStringMap.h
  include/lldb/Symbol/Symtab.h
  source/Symbol/Symtab.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/UniqueCStringMapTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63268.204537.patch
Type: text/x-patch
Size: 13617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190613/af57ef3c/attachment.bin>


More information about the lldb-commits mailing list