[all-commits] [llvm/llvm-project] c52642: [lldb] Don't reject empty or unnamed template para...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Wed Dec 2 01:55:56 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c526426f5cba5308782ea4f86822047ee2ee3818
      https://github.com/llvm/llvm-project/commit/c526426f5cba5308782ea4f86822047ee2ee3818
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-12-02 (Wed, 02 Dec 2020)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
    A lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/Makefile
    A lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/TestClassTemplateNonTypeParameterPack.py
    A lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/main.cpp
    A lldb/test/API/lang/cpp/class-template-type-parameter-pack/Makefile
    A lldb/test/API/lang/cpp/class-template-type-parameter-pack/TestClassTemplateTypeParameterPack.py
    A lldb/test/API/lang/cpp/class-template-type-parameter-pack/main.cpp
    M lldb/unittests/Symbol/TestTypeSystemClang.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list