Home | History | Annotate | Download | only in Sema

Lines Matching defs:Function

407 /// result of this function.
674 // If a declaration acquires a function type through a type
677 // function declarator to have function type, the program is
760 // If a declaration acquires a function type through a type
763 // function declarator to have function type, the program is
1014 // If the enumeration is within a function or method, record the enum
1326 // Create a local instantiation scope for this function template, which
1328 // merged with the local instantiation scope for the function template
1349 // Link the instantiated function template declaration to the function
1406 // If the original function was part of a friend declaration,
1457 /// \brief Adjust the given function type for an instantiation of the
1458 /// given declaration, to cope with modifications to the function's type that
1480 /// don't make it here. This function serves two purposes:
1481 /// 1) instantiating function templates
1485 // Check whether there is already a function template specialization for
1495 // If we already have a function template specialization, return it.
1526 // If we're instantiating a local function declaration, put the result
1543 FunctionDecl *Function =
1549 Function->setRangeEnd(D->getSourceRange().getEnd());
1552 Function->setImplicitlyInline();
1555 Function->setQualifierInfo(QualifierLoc);
1558 Function->setLocalExternDecl();
1566 Function->setLexicalDeclContext(LexicalDC);
1571 Params[P]->setOwningFunction(Function);
1572 Function->setParams(Params);
1576 // Our resulting instantiation is actually a function template, since we
1586 // We are instantiating the friend function template "f" within X<int>,
1587 // which means substituting int for T, but leaving "f" as a friend function
1589 // Build the function template itself.
1591 Function->getLocation(),
1592 Function->getDeclName(),
1593 TemplateParams, Function);
1594 Function->setDescribedFunctionTemplate(FunctionTemplate);
1605 // Record this function template specialization.
1607 Function->setFunctionTemplateSpecialization(FunctionTemplate,
1616 // friend function declaration, however that would require finding all the
1618 Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
1621 if (InitFunctionInstantiation(Function, D))
1622 Function->setInvalidDecl();
1627 SemaRef, Function->getDeclName(), SourceLocation(),
1637 Function->setObjectOfFriendDecl();
1656 if (SemaRef.CheckFunctionTemplateSpecialization(Function,
1659 Function->setInvalidDecl();
1677 SemaRef.CheckFunctionDeclaration(/*Scope*/ nullptr, Function, Previous,
1682 : Function);
1684 // If the original function was part of a friend declaration,
1693 // When a function is defined in a friend function declaration in a class
1694 // template, the function is instantiated when the function is odr-used.
1696 // apply to non-template function declarations and definitions also apply
1699 // Check for a function body.
1701 if (Function->isDefined(Definition) &&
1703 SemaRef.Diag(Function->getLocation(), diag::err_redefinition)
1704 << Function->getDeclName();
1708 // a similar friend function.
1709 else for (auto R : Function->redecls()) {
1710 if (R == Function)
1713 // If some prior declaration of this function has been used, we need
1717 Function->getMemberSpecializationInfo()) {
1722 std::make_pair(Function, Loc));
1728 // If some prior declaration of this function was a friend with an
1734 SemaRef.Diag(Function->getLocation(), diag::err_redefinition)
1735 << Function->getDeclName();
1745 if (Function->isLocalExternDecl() && !Function->getPreviousDecl())
1748 if (Function->isOverloadedOperator() && !DC->isRecord() &&
1753 return Function;
1762 // We are creating a function template specialization from a function
1763 // template. Check whether there is already a function template
1771 // If we already have a function template specialization, return it.
1872 // Our resulting instantiation is actually a function template, since we
1883 // substituting int for T, but leaving "f" as a member function template.
1884 // Build the function template itself.
1896 // Record this function template specialization.
1903 // Record that this is an instantiation of a member function.
1907 // If we are instantiating a member function defined
1961 // If a function is defined as defaulted or deleted, mark it as such now.
1967 // If there's a function template, let our caller handle it.
2341 // only if this is not a function or method.
3192 assert(OldTInfo && "substituting function without type source info");
3244 // The function type itself was not dependent and therefore no
3246 // the function parameters themselves.
3266 // If the type of this function, after ignoring parentheses, is not
3267 // *directly* a function type, then we're instantiating a function that
3287 /// Introduce the instantiated function parameters into the local
3290 static bool addInstantiatedParametersToScope(Sema &S, FunctionDecl *Function,
3299 assert(FParamIdx < Function->getNumParams());
3300 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
3331 ParmVarDecl *FunctionParam = Function->getParamDecl(FParamIdx);
3385 /// \brief Initializes the common fields of an instantiation function
3400 // or deduced template arguments into a function template and we reach this
3402 // to keeping the new function template specialization. We therefore
3403 // convert the active template instantiation for the function template
3404 // into a template instantiation for this specific function template
3414 "Deduction from the wrong function template?");
3422 assert(Proto && "Function template without prototype?");
3430 // containing function.
3443 // Mark the function has having an uninstantiated exception specification.
3446 assert(NewProto && "Template instantiation without function prototype?");
3487 /// \brief Instantiate the definition of the given function from its
3492 /// for the function, but it's close.
3494 /// \param Function the already-instantiated declaration of a
3495 /// function template specialization or member function of a class template
3502 /// instantiation where the body of the function is required. Complain if
3505 FunctionDecl *Function,
3509 if (Function->isInvalidDecl() || Function->isDefined())
3514 if (Function->getTemplateSpecializationKind() == TSK_ExplicitSpecialization &&
3515 !Function->getClassScopeSpecializationPattern())
3518 // Find the function body that we'll be substituting.
3519 const FunctionDecl *PatternDecl = Function->getTemplateInstantiationPattern();
3534 std::make_pair(Function, PointOfInstantiation));
3549 // a templated function definition.
3568 if (Function->getPrimaryTemplate())
3571 << Function->getPrimaryTemplate();
3575 << 1 << Function->getDeclName() << Function->getDeclContext();
3580 Function->setInvalidDecl();
3581 } else if (Function->getTemplateSpecializationKind()
3585 std::make_pair(Function, PointOfInstantiation));
3586 } else if (Function->getTemplateSpecializationKind()
3590 << Function;
3594 << Function;
3606 if (Function->getTemplateSpecializationKind() ==
3613 // Function, and all later redeclarations of it (from imported modules,
3615 for (auto *D = Function->getMostRecentDecl(); /**/;
3618 if (D == Function)
3623 InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);
3626 PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(),
3627 "instantiating function definition");
3630 Function->setInnerLocStart(PatternDecl->getInnerLocStart());
3636 // recorded, unless we're actually a member function within a local
3638 // scope (of the enclosing function).
3640 if (CXXRecordDecl *Rec = dyn_cast<CXXRecordDecl>(Function->getDeclContext()))
3646 SetDeclDefaulted(Function, PatternDecl->getLocation());
3649 getTemplateInstantiationArgs(Function, nullptr, false, PatternDecl);
3655 SubstQualifier(*this, PatternDecl, Function, TemplateArgs);
3657 ActOnStartOfFunctionDef(nullptr, Function);
3661 Sema::ContextRAII savedContext(*this, Function);
3663 if (addInstantiatedParametersToScope(*this, Function, PatternDecl, Scope,
3670 InstantiateMemInitializers(cast<CXXConstructorDecl>(Function), Ctor,
3674 // Instantiate the function body.
3678 Function->setInvalidDecl();
3680 ActOnFinishFunctionBody(Function, Body.get(),
3686 Listener->FunctionDefinitionInstantiated(Function);
3691 DeclGroupRef DG(Function);
3792 // instantiation belongs lexically to the containing function.
3936 /// for the function, but it's close.
4528 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Other))
4529 return isInstantiationOf(cast<FunctionDecl>(D), Function);
4668 // Normally this function only searches for already instantiated declaration
4875 // Instantiate function definitions
4876 if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first)) {
4877 bool DefinitionRequired = Function->getTemplateSpecializationKind() ==
4879 InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function, true,