Call ActOnStartOfFunctionDecl/ActOnFinishFunctionBody when
instantiating the definition of a function from a template.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71869 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 113003f..f1a02c4 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -587,6 +587,8 @@
 
   // FIXME: add to the instantiation stack.
 
+  ActOnStartOfFunctionDef(0, DeclPtrTy::make(Function));
+
   // Introduce a new scope where local variable instantiations will be
   // recorded.
   LocalInstantiationScope Scope(*this);
@@ -605,10 +607,9 @@
   // Instantiate the function body.
   OwningStmtResult Body 
     = InstantiateStmt(Pattern, getTemplateInstantiationArgs(Function));
-  if (Body.isInvalid())
-    Function->setInvalidDecl(true);
-  else
-    Function->setBody(Body.takeAs<Stmt>());
+
+  ActOnFinishFunctionBody(DeclPtrTy::make(Function), move(Body), 
+                          /*IsInstantiation=*/true);
 
   CurContext = PreviousContext;
 }