[lldb] Don't reject empty or unnamed template parameter packs
authorRaphael Isemann <teemperor@gmail.com>
Wed, 2 Dec 2020 09:35:07 +0000 (10:35 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Wed, 2 Dec 2020 09:50:41 +0000 (10:50 +0100)
commitc526426f5cba5308782ea4f86822047ee2ee3818
treef8e96187e1626c5d83d3f6ef954ddba23e9eff62
parent99eb0f16c35cdaa04dea4c5bbad4f86408e9dcfd
[lldb] Don't reject empty or unnamed template parameter packs

We currently reject all templates that have either zero args or that have a
parameter pack without a name. Both cases are actually allowed in C++, so
rejecting them leads to LLDB instead falling back to a dummy 'void' type. This
leads to all kind of errors later on (most notable, variables that have such
template types appear to be missing as we can't have 'void' variables and
inheriting from such a template type will cause Clang to hit some asserts when
finding that the base class is 'void').

This just removes the too strict tests and adds a few tests for this stuff (+
some combinations of these tests with preceding template parameters).

Things that I left for follow-up patches:
* All the possible interactions with template-template arguments which seem like a whole new source of possible bugs.
* Function templates which completely lack sanity checks.
* Variable templates are not implemented.
* Alias templates are not implemented too.
* The rather strange checks that just make sure that the separate list of
  template arg names and values always have the same length. I believe those
  ought to be asserts, but my current plan is to move both those things into a
  single list that can't end up in this inconsistent state.

Reviewed By: JDevlieghere, shafik

Differential Revision: https://reviews.llvm.org/D92425
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/main.cpp [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-type-parameter-pack/Makefile [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py [new file with mode: 0644]
lldb/test/API/lang/cpp/class-template-type-parameter-pack/main.cpp [new file with mode: 0644]
lldb/unittests/Symbol/TestTypeSystemClang.cpp