diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2018-01-26 19:26:12 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2018-01-26 19:26:12 +0000 |
commit | 71b74ebb1e3732e3e40fe288ef864de91febc6ed (patch) | |
tree | 68a9f61bdc697265e6abfeb5b2e605b3029595ff /clang/lib/Index/IndexDecl.cpp | |
parent | 1a1edbfb048e83091bf6352e2be380d90976ed9b (diff) | |
download | bcm5719-llvm-71b74ebb1e3732e3e40fe288ef864de91febc6ed.tar.gz bcm5719-llvm-71b74ebb1e3732e3e40fe288ef864de91febc6ed.zip |
[index] Fix crash when indexing a C++14 PCH/module related to TemplateTemplateParmDecls of alias templates
TemplateTemplateParmDecls of alias templates ended-up serialized as 'file-level decls' which was causing a crash while trying to index a PCH/module file that contained them.
Commit makes sure TemplateTemplateParmDecls are not recorded as such kind of decls.
Fixes crash of rdar://36608297
Differential Revision: https://reviews.llvm.org/D42588
llvm-svn: 323549
Diffstat (limited to 'clang/lib/Index/IndexDecl.cpp')
-rw-r--r-- | clang/lib/Index/IndexDecl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index e14750e046e..f1ef6c0ea21 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -664,8 +664,11 @@ public: bool VisitTemplateDecl(const TemplateDecl *D) { - // Index the default values for the template parameters. const NamedDecl *Parent = D->getTemplatedDecl(); + if (!Parent) + return true; + + // Index the default values for the template parameters. if (D->getTemplateParameters() && shouldIndexTemplateParameterDefaultValue(Parent)) { const TemplateParameterList *Params = D->getTemplateParameters(); @@ -684,7 +687,7 @@ public: } } - return Visit(D->getTemplatedDecl()); + return Visit(Parent); } bool VisitFriendDecl(const FriendDecl *D) { |