[Lldb-commits] [PATCH] D22369: DWARFDeclContext: Don't add '::' in front of symbol names

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 8 11:29:36 PDT 2016

clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

We can't currently do this because we have a dependency on having this be there for existing customers. The problem is that the debug info always has the base names of types in the tables: "pointer_type", "reference_type", etc. The problem arises when we say 'I want only matches to the full qualified name of "size_type"'. We will pick up many many matches if we don't look up "::size_type" because every STL class has things like:

  template <class _Tp, class _Allocator = allocator<_Tp> >
  class vector : private __vector_base<_Tp, _Allocator>
      typedef __vector_base<_Tp, _Allocator>           __base;
      typedef allocator<_Tp>                           __default_allocator_type;
      typedef vector                                   __self;
      typedef _Tp                                      value_type;
      typedef _Allocator                               allocator_type;
      typedef typename __base::__alloc_traits          __alloc_traits;
      typedef typename __base::reference               reference;
      typedef typename __base::const_reference         const_reference;
      typedef typename __base::size_type               size_type;
      typedef typename __base::difference_type         difference_type;

So having the extra "::" on the name for things that are top level helps us avoid pulling in many mega bytes of DWARF every time do this. So we can't make these changes without affecting type lookups. The DWARFDDeclContext class is used to get fully qualified names during SymbolFileDWARF::FindTypes(...) to avoid pulling in all DWARF for any type whose basename matches, but this only happens when using the Apple accelerator tables. For a type like like:

  typedef unsigned long size_type;

The Apple accelerator tables will have an entry for "size_type", and this table entry includes a fully qualified name hash. So we will hash up "::size_type" and include that in the type accelerator table entry so we can omit any non matching entries (all "size_type" values in all STL classes will have "std::vector::size_type" hashed up in their "size_type" accelerator table entry and we can avoid parsing all of the DWARF for std::vector and all other STL classes when).

So I can't condone this patch without further modifications.


More information about the lldb-commits mailing list