[cfe-commits] r71814 - in /cfe/trunk: lib/Sema/Sema.h lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp lib/Sema/SemaTemplateInstantiateExpr.cpp test/SemaTemplate/instantiate-expr-2.cpp test/SemaTemplate/instantiate-function-1.cpp

Douglas Gregor dgregor at apple.com
Thu May 14 19:55:54 PDT 2009


On May 14, 2009, at 4:26 PM, Douglas Gregor wrote:
> -  // FIXME: instantiate the pattern
> +  // Introduce a new scope where local variable instantiations will  
> be
> +  // recorded.
> +  LocalInstantiationScope Scope(*this);
> +
> +  // Introduce the instantiated function parameters into the local
> +  // instantiation scope.
> +  for (unsigned I = 0, N = PatternDecl->getNumParams(); I != N; ++I)
> +    Scope.InstantiatedLocal(PatternDecl->getParamDecl(I),
> +                            Function->getParamDecl(I));
> +
> +  // Instantiate the function body.
> +  OwningStmtResult Body
> +    = InstantiateStmt(Pattern,  
> getTemplateInstantiationArgs(Function));
> +  if (Body.isInvalid())
> +    Function->setInvalidDecl(true);
> +  else
> +    Function->setBody(Body.takeAs<Stmt>());
> }


We need to call a refactored version of ActOnStartOfFunctionDef, here,  
to perform additional semantic checking on the function definition and  
set up the context appropriately.

	- Doug



More information about the cfe-commits mailing list