[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

Jaroslav Sevcik via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 22 08:55:10 PDT 2019


jarin created this revision.
Herald added subscribers: lldb-commits, arphaman, aprantl.
Herald added a project: LLDB.

WORK IN PROGRESS

This change is mostly for discussion, it is messy and likely wrong as I am new to the lldb codebase.

The goal of this exercise is to support expressions containing template instantiations, e.g. foo<int>::x.

The idea here is to collect all template types in the dwarf index. Later, when asked to find a name X, we import all the instantiations of X and pass the template declaration with the instantiations to Clang. In addition to my poor abstraction skills, the major problem with this is that we need to import all the instantiations even when only one is used. I tried to only import forward declarations, but if the instantiations were already previously completed, the AST importer still imports everything. This leads to massive evaluation times (tens of seconds) on templates with many instantiations (std::vector and the likes).

I am planning to pursue a different avenue, where I would introduce another hook into clang (perhaps in Sema::CheckTemplateIdType), but I am not sure how viable that path is.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69309

Files:
  lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/TestClassTemplateInstantiation.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/main.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/TypeMap.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69309.226051.patch
Type: text/x-patch
Size: 16810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191022/edc00a3d/attachment-0001.bin>


More information about the lldb-commits mailing list