[all-commits] [llvm/llvm-project] a842f7: [lldb] Support simplified template names

aeubanks via All-commits all-commits at lists.llvm.org
Fri Oct 28 16:16:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a842f74056793d9ab41411aa343811368164e6a8
      https://github.com/llvm/llvm-project/commit/a842f74056793d9ab41411aa343811368164e6a8
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2022-10-28 (Fri, 28 Oct 2022)

  Changed paths:
    M lldb/include/lldb/Symbol/CompilerType.h
    M lldb/include/lldb/Symbol/Type.h
    M lldb/include/lldb/Symbol/TypeSystem.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
    M lldb/source/Symbol/CompilerType.cpp
    M lldb/source/Symbol/Type.cpp
    M lldb/test/API/lang/cpp/complete-type-check/TestCppIsTypeComplete.py
    A lldb/test/API/lang/cpp/unique-types2/Makefile
    A lldb/test/API/lang/cpp/unique-types2/TestUniqueTypes.py
    A lldb/test/API/lang/cpp/unique-types2/main.cpp

  Log Message:
  -----------
  [lldb] Support simplified template names

See https://discourse.llvm.org/t/dwarf-using-simplified-template-names/58417 for background on simplified template names.

lldb doesn't work with simplified template names because it uses DW_AT_name which doesn't contain template parameters under simplified template names.

Two major changes are required to make lldb work with simplified template names.

1) When building clang ASTs for struct-like dies, we use the name as a cache key. To distinguish between different instantiations of a template class, we need to add in the template parameters.

2) When looking up types, if the requested type name contains '<' and we didn't initially find any types from the index searching the name, strip the template parameters and search the index, then filter out results with non-matching template parameters. This takes advantage of the clang AST's ability to print full names rather than doing it by ourself.

An alternative is to fix up the names in the index to contain the fully qualified name, but that doesn't respect .debug_names.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134378




More information about the All-commits mailing list