[clang] 02eb8e2 - Inform the consumer on invalid template instantiations.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 01:43:49 PST 2021


Author: Vassil Vassilev
Date: 2021-01-05T09:43:38Z
New Revision: 02eb8e20b51b3ea263bbfe696241b8541c72ee7a

URL: https://github.com/llvm/llvm-project/commit/02eb8e20b51b3ea263bbfe696241b8541c72ee7a
DIFF: https://github.com/llvm/llvm-project/commit/02eb8e20b51b3ea263bbfe696241b8541c72ee7a.diff

LOG: 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

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplateInstantiate.cpp

Removed: 
    


################################################################################
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();
 }
 


        


More information about the cfe-commits mailing list