Make sure that CodeGen sees template instantiations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72433 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index a5b0911..3c32a21 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===/
#include "Sema.h"
+#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/AST/DeclTemplate.h"
@@ -779,6 +780,9 @@
// Exit the scope of this instantiation.
CurContext = PreviousContext;
+ if (!Invalid)
+ Consumer.HandleTagDeclDefinition(Instantiation);
+
// If this is an explicit instantiation, instantiate our members, too.
if (!Invalid && ExplicitInstantiation) {
Inst.Clear();
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index b9a9ae8..90c86ec 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===/
#include "Sema.h"
+#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
@@ -622,6 +623,9 @@
/*IsInstantiation=*/true);
CurContext = PreviousContext;
+
+ DeclGroupRef DG(Function);
+ Consumer.HandleTopLevelDecl(DG);
}
/// \brief Instantiate the definition of the given variable from its