Home | History | Annotate | Download | only in Sema

Lines Matching defs:Function

388       //   If a declaration acquires a function type through a type
391 // function declarator to have function type, the program is
474 // If a declaration acquires a function type through a type
477 // function declarator to have function type, the program is
724 // If the enumeration is within a function or method, record the enum
1050 // Create a local instantiation scope for this function template, which
1052 // merged with the local instantiation scope for the function template
1073 // Link the instantiated function template declaration to the function
1130 // If the original function was part of a friend declaration,
1146 /// \brief Adjust the given function type for an instantiation of the
1147 /// given declaration, to cope with modifications to the function's type that
1169 /// don't make it here. This function serves two purposes:
1170 /// 1) instantiating function templates
1172 /// FIXME: preserve function definitions in case #2
1175 // Check whether there is already a function template specialization for
1186 // If we already have a function template specialization, return it.
1217 // If we're instantiating a local function declaration, put the result
1232 FunctionDecl *Function =
1238 Function->setRangeEnd(D->getSourceRange().getEnd());
1241 Function->setImplicitlyInline();
1244 Function->setQualifierInfo(QualifierLoc);
1252 Function->setLexicalDeclContext(LexicalDC);
1257 Params[P]->setOwningFunction(Function);
1258 Function->setParams(Params);
1262 // Our resulting instantiation is actually a function template, since we
1272 // We are instantiating the friend function template "f" within X<int>,
1273 // which means substituting int for T, but leaving "f" as a friend function
1275 // Build the function template itself.
1277 Function->getLocation(),
1278 Function->getDeclName(),
1279 TemplateParams, Function);
1280 Function->setDescribedFunctionTemplate(FunctionTemplate);
1291 // Record this function template specialization.
1293 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1303 // friend function declaration, however that would require finding all the
1305 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1308 if (InitFunctionInstantiation(Function, D))
1309 Function->setInvalidDecl();
1313 LookupResult Previous(SemaRef, Function->getDeclName(), SourceLocation(),
1321 Function->setObjectOfFriendDecl();
1340 if (SemaRef.CheckFunctionTemplateSpecialization(Function,
1343 Function->setInvalidDecl();
1361 SemaRef.CheckFunctionDeclaration(/*Scope*/ 0, Function, Previous,
1366 : Function);
1368 // If the original function was part of a friend declaration,
1376 // C++98 [temp.friend]p5: When a function is defined in a friend function
1377 // declaration in a class template, the function is defined at each
1378 // instantiation of the class template. The function is defined even if it
1380 // C++11 [temp.friend]p4: When a function is defined in a friend function
1381 // declaration in a class template, the function is instantiated when the
1382 // function is odr-used.
1385 // redefinition, but don't instantiate the function.
1389 Function->getLocation())
1392 // Check for a function body.
1394 if (Function->isDefined(Definition) &&
1396 SemaRef.Diag(Function->getLocation(),
1399 diag::err_redefinition) << Function->getDeclName();
1402 Function->setInvalidDecl();
1405 // a similar friend function.
1406 else for (FunctionDecl::redecl_iterator R = Function->redecls_begin(),
1407 REnd = Function->redecls_end();
1409 if (*R == Function)
1416 = Function->getMemberSpecializationInfo()) {
1421 std::make_pair(Function, Loc));
1431 SemaRef.Diag(Function->getLocation(),
1435 << Function->getDeclName();
1438 Function->setInvalidDecl();
1446 if (Function->isOverloadedOperator() && !DC->isRecord() &&
1451 return Function;
1460 // We are creating a function template specialization from a function
1461 // template. Check whether there is already a function template
1471 // If we already have a function template specialization, return it.
1550 // If we're instantiating a specialization of a function template, our
1551 // "inherited constructor" will actually itself be a function template.
1602 // Our resulting instantiation is actually a function template, since we
1613 // substituting int for T, but leaving "f" as a member function template.
1614 // Build the function template itself.
1626 // Record this function template specialization.
1634 // Record that this is an instantiation of a member function.
1638 // If we are instantiating a member function defined
1692 // If a function is defined as defaulted or deleted, mark it as such now.
1698 // If there's a function template, let our caller handle it.
2053 // only if this is not a function or method.
2677 assert(OldTInfo && "substituting function without type source info");
2729 // The function type itself was not dependent and therefore no
2731 // the function parameters themselves.
2750 // If the type of this function, after ignoring parentheses, is not
2751 // *directly* a function type, then we're instantiating a function that
2770 /// Introduce the instantiated function parameters into the local
2773 static void addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function,
2782 assert(FParamIdx < Function->getNumParams());
2783 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
2797 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
2811 // If a declaration declares a member function or member function
2814 // and the end of the function-definition, member-declarator, or
2825 // The function has an exception specification or a "noreturn"
2917 // Rebuild the function type
2920 assert(NewProto && "Template instantiation without function prototype?");
2966 /// \brief Initializes the common fields of an instantiation function
2977 // or deduced template arguments into a function template and we reach this
2979 // to keeping the new function template specialization. We therefore
2980 // convert the active template instantiation for the function template
2981 // into a template instantiation for this specific function template
2991 "Deduction from the wrong function template?");
2999 assert(Proto && "Function template without prototype?");
3017 // Mark the function has having an uninstantiated exception specification.
3020 assert(NewProto && "Template instantiation without function prototype?");
3061 /// \brief Instantiate the definition of the given function from its
3066 /// for the function, but it's close.
3068 /// \param Function the already-instantiated declaration of a
3069 /// function template specialization or member function of a class template
3076 /// instantiation where the body of the function is required. Complain if
3079 FunctionDecl *Function,
3082 if (Function->isInvalidDecl() || Function->isDefined())
3087 if (Function->getTemplateSpecializationKind() == TSK_ExplicitSpecialization &&
3088 !Function->getClassScopeSpecializationPattern())
3091 // Find the function body that we'll be substituting.
3092 const FunctionDecl *PatternDecl = Function->getTemplateInstantiationPattern();
3107 std::make_pair(Function, PointOfInstantiation));
3112 // a templated function definition.
3121 if (Function->getPrimaryTemplate())
3124 << Function->getPrimaryTemplate();
3128 << 1 << Function->getDeclName() << Function->getDeclContext();
3133 Function->setInvalidDecl();
3134 } else if (Function->getTemplateSpecializationKind()
3137 std::make_pair(Function, PointOfInstantiation));
3148 if (Function->getTemplateSpecializationKind()
3155 Function->setImplicitlyInline();
3157 InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);
3162 Function->setInnerLocStart(PatternDecl->getInnerLocStart());
3182 // recorded, unless we're actually a member function within a local
3184 // scope (of the enclosing function).
3186 if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext()))
3192 SetDeclDefaulted(Function, PatternDecl->getLocation());
3194 ActOnStartOfFunctionDef(0, Function);
3198 Sema::ContextRAII savedContext(*this, Function);
3201 getTemplateInstantiationArgs(Function, 0, false, PatternDecl);
3203 addInstantiatedParametersToScope(*this, Function, PatternDecl, Scope,
3209 InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
3213 // Instantiate the function body.
3217 Function->setInvalidDecl();
3219 ActOnFinishFunctionBody(Function, Body.get(),
3227 DeclGroupRef DG(Function);
3423 /// for the function, but it's close.
3591 // the primary template. (Note that unlike function declarations, variable
3936 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
3937 return isInstantiationOf(cast<FunctionDecl>(D), Function);
4245 // Instantiate function definitions
4246 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
4247 PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(),
4248 "instantiating function definition");
4249 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
4251 InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true,