Lines Matching refs:FD
1151 FunctionDecl *FD = D->getAsFunction();
1152 if (!FD)
1157 assert(CurContext == FD->getLexicalParent() &&
1159 CurContext = FD;
1162 for (unsigned P = 0, NumParams = FD->getNumParams(); P < NumParams; ++P) {
1163 ParmVarDecl *Param = FD->getParamDecl(P);
1391 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
1392 if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
1395 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
1400 if (FD->isInlined() && !isMainFileLoc(*this, FD->getLocation()))
1404 if (FD->doesThisDeclarationHaveABody() &&
1405 Context.DeclMustBeEmitted(FD))
1434 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
1435 const FunctionDecl *First = FD->getFirstDecl();
1436 if (FD != First && ShouldWarnIfUnusedFileScopedDecl(First))
2271 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
2273 if (FD->isDefined(Def))
2301 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(New)) {
2303 S.CheckForFunctionRedefinition(FD, cast<FunctionDecl>(Def), &SkipBody);
2568 static bool canRedefineFunction(const FunctionDecl *FD,
2570 return ((FD->hasAttr<GNUInlineAttr>() || LangOpts.GNUInline) &&
2572 FD->isInlineSpecified() &&
2573 FD->getStorageClass() == SC_Extern);
4089 const auto *FD = dyn_cast<FieldDecl>(I);
4091 FD = IFD->getAnonField();
4092 if (FD && FD->hasInClassInitializer())
4093 return FD->getLocation();
4201 if (auto *FD = dyn_cast<FieldDecl>(Mem)) {
4205 assert(FD->getAccess() != AS_none);
4206 if (FD->getAccess() != AS_public) {
4207 Diag(FD->getLocation(), diag::err_anonymous_record_nonpublic_member)
4208 << Record->isUnion() << (FD->getAccess() == AS_protected);
4217 if (CheckNontrivialField(FD))
5495 auto *FD = dyn_cast<FunctionDecl>(OldDecl);
5496 if (FD && FD->getTemplatedKind() == FunctionDecl::TK_NonTemplate)
5528 else if (const auto *FD = dyn_cast<FunctionDecl>(NewDecl)) {
5529 IsInline = FD->isInlined();
5530 IsQualifiedFriend = FD->getQualifier() &&
5531 FD->getFriendObjectKind() == Decl::FOK_Declared;
5557 static bool isFunctionDefinitionDiscarded(Sema &S, FunctionDecl *FD) {
5561 if (!FD->isInlined()) return false;
5564 if (S.getLangOpts().CPlusPlus && !FD->hasAttr<GNUInlineAttr>())
5574 FD->setLazyBody(1);
5578 S.Context.GetGVALinkageForFunction(FD) == GVA_AvailableExternally;
5581 FD->setLazyBody(0);
5630 static bool shouldConsiderLinkage(const FunctionDecl *FD) {
5631 const DeclContext *DC = FD->getDeclContext()->getRedeclContext();
5690 if (const auto *FD = dyn_cast<FunctionDecl>(D))
5691 return FD->isExternC();
6450 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(Prev))
6451 Prev = FD->getFirstDecl();
6586 FunctionDecl *FD = getCurFunctionDecl();
6587 if (FD && !FD->hasAttr<OpenCLKernelAttr>()) {
6847 FunctionDecl *FD = dyn_cast<FunctionDecl>(*CDecl);
6849 if (FD && !FD->hasBody() &&
6850 hasSimilarParameters(Context, FD, OriginalFD, MismatchedParams)) {
6851 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
6908 FunctionDecl *FD = dyn_cast<FunctionDecl>(*Func);
6909 if (FD &&
6910 hasSimilarParameters(SemaRef.Context, FD, NewFD, MismatchedParams)) {
6915 NearMatches.push_back(std::make_pair(FD, ParamNum));
6933 FunctionDecl *FD = dyn_cast<FunctionDecl>(*CDecl);
6934 if (FD && !FD->hasBody() &&
6935 hasSimilarParameters(SemaRef.Context, FD, NewFD, MismatchedParams)) {
6936 Previous.addDecl(FD);
6996 FunctionDecl *FD = NearMatch->first;
6997 CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);
7003 ParmVarDecl *FDParam = FD->getParamDecl(Idx-1);
7005 if (Loc.isInvalid()) Loc = FD->getLocation();
7011 SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_const_match)
7012 << NewFDisConst << FD->getSourceRange().getEnd();
7014 SemaRef.Diag(FD->getLocation(),
7326 for (const auto *FD : RD->fields()) {
7327 QualType QT = FD->getType();
7337 VisitStack.push_back(FD);
7369 S.Diag(FD->getLocation(), diag::note_illegal_field_declared_here)
7594 // a friend yet, so 'isDependentContext' on the FD doesn't work.
8570 void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) {
8578 if (FD->getStorageClass() == SC_Static)
8582 if (FD->isInlineSpecified())
8592 if (FD->isConstexpr()) {
8595 FD->setConstexpr(false);
8599 Diag(FD->getLocation(), diag::err_opencl_no_main)
8600 << FD->hasAttr<OpenCLKernelAttr>();
8601 FD->setInvalidDecl();
8605 QualType T = FD->getType();
8616 FD->setHasImplicitReturnZero(true);
8618 Diag(FD->getTypeSpecStartLoc(), diag::ext_main_returns_nonint);
8619 SourceRange RTRange = FD->getReturnTypeSourceRange();
8631 FD->setHasImplicitReturnZero(true);
8634 SourceRange RTRange = FD->getReturnTypeSourceRange();
8635 Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint)
8638 FD->setInvalidDecl(true);
8647 assert(FD->getNumParams() == nparams);
8652 Diag(FD->getLocation(), diag::ext_variadic_main);
8664 Diag(FD->getLocation(), diag::err_main_surplus_args) << nparams;
8665 FD->setInvalidDecl(true);
8701 Diag(FD->getLocation(), diag::err_main_arg_wrong) << i << Expected[i];
8703 FD->setInvalidDecl(true);
8707 if (nparams == 1 && !FD->isInvalidDecl()) {
8708 Diag(FD->getLocation(), diag::warn_main_one_arg);
8711 if (!FD->isInvalidDecl() && FD->getDescribedFunctionTemplate()) {
8712 Diag(FD->getLocation(), diag::err_mainlike_template_decl) << FD;
8713 FD->setInvalidDecl();
8717 void Sema::CheckMSVCRTEntryPoint(FunctionDecl *FD) {
8718 QualType T = FD->getType();
8728 if (FD->getName() != "DllMain")
8729 FD->setHasImplicitReturnZero(true);
8731 if (!FD->isInvalidDecl() && FD->getDescribedFunctionTemplate()) {
8732 Diag(FD->getLocation(), diag::err_mainlike_template_decl) << FD;
8733 FD->setInvalidDecl();
8812 FieldDecl *FD = dyn_cast<FieldDecl>(ME->getMemberDecl());
8813 if (!FD)
8815 Fields.push_back(FD);
8816 if (FD->getType()->isReferenceType())
9008 if (FunctionDecl *FD = E->getDirectCallee()) {
9009 if (FD->isInStdNamespace() && FD->getIdentifier() &&
9010 FD->getIdentifier()->isStr("move")) {
10155 if (FunctionDecl *FD =
10157 if (Attr *A = getDLLAttr(FD)) {
10678 static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD,
10681 if (FD->isInvalidDecl())
10685 if (!FD->isGlobal())
10689 if (isa<CXXMethodDecl>(FD))
10693 if (FD->isMain())
10697 if (FD->isInlined())
10701 if (FD->getDescribedFunctionTemplate())
10705 if (FD->isFunctionTemplateSpecialization())
10709 if (FD->hasAttr<OpenCLKernelAttr>())
10713 if (FD->isDeleted())
10717 for (const FunctionDecl *Prev = FD->getPreviousDecl();
10725 if (FD->getNumParams() == 0)
10734 Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
10741 if (!FD->isDefined(Definition))
10756 makeMergedDefinitionVisible(TD, FD->getLocation());
10759 FD->getLocation());
10765 Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
10766 << FD->getDeclName() << getLangOpts().CPlusPlus;
10768 Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
10771 FD->setInvalidDecl();
10829 FunctionDecl *FD = nullptr;
10832 FD = FunTmpl->getTemplatedDecl();
10834 FD = cast<FunctionDecl>(D);
10837 if (!FD->isLateTemplateParsed()) {
10838 CheckForFunctionRedefinition(FD, nullptr, SkipBody);
10854 if (isGenericLambdaCallOperatorSpecialization(FD)) {
10865 if (unsigned BuiltinID = FD->getBuiltinID()) {
10868 Diag(FD->getLocation(), diag::err_builtin_definition) << FD;
10869 FD->setInvalidDecl();
10875 QualType ResultType = FD->getReturnType();
10877 !FD->isInvalidDecl() &&
10878 RequireCompleteType(FD->getLocation(), ResultType,
10880 FD->setInvalidDecl();
10883 PushDeclContext(FnBodyScope, FD);
10886 CheckParmsForFunctionDef(FD->param_begin(), FD->param_end(),
10890 for (auto Param : FD->params()) {
10891 Param->setOwningFunction(FD);
10905 I = FD->getDeclsInPrototypeScope().begin(),
10906 E = FD->getDeclsInPrototypeScope().end();
10939 if (const FunctionProtoType *FPT = FD->getType()->getAs<FunctionProtoType>())
10943 if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined() &&
10944 !FD->isTemplateInstantiation()) {
10945 assert(!FD->hasAttr<DLLExportAttr>());
10946 Diag(FD->getLocation(), diag::err_attribute_dllimport_function_definition);
10947 FD->setInvalidDecl();
10956 Diag(FD->getLocation(), diag::warn_function_def_in_objc_container);
11014 if (const FunctionDecl *FD = D->getAsFunction())
11015 if (FD->isConstexpr() || FD->getReturnType()->isUndeducedType())
11021 if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(Decl))
11022 FD->setHasSkippedBody();
11034 FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
11040 CheckCompletedCoroutineBody(FD, Body);
11042 if (FD) {
11043 FD->setBody(Body);
11045 if (getLangOpts().CPlusPlus14 && !FD->isInvalidDecl() && Body &&
11046 !FD->isDependentContext() && FD->getReturnType()->isUndeducedType()) {
11050 if (!FD->getReturnType()->getAs<AutoType>()) {
11052 << FD->getReturnType();
11053 FD->setInvalidDecl();
11056 TypeLoc ResultType = getReturnTypeLoc(FD);
11058 FD, SubstAutoType(ResultType.getType(), Context.VoidTy));
11060 } else if (getLangOpts().CPlusPlus11 && isLambdaCallOperator(FD)) {
11073 FD->getType()->getAs<FunctionProtoType>();
11074 FD->setType(Context.getFunctionType(RetType, Proto->getParamTypes(),
11082 if (!FD->isFirstDecl() && FD->getPreviousDecl()->isUsed()) {
11083 if (!FD->isExternallyVisible())
11084 UndefinedButUsed.erase(FD);
11085 else if (FD->isInlined() &&
11087 (!FD->getPreviousDecl()->hasAttr<GNUInlineAttr>()))
11088 UndefinedButUsed.erase(FD);
11093 if (FD->hasImplicitReturnZero() || FD->hasAttr<NakedAttr>())
11098 if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
11099 Diag(FD->getLocation(), diag::ext_pure_function_definition);
11101 if (!FD->isInvalidDecl()) {
11103 if (!FD->isDeleted() && !FD->isDefaulted())
11104 DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
11105 DiagnoseSizeOfParametersAndReturnValue(FD->param_begin(), FD->param_end(),
11106 FD->getReturnType(), FD);
11109 if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(FD))
11110 MarkVTableUsed(FD->getLocation(), Constructor->getParent());
11111 else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(FD))
11112 MarkVTableUsed(FD->getLocation(), Destructor->getParent());
11117 if (getLangOpts().CPlusPlus && FD->getReturnType()->isRecordType() &&
11118 !FD->isDependentContext())
11128 if (ShouldWarnAboutMissingPrototype(FD, PossibleZeroParamPrototype)) {
11129 Diag(FD->getLocation(), diag::warn_missing_prototype) << FD;
11146 if (auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
11153 if (FD->isInlined() &&
11165 MarkVTableUsed(FD->getLocation(), MD->getParent(), true);
11170 assert((FD == getCurFunctionDecl() || getCurLambda()->CallOperator == FD) &&
11231 if (Body && (!FD || !FD->isDefaulted())) {
11235 if (FD && isa<CXXConstructorDecl>(FD) && isa<CXXTryStmt>(Body))
11265 if (!IsInstantiation && FD && FD->isConstexpr() && !FD->isInvalidDecl() &&
11266 (!CheckConstexprFunctionDecl(FD) ||
11267 !CheckConstexprFunctionBody(FD, Body)))
11268 FD->setInvalidDecl();
11270 if (FD && FD->hasAttr<NakedAttr>()) {
11274 Diag(FD->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
11275 FD->setInvalidDecl();
11397 FunctionDecl *FD = cast<FunctionDecl>(ActOnDeclarator(TUScope, D));
11398 FD->setImplicit();
11402 AddKnownFunctionAttributes(FD);
11404 return FD;
11416 void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
11417 if (FD->isInvalidDecl())
11422 if (unsigned BuiltinID = FD->getBuiltinID()) {
11427 if (!FD->hasAttr<FormatAttr>()) {
11429 unsigned int NumParams = FD->getNumParams();
11431 FD->getParamDecl(FormatIdx)->getType()->isObjCObjectPointerType())
11433 FD->addAttr(FormatAttr::CreateImplicit(Context,
11437 FD->getLocation()));
11442 if (!FD->hasAttr<FormatAttr>())
11443 FD->addAttr(FormatAttr::CreateImplicit(Context,
11447 FD->getLocation()));
11455 if (!FD->hasAttr<ConstAttr>())
11456 FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
11460 !FD->hasAttr<ReturnsTwiceAttr>())
11461 FD->addAttr(ReturnsTwiceAttr::CreateImplicit(Context,
11462 FD->getLocation()));
11463 if (Context.BuiltinInfo.isNoThrow(BuiltinID) && !FD->hasAttr<NoThrowAttr>())
11464 FD->addAttr(NoThrowAttr::CreateImplicit(Context, FD->getLocation()));
11465 if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->hasAttr<ConstAttr>())
11466 FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
11469 !FD->hasAttr<CUDADeviceAttr>() && !FD->hasAttr<CUDAHostAttr>()) {
11475 FD->addAttr(CUDADeviceAttr::CreateImplicit(Context, FD->getLocation()));
11477 FD->addAttr(CUDAHostAttr::CreateImplicit(Context, FD->getLocation()));
11481 IdentifierInfo *Name = FD->getIdentifier();
11485 FD->getDeclContext()->isTranslationUnit()) ||
11486 (isa<LinkageSpecDecl>(FD->getDeclContext()) &&
11487 cast<LinkageSpecDecl>(FD->getDeclContext())->getLanguage() ==
11497 if (!FD->hasAttr<FormatAttr>())
11498 FD->addAttr(FormatAttr::CreateImplicit(Context,
11501 FD->getLocation()));
11507 if (!FD->hasAttr<FormatArgAttr>())
11508 FD->addAttr(FormatArgAttr::CreateImplicit(Context, 1,
11509 FD->getLocation()));
13174 bool Sema::CheckNontrivialField(FieldDecl *FD) {
13175 assert(FD);
13178 if (FD->isInvalidDecl() || FD->getType()->isDependentType())
13181 QualType EltTy = Context.getBaseElementType(FD->getType());
13212 SourceLocation Loc = FD->getLocation();
13214 if (!FD->hasAttr<UnavailableAttr>())
13215 FD->addAttr(UnavailableAttr::CreateImplicit(Context, "",
13221 Diag(FD->getLocation(), getLangOpts().CPlusPlus11 ?
13224 << FD->getParent()->isUnion() << FD->getDeclName() << member;
13438 FieldDecl *FD = cast<FieldDecl>(*i);
13441 const Type *FDTy = FD->getType().getTypePtr();
13443 if (!FD->isAnonymousStructOrUnion()) {
13445 RecFields.push_back(FD);
13450 if (FD->isInvalidDecl()) {
13467 Diag(FD->getLocation(), diag::err_field_declared_as_function)
13468 << FD->getDeclName();
13469 FD->setInvalidDecl();
13498 Diag(FD->getLocation(), DiagID) << FD->getDeclName()
13507 Diag(FD->getLocation(), diag::err_flexible_array_virtual_base)
13508 << FD->getDeclName() << Record->getTagKind();
13510 Diag(FD->getLocation(), diag::ext_c99_flexible_array_member)
13511 << FD->getDeclName() << Record->getTagKind();
13518 QualType BaseElem = Context.getBaseElementType(FD->getType());
13520 Diag(FD->getLocation(), diag::err_flexible_array_has_nontrivial_dtor)
13521 << FD->getDeclName() << FD->getType();
13522 FD->setInvalidDecl();
13529 RequireCompleteType(FD->getLocation(), FD->getType(),
13532 FD->setInvalidDecl();
13545 Diag(FD->getLocation(), diag::ext_variable_sized_type_in_struct)
13546 << FD->getDeclName() << FD->getType();
13550 Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
13551 << FD->getDeclName();
13556 RequireNonAbstractType(FD->getLocation(), FD->getType(),
13560 FD->setInvalidDecl();
13568 Diag(FD->getLocation(), diag::err_statically_allocated_object)
13569 << FixItHint::CreateInsertion(FD->getLocation(), "*");
13570 QualType T = Context.getObjCObjectPointerType(FD->getType());
13571 FD->setType(T);
13579 QualType T = FD->getType();
13582 SourceLocation loc = FD->getLocation();
13584 if (!FD->hasAttr<UnavailableAttr>()) {
13585 FD->addAttr(UnavailableAttr::CreateImplicit(Context, "",
13589 Diag(FD->getLocation(), diag::err_arc_objc_object_in_tag)
13597 if (FD->getType()->isObjCObjectPointerType() ||
13598 FD->getType().isObjCGCStrong())
13600 else if (Context.getAsArrayType(FD->getType())) {
13601 QualType BaseType = Context.getBaseElementType(FD->getType());
13610 if (Record && FD->getType().isVolatileQualified())
13613 if (FD->getIdentifier())