Home | History | Annotate | Download | only in Sema

Lines Matching refs:Function

459       //   If a declaration acquires a function type through a type
462 // function declarator to have function type, the program is
748 // If the enumeration is within a function or method, record the enum
978 // Create a local instantiation scope for this function template, which
980 // merged with the local instantiation scope for the function template
1001 // Link the instantiated function template declaration to the function
1058 // If the original function was part of a friend declaration,
1074 /// \brief Adjust the given function type for an instantiation of the
1075 /// given declaration, to cope with modifications to the function's type that
1099 /// don't make it here. This function serves two purposes:
1100 /// 1) instantiating function templates
1102 /// FIXME: preserve function definitions in case #2
1105 // Check whether there is already a function template specialization for
1117 // If we already have a function template specialization, return it.
1148 // If we're instantiating a local function declaration, put the result
1163 FunctionDecl *Function =
1171 Function->setImplicitlyInline();
1174 Function->setQualifierInfo(QualifierLoc);
1182 Function->setLexicalDeclContext(LexicalDC);
1185 if (isa<FunctionProtoType>(Function->getType().IgnoreParens())) {
1189 Params[P]->setOwningFunction(Function);
1191 // Since we were instantiated via a typedef of a function type, create
1194 = Function->getType()->getAs<FunctionProtoType>();
1195 assert(Proto && "No function prototype in template instantiation?");
1199 = SemaRef.BuildParmVarDeclForTypedef(Function, Function->getLocation(),
1205 Function->setParams(Params);
1209 // Our resulting instantiation is actually a function template, since we
1219 // We are instantiating the friend function template "f" within X<int>,
1220 // which means substituting int for T, but leaving "f" as a friend function
1222 // Build the function template itself.
1224 Function->getLocation(),
1225 Function->getDeclName(),
1226 TemplateParams, Function);
1227 Function->setDescribedFunctionTemplate(FunctionTemplate);
1238 // Record this function template specialization.
1241 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1251 // friend function declaration, however that would require finding all the
1253 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1256 if (InitFunctionInstantiation(Function, D))
1257 Function->setInvalidDecl();
1261 LookupResult Previous(SemaRef, Function->getDeclName(), SourceLocation(),
1269 Function->setObjectOfFriendDecl(/*HasPrevious*/ true);
1288 if (SemaRef.CheckFunctionTemplateSpecialization(Function,
1291 Function->setInvalidDecl();
1309 SemaRef.CheckFunctionDeclaration(/*Scope*/ 0, Function, Previous,
1314 : Function);
1316 // If the original function was part of a friend declaration,
1323 PrevDecl = Function->getPreviousDecl();
1330 // C++98 [temp.friend]p5: When a function is defined in a friend function
1331 // declaration in a class template, the function is defined at each
1332 // instantiation of the class template. The function is defined even if it
1334 // C++11 [temp.friend]p4: When a function is defined in a friend function
1335 // declaration in a class template, the function is instantiated when the
1336 // function is odr-used.
1339 // redefinition, but don't instantiate the function.
1343 Function->getLocation())
1346 // Check for a function body.
1348 if (Function->isDefined(Definition) &&
1350 SemaRef.Diag(Function->getLocation(),
1353 diag::err_redefinition) << Function->getDeclName();
1356 Function->setInvalidDecl();
1359 // a similar friend function.
1360 else for (FunctionDecl::redecl_iterator R = Function->redecls_begin(),
1361 REnd = Function->redecls_end();
1363 if (*R == Function)
1370 = Function->getMemberSpecializationInfo()) {
1375 std::make_pair(Function, Loc));
1385 SemaRef.Diag(Function->getLocation(),
1389 << Function->getDeclName();
1392 Function->setInvalidDecl();
1400 if (Function->isOverloadedOperator() && !DC->isRecord() &&
1405 return Function;
1414 // We are creating a function template specialization from a function
1415 // template. Check whether there is already a function template
1425 // If we already have a function template specialization, return it.
1461 // \brief If the type of this function, after ignoring parentheses,
1462 // is not *directly* a function type, then we're instantiating a function
1545 // Our resulting instantiation is actually a function template, since we
1556 // substituting int for T, but leaving "f" as a member function template.
1557 // Build the function template itself.
1569 // Record this function template specialization.
1578 // Record that this is an instantiation of a member function.
1582 // If we are instantiating a member function defined
1636 // If a function is defined as defaulted or deleted, mark it as such now.
1642 // If there's a function template, let our caller handle it.
1997 // only if this is not a function or method.
2357 assert(OldTInfo && "substituting function without type source info");
2411 // The function type itself was not dependent and therefore no
2413 // the function parameters themselves.
2428 /// Introduce the instantiated function parameters into the local
2431 static void addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function,
2440 assert(FParamIdx < Function->getNumParams());
2441 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
2455 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
2469 // If a declaration declares a member function or member function
2472 // and the end of the function-definition, member-declarator, or
2483 // The function has an exception specification or a "noreturn"
2576 // Rebuild the function type
2579 assert(NewProto && "Template instantiation without function prototype?");
2629 /// \brief Initializes the common fields of an instantiation function
2640 // or deduced template arguments into a function template and we reach this
2642 // to keeping the new function template specialization. We therefore
2643 // convert the active template instantiation for the function template
2644 // into a template instantiation for this specific function template
2654 "Deduction from the wrong function template?");
2662 assert(Proto && "Function template without prototype?");
2679 // Mark the function has having an uninstantiated exception specification.
2682 assert(NewProto && "Template instantiation without function prototype?");
2726 /// \brief Instantiate the definition of the given function from its
2731 /// for the function, but it's close.
2733 /// \param Function the already-instantiated declaration of a
2734 /// function template specialization or member function of a class template
2741 /// instantiation where the body of the function is required. Complain if
2744 FunctionDecl *Function,
2747 if (Function->isInvalidDecl() || Function->isDefined())
2752 if (Function->getTemplateSpecializationKind() == TSK_ExplicitSpecialization &&
2753 !Function->getClassScopeSpecializationPattern())
2756 // Find the function body that we'll be substituting.
2757 const FunctionDecl *PatternDecl = Function->getTemplateInstantiationPattern();
2772 std::make_pair(Function, PointOfInstantiation));
2777 // a templated function definition.
2786 if (Function->getPrimaryTemplate())
2789 << Function->getPrimaryTemplate();
2793 << 1 << Function->getDeclName() << Function->getDeclContext();
2798 Function->setInvalidDecl();
2799 } else if (Function->getTemplateSpecializationKind()
2802 std::make_pair(Function, PointOfInstantiation));
2812 if (Function->getTemplateSpecializationKind()
2818 Function->setImplicitlyInline();
2820 InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);
2825 Function->setInnerLocStart(PatternDecl->getInnerLocStart());
2841 // recorded, unless we're actually a member function within a local
2843 // scope (of the enclosing function).
2845 if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext()))
2851 SetDeclDefaulted(Function, PatternDecl->getLocation());
2853 ActOnStartOfFunctionDef(0, Function);
2857 Sema::ContextRAII savedContext(*this, Function);
2860 getTemplateInstantiationArgs(Function, 0, false, PatternDecl);
2862 addInstantiatedParametersToScope(*this, Function, PatternDecl, Scope,
2868 InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
2872 // Instantiate the function body.
2876 Function->setInvalidDecl();
2878 ActOnFinishFunctionBody(Function, Body.get(),
2886 DeclGroupRef DG(Function);
2919 /// for the function, but it's close.
3351 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
3352 return isInstantiationOf(cast<FunctionDecl>(D), Function);
3640 // Instantiate function definitions
3641 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
3642 PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(),
3643 "instantiating function definition");
3644 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
3646 InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true,