[lldb] Automatically unwrap parameter packs in template argument accessors
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 17 Aug 2022 00:53:34 +0000 (17:53 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 17 Aug 2022 01:10:14 +0000 (18:10 -0700)
commitb706f56133a77f9d7c55270ac24ff59e6fce3fa4
treea173eed4f0025432b61772adced171da7b1574ce
parent0af4651c0fc7d8887c7086381f6f514132899b20
[lldb]  Automatically unwrap parameter packs in template argument accessors

When looking at template arguments in LLDB, we usually care about what
the user passed in his code, not whether some of those arguments where
passed as a variadic parameter pack.

This patch extends all the C++ APIs to look at template parameters to
take an additional 'expand_pack' boolean that automatically unwraps the
potential argument packs. The equivalent SBAPI calls have been changed
to pass true for this parameter.

A byproduct of the patch is to also fix the support for template type
that have only a parameter pack as argument (like the OnlyPack type in
the test). Those were not recognized as template instanciations before.

The added test verifies that the SBAPI is able to iterate over the
arguments of a variadic template.

The original patch was written by Fred Riss almost 4 years ago.

Differential revision: https://reviews.llvm.org/D51387
lldb/include/lldb/API/SBType.h
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/API/SBType.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp
lldb/source/Symbol/TypeSystem.cpp
lldb/test/API/lang/cpp/class-template-parameter-pack/TestTemplatePackArgs.py [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp
lldb/unittests/Symbol/TestTypeSystemClang.cpp