Merging r359809:
------------------------------------------------------------------------
r359809 | rnk | 2019-05-02 10:45:54 -0700 (Thu, 02 May 2019) | 27 lines

Use primary template parameter names for variable template debug info

Summary:
Fixes PR41677

Consider:
  template <typename LHS, typename RHS> constexpr bool is_same_v = false;
  template <typename T> constexpr bool is_same_v<T, T> = true;
  template constexpr bool is_same_v<int, int>;

Before this change, when emitting debug info for the
`is_same_v<int, int>` global variable, clang would crash because it
would try to use the template parameter list from the partial
specialization to give parameter names to template arguments. This
doesn't work in general, since a partial specialization can have fewer
arguments than the primary template. Therefore, always use the primary
template. Hypothetically we could try to use the parameter names from
the partial specialization when possible, but it's not clear this really
helps debugging in practice.

Reviewers: JDevlieghere, aprantl, ormris, dblaikie

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D61408
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_80@364483 91177308-0d34-0410-b5e6-96231b3b80d8
3 files changed