[clangd] Fix a crash bug in AddUsing tweak around template handling.
authorAdam Czachorowski <adamcz@google.com>
Wed, 8 Apr 2020 11:42:10 +0000 (13:42 +0200)
committerSam McCall <sam.mccall@gmail.com>
Wed, 8 Apr 2020 11:59:47 +0000 (13:59 +0200)
commitcca10be3f60dd30055acc70d117649f889da779d
tree7394b7f8dcba4f27f322b9ee9d3e5e3c4b3b1d8c
parenta59008a3a5b0aa75fc78eb708dbc788600e79c65
[clangd] Fix a crash bug in AddUsing tweak around template handling.

Summary:
The crash happened on cases like:
template<typename TT> using one = two::three<T^T>;
because we tried to call getName() on getBaseTypeIdentifier(), which can
be nullptr.

Ideally we would support this use case as well, but for now not crashing
will do.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77656
clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
clang-tools-extra/clangd/unittests/TweakTests.cpp