Lines Matching refs:Function
442 // If a declaration acquires a function type through a type
445 // functionfunction type, the program is
683 // If the enumeration is within a function or method, record the enum
909 // Create a local instantiation scope for this function template, which
911 // merged with the local instantiation scope for the function template
934 // Link the instantiated function template declaration to the function
987 // If the original function was part of a friend declaration,
1004 /// don't make it here. This function serves two purposes:
1005 /// 1) instantiating function templates
1007 /// FIXME: preserve function definitions in case #2
1010 // Check whether there is already a function template specialization for
1022 // If we already have a function template specialization, return it.
1054 // If we're instantiating a local function declaration, put the result
1069 FunctionDecl *Function =
1077 Function->setQualifierInfo(QualifierLoc);
1085 Function->setLexicalDeclContext(LexicalDC);
1088 if (isa<FunctionProtoType>(Function->getType().IgnoreParens())) {
1092 Params[P]->setOwningFunction(Function);
1094 // Since we were instantiated via a typedef of a function type, create
1097 = Function->getType()->getAs<FunctionProtoType>();
1098 assert(Proto && "No function prototype in template instantiation?");
1102 = SemaRef.BuildParmVarDeclForTypedef(Function, Function->getLocation(),
1108 Function->setParams(Params);
1112 // Our resulting instantiation is actually a function template, since we
1122 // We are instantiating the friend function template "f" within X<int>,
1123 // which means substituting int for T, but leaving "f" as a friend function
1125 // Build the function template itself.
1127 Function->getLocation(),
1128 Function->getDeclName(),
1129 TemplateParams, Function);
1130 Function->setDescribedFunctionTemplate(FunctionTemplate);
1141 // Record this function template specialization.
1144 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1154 // friend function declaration, however that would require finding all the
1156 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1159 if (InitFunctionInstantiation(Function, D))
1160 Function->setInvalidDecl();
1164 LookupResult Previous(SemaRef, Function->getDeclName(), SourceLocation(),
1172 Function->setObjectOfFriendDecl(/*HasPrevious*/ true);
1191 if (SemaRef.CheckFunctionTemplateSpecialization(Function,
1194 Function->setInvalidDecl();
1212 SemaRef.CheckFunctionDeclaration(/*Scope*/ 0, Function, Previous,
1217 : Function);
1219 // If the original function was part of a friend declaration,
1226 PrevDecl = Function->getPreviousDeclaration();
1233 // C++98 [temp.friend]p5: When a function is defined in a friend function
1234 // declaration in a class template, the function is defined at each
1235 // instantiation of the class template. The function is defined even if it
1237 // C++11 [temp.friend]p4: When a function is defined in a friend function
1238 // declaration in a class template, the function is instantiated when the
1239 // function is odr-used.
1242 // redefinition, but don't instantiate the function.
1246 Function->getLocation())
1249 // Check for a function body.
1251 if (Function->isDefined(Definition) &&
1253 SemaRef.Diag(Function->getLocation(),
1256 diag::err_redefinition) << Function->getDeclName();
1259 Function->setInvalidDecl();
1262 // a similar friend function.
1263 else for (FunctionDecl::redecl_iterator R = Function->redecls_begin(),
1264 REnd = Function->redecls_end();
1266 if (*R == Function)
1273 = Function->getMemberSpecializationInfo()) {
1278 std::make_pair(Function, Loc));
1288 SemaRef.Diag(Function->getLocation(),
1292 << Function->getDeclName();
1295 Function->setInvalidDecl();
1303 if (Function->isOverloadedOperator() && !DC->isRecord() &&
1308 return Function;
1318 // We are creating a function template specialization from a function
1319 // template. Check whether there is already a function template
1328 // If we already have a function template specialization, return it.
1365 // \brief If the type of this function, after ignoring parentheses,
1366 // is not *directly* a function type, then we're instantiating a function
1446 // Our resulting instantiation is actually a function template, since we
1457 // substituting int for T, but leaving "f" as a member function template.
1458 // Build the function template itself.
1470 // Record this function template specialization.
1479 // Record that this is an instantiation of a member function.
1483 // If we are instantiating a member function defined
1530 // If there's a function template, let our caller handle it.
1547 "should not implicitly default uninstantiated function");
2127 assert(OldTInfo && "substituting function without type source info");
2175 // The function type itself was not dependent and therefore no
2177 // the function parameters themselves.
2192 /// \brief Initializes the common fields of an instantiation function
2203 // or deduced template arguments into a function template and we reach this
2205 // to keeping the new function template specialization. We therefore
2206 // convert the active template instantiation for the function template
2207 // into a template instantiation for this specific function template
2217 "Deduction from the wrong function template?");
2226 assert(Proto && "Function template without prototype?");
2229 // The function has an exception specification or a "noreturn"
2325 // Rebuild the function type
2336 assert(NewProto && "Template instantiation without function prototype?");
2344 // a constexpr function template satisfies the requirements for a constexpr
2345 // function, then it is a constexpr function.
2380 /// \brief Instantiate the definition of the given function from its
2385 /// for the function, but it's close.
2387 /// \param Function the already-instantiated declaration of a
2388 /// function template specialization or member function of a class template
2395 /// instantiation where the body of the function is required. Complain if
2398 FunctionDecl *Function,
2401 if (Function->isInvalidDecl() || Function->isDefined())
2406 if (Function->getTemplateSpecializationKind() == TSK_ExplicitSpecialization &&
2407 !Function->getClassScopeSpecializationPattern())
2410 // Find the function body that we'll be substituting.
2411 const FunctionDecl *PatternDecl = Function->getTemplateInstantiationPattern();
2426 std::make_pair(Function, PointOfInstantiation));
2431 // a templated function definition.
2440 if (Function->getPrimaryTemplate())
2443 << Function->getPrimaryTemplate();
2447 << 1 << Function->getDeclName() << Function->getDeclContext();
2452 Function->setInvalidDecl();
2453 } else if (Function->getTemplateSpecializationKind()
2456 std::make_pair(Function, PointOfInstantiation));
2466 if (Function->getTemplateSpecializationKind()
2471 InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);
2487 ActOnStartOfFunctionDef(0, Function);
2490 // recorded, unless we're actually a member function within a local
2492 // scope (of the enclosing function).
2494 if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext()))
2499 // Introduce the instantiated function parameters into the local
2507 assert(FParamIdx < Function->getNumParams());
2508 ParmVarDecl *FunctionParam = Function->getParamDecl(I);
2517 for (unsigned NumFParams = Function->getNumParams();
2520 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
2528 Sema::ContextRAII savedContext(*this, Function);
2531 getTemplateInstantiationArgs(Function, 0, false, PatternDecl);
2534 ActOnFinishFunctionBody(Function, 0, /*IsInstantiation=*/true);
2536 SetDeclDefaulted(Function, PatternDecl->getLocation());
2541 InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
2545 // Instantiate the function body.
2549 Function->setInvalidDecl();
2551 ActOnFinishFunctionBody(Function, Body.get(),
2559 DeclGroupRef DG(Function);
2592 /// for the function, but it's close.
2860 // FIXME: It would be nice if ASTOwningVector had a release function.
3021 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
3022 return isInstantiationOf(cast<FunctionDecl>(D), Function);
3320 // Instantiate function definitions
3321 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
3322 PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(),
3323 "instantiating function definition");
3324 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
3326 InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true,