From 02eb8e20b51b3ea263bbfe696241b8541c72ee7a Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Tue, 5 Jan 2021 08:11:33 +0000 Subject: [PATCH] Inform the consumer on invalid template instantiations. Some clients which want to track state need the information whether a template was instantiated and made invalid. Differential revision: https://reviews.llvm.org/D92248 --- clang/lib/Sema/SemaTemplateInstantiate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 39ea9e06e7b1..7e0cc2da2f58 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2846,8 +2846,6 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, SavedContext.pop(); if (!Instantiation->isInvalidDecl()) { - Consumer.HandleTagDeclDefinition(Instantiation); - // Always emit the vtable for an explicit instantiation definition // of a polymorphic class template specialization. Otherwise, eagerly // instantiate only constexpr virtual functions in preparation for their use @@ -2859,6 +2857,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, /*ConstexprOnly*/ true); } + Consumer.HandleTagDeclDefinition(Instantiation); + return Instantiation->isInvalidDecl(); }