Home | History | Annotate | Download | only in Sema

Lines Matching defs:FD

984   FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
988 FD = TFD->getTemplatedDecl();
990 if (!FD)
995 assert(CurContext == FD->getLexicalParent() &&
997 CurContext = FD;
1000 for (unsigned P = 0, NumParams = FD->getNumParams(); P < NumParams; ++P) {
1001 ParmVarDecl *Param = FD->getParamDecl(P);
1224 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
1225 if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
1228 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
1236 if (FD->getCanonicalDecl()->getStorageClass() == SC_Static &&
1237 FD->isInlineSpecified())
1241 if (FD->doesThisDeclarationHaveABody() &&
1242 Context.DeclMustBeEmitted(FD))
1272 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
1273 const FunctionDecl *First = FD->getFirstDeclaration();
1274 if (FD != First && ShouldWarnIfUnusedFileScopedDecl(First))
2032 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
2034 if (FD->hasBody(Def))
2234 static bool canRedefineFunction(const FunctionDecl *FD,
2236 return ((FD->hasAttr<GNUInlineAttr>() || LangOpts.GNUInline) &&
2238 FD->isInlineSpecified() &&
2239 FD->getStorageClass() == SC_Extern);
3517 if (FieldDecl *FD = dyn_cast<FieldDecl>(*Mem)) {
3521 assert(FD->getAccess() != AS_none);
3522 if (FD->getAccess() != AS_public) {
3523 Diag(FD->getLocation(), diag::err_anonymous_record_nonpublic_member)
3524 << (int)Record->isUnion() << (int)(FD->getAccess() == AS_protected);
3533 if (CheckNontrivialField(FD))
4698 static bool isFunctionDefinitionDiscarded(Sema &S, FunctionDecl *FD) {
4702 if (!FD->isInlined()) return false;
4705 if (S.getLangOpts().CPlusPlus && !FD->hasAttr<GNUInlineAttr>())
4715 FD->setLazyBody(1);
4718 bool isC99Inline = (S.Context.GetGVALinkageForFunction(FD) == GVA_C99Inline);
4721 FD->setLazyBody(0);
4764 static bool shouldConsiderLinkage(const FunctionDecl *FD) {
4765 const DeclContext *DC = FD->getDeclContext()->getRedeclContext();
5499 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(Prev))
5500 Prev = FD->getFirstDeclaration();
5883 FunctionDecl *FD = dyn_cast<FunctionDecl>(*CDecl);
5885 if (FD && !FD->hasBody() &&
5886 hasSimilarParameters(Context, FD, OriginalFD, MismatchedParams)) {
5887 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
5943 FunctionDecl *FD = dyn_cast<FunctionDecl>(*Func);
5944 if (FD &&
5945 hasSimilarParameters(SemaRef.Context, FD, NewFD, MismatchedParams)) {
5950 NearMatches.push_back(std::make_pair(FD, ParamNum));
5968 FunctionDecl *FD = dyn_cast<FunctionDecl>(*CDecl);
5969 if (FD && !FD->hasBody() &&
5970 hasSimilarParameters(SemaRef.Context, FD, NewFD, MismatchedParams)) {
5971 Previous.addDecl(FD);
5995 if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*Func))
5996 NearMatches.push_back(std::make_pair(FD, 0));
6033 FunctionDecl *FD = NearMatch->first;
6035 if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD))
6039 ParmVarDecl *FDParam = FD->getParamDecl(Idx-1);
6041 if (Loc.isInvalid()) Loc = FD->getLocation();
6045 SemaRef.Diag(FD->getLocation(), diag::note_previous_decl)
6048 SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_const_match)
6049 << NewFDisConst << FD->getSourceRange().getEnd();
6051 SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_match);
6376 const FieldDecl *FD = *I;
6377 QualType QT = FD->getType();
6387 VisitStack.push_back(FD);
6416 S.Diag(FD->getLocation(), diag::note_illegal_field_declared_here)
7497 static SourceRange getResultSourceRange(const FunctionDecl *FD) {
7498 const TypeSourceInfo *TSI = FD->getTypeSourceInfo();
7514 FD, const DeclSpec& DS) {
7521 if (FD->getStorageClass() == SC_Static)
7525 if (FD->isInlineSpecified())
7536 if (FD->isConstexpr()) {
7539 FD->setConstexpr(false);
7542 QualType T = FD->getType();
7551 FD->setHasImplicitReturnZero(true);
7557 Diag(FD->getTypeSpecStartLoc(), diag::ext_main_returns_nonint);
7559 SourceRange ResultRange = getResultSourceRange(FD);
7566 SourceRange ResultRange = getResultSourceRange(FD);
7568 Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint)
7571 Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint);
7573 FD->setInvalidDecl(true);
7581 assert(FD->getNumParams() == nparams);
7592 Diag(FD->getLocation(), diag::err_main_surplus_args) << nparams;
7593 FD->setInvalidDecl(true);
7629 Diag(FD->getLocation(), diag::err_main_arg_wrong) << i << Expected[i];
7631 FD->setInvalidDecl(true);
7635 if (nparams == 1 && !FD->isInvalidDecl()) {
7636 Diag(FD->getLocation(), diag::warn_main_one_arg);
7639 if (!FD->isInvalidDecl() && FD->getDescribedFunctionTemplate()) {
7640 Diag(FD->getLocation(), diag::err_main_template_decl);
7641 FD->setInvalidDecl();
9140 static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD,
9143 if (FD->isInvalidDecl())
9147 if (!FD->isGlobal())
9151 if (isa<CXXMethodDecl>(FD))
9155 if (FD->isMain())
9159 if (FD->isInlined())
9163 if (FD->getDescribedFunctionTemplate())
9167 if (FD->isFunctionTemplateSpecialization())
9171 if (FD->hasAttr<OpenCLKernelAttr>())
9175 for (const FunctionDecl *Prev = FD->getPreviousDecl();
9183 if (FD->getNumParams() == 0)
9191 void Sema::CheckForFunctionRedefinition(FunctionDecl *FD) {
9195 if (FD->isDefined(Definition) &&
9199 Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
9200 << FD->getDeclName() << getLangOpts().CPlusPlus;
9202 Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
9204 FD->setInvalidDecl();
9214 FunctionDecl *FD = 0;
9217 FD = FunTmpl->getTemplatedDecl();
9219 FD = cast<FunctionDecl>(D);
9225 if (!FD->isLateTemplateParsed())
9226 CheckForFunctionRedefinition(FD);
9229 if (unsigned BuiltinID = FD->getBuiltinID()) {
9232 Diag(FD->getLocation(), diag::err_builtin_definition) << FD;
9233 FD->setInvalidDecl();
9239 QualType ResultType = FD->getResultType();
9241 !FD->isInvalidDecl() &&
9242 RequireCompleteType(FD->getLocation(), ResultType,
9244 FD->setInvalidDecl();
9252 if (ShouldWarnAboutMissingPrototype(FD, PossibleZeroParamPrototype)) {
9253 Diag(FD->getLocation(), diag::warn_missing_prototype) << FD;
9271 PushDeclContext(FnBodyScope, FD);
9274 CheckParmsForFunctionDef(FD->param_begin(), FD->param_end(),
9278 for (unsigned p = 0, NumParams = FD->getNumParams(); p < NumParams; ++p) {
9279 ParmVarDecl *Param = FD->getParamDecl(p);
9280 Param->setOwningFunction(FD);
9293 for (llvm::ArrayRef<NamedDecl*>::iterator I = FD->getDeclsInPrototypeScope().begin(),
9294 E = FD->getDeclsInPrototypeScope().end(); I != E; ++I) {
9328 if (const FunctionProtoType *FPT = FD->getType()->getAs<FunctionProtoType>())
9333 DLLImportAttr *DA = FD->getAttr<DLLImportAttr>();
9334 if (DA && (!FD->getAttr<DLLExportAttr>())) {
9338 !(LangOpts.MicrosoftExt && FD->getLexicalDeclContext()->isRecord())) {
9339 Diag(FD->getLocation(),
9342 FD->setInvalidDecl();
9352 Diag(FD->getLocation(),
9354 << FD->getName() << "dllimport";
9404 FunctionDecl *FD = 0;
9406 FD = FTD->getTemplatedDecl();
9408 FD = cast<FunctionDecl>(D);
9415 return !FD->isConstexpr() && !FD->getResultType()->isUndeducedType();
9419 if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(Decl))
9420 FD->setHasSkippedBody();
9432 FunctionDecl *FD = 0;
9435 FD = FunTmpl->getTemplatedDecl();
9437 FD = dyn_cast_or_null<FunctionDecl>(dcl);
9442 if (FD) {
9443 FD->setBody(Body);
9445 if (getLangOpts().CPlusPlus1y && !FD->isInvalidDecl() && Body &&
9446 !FD->isDependentContext() && FD->getResultType()->isUndeducedType()) {
9450 if (!FD->getResultType()->getAs<AutoType>()) {
9452 << FD->getResultType();
9453 FD->setInvalidDecl();
9456 TypeLoc ResultType = FD->getTypeSourceInfo()->getTypeLoc().
9459 FD, SubstAutoType(ResultType.getType(), Context.VoidTy));
9466 if (FD->getPreviousDecl() != 0 && FD->getPreviousDecl()->isUsed()) {
9467 if (!FD->isExternallyVisible())
9468 UndefinedButUsed.erase(FD);
9469 else if (FD->isInlined() &&
9471 (!FD->getPreviousDecl()->hasAttr<GNUInlineAttr>()))
9472 UndefinedButUsed.erase(FD);
9477 if (FD->hasImplicitReturnZero() || FD->hasAttr<NakedAttr>())
9482 if (getLangOpts().MicrosoftExt && FD->isPure())
9483 Diag(FD->getLocation(), diag::warn_pure_function_definition);
9485 if (!FD->isInvalidDecl()) {
9486 DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
9487 DiagnoseSizeOfParametersAndReturnValue(FD->param_begin(), FD->param_end(),
9488 FD->getResultType(), FD);
9491 if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(FD))
9492 MarkVTableUsed(FD->getLocation(), Constructor->getParent());
9497 if (getLangOpts().CPlusPlus && FD->getResultType()->isRecordType() &&
9498 !FD->isDependentContext())
9502 assert((FD == getCurFunctionDecl() || getCurLambda()->CallOperator == FD) &&
9533 if (FD && isa<CXXConstructorDecl>(FD) && isa<CXXTryStmt>(Body))
9565 if (!IsInstantiation && FD && FD->isConstexpr() && !FD->isInvalidDecl() &&
9566 (!CheckConstexprFunctionDecl(FD) ||
9567 !CheckConstexprFunctionBody(FD, Body)))
9568 FD->setInvalidDecl();
9691 FunctionDecl *FD = cast<FunctionDecl>(ActOnDeclarator(TUScope, D));
9692 FD->setImplicit();
9696 AddKnownFunctionAttributes(FD);
9698 return FD;
9710 void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
9711 if (FD->isInvalidDecl())
9716 if (unsigned BuiltinID = FD->getBuiltinID()) {
9721 if (!FD->getAttr<FormatAttr>()) {
9723 unsigned int NumParams = FD->getNumParams();
9725 FD->getParamDecl(FormatIdx)->getType()->isObjCObjectPointerType())
9727 FD->addAttr(::new (Context) FormatAttr(FD->getLocation(), Context,
9734 if (!FD->getAttr<FormatAttr>())
9735 FD->addAttr(::new (Context) FormatAttr(FD->getLocation(), Context,
9745 if (!FD->getAttr<ConstAttr>())
9746 FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context));
9750 !FD->getAttr<ReturnsTwiceAttr>())
9751 FD->addAttr(::new (Context) ReturnsTwiceAttr(FD->getLocation(), Context));
9752 if (Context.BuiltinInfo.isNoThrow(BuiltinID) && !FD->getAttr<NoThrowAttr>())
9753 FD->addAttr(::new (Context) NoThrowAttr(FD->getLocation(), Context));
9754 if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->getAttr<ConstAttr>())
9755 FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context));
9758 IdentifierInfo *Name = FD->getIdentifier();
9762 FD->getDeclContext()->isTranslationUnit()) ||
9763 (isa<LinkageSpecDecl>(FD->getDeclContext()) &&
9764 cast<LinkageSpecDecl>(FD->getDeclContext())->getLanguage() ==
9774 if (!FD->getAttr<FormatAttr>())
9775 FD->addAttr(::new (Context) FormatAttr(FD->getLocation(), Context,
9783 if (!FD->getAttr<FormatArgAttr>())
9784 FD->addAttr(::new (Context) FormatArgAttr(FD->getLocation(), Context, 1));
11268 bool Sema::CheckNontrivialField(FieldDecl *FD) {
11269 assert(FD);
11272 if (FD->isInvalidDecl() || FD->getType()->isDependentType())
11275 QualType EltTy = Context.getBaseElementType(FD->getType());
11306 SourceLocation Loc = FD->getLocation();
11308 if (!FD->hasAttr<UnavailableAttr>())
11309 FD->addAttr(new (Context) UnavailableAttr(Loc, Context,
11315 Diag(FD->getLocation(), getLangOpts().CPlusPlus11 ?
11318 << (int)FD->getParent()->isUnion() << FD->getDeclName() << member;
11536 FieldDecl *FD = cast<FieldDecl>(*i);
11539 const Type *FDTy = FD->getType().getTypePtr();
11541 if (!FD->isAnonymousStructOrUnion()) {
11543 RecFields.push_back(FD);
11548 if (FD->isInvalidDecl()) {
11565 Diag(FD->getLocation(), diag::err_field_declared_as_function)
11566 << FD->getDeclName();
11567 FD->setInvalidDecl();
11581 Diag(FD->getLocation(), diag::ext_flexible_array_union_ms)
11582 << FD->getDeclName();
11584 Diag(FD->getLocation(), diag::ext_flexible_array_empty_aggregate_ms)
11585 << FD->getDeclName() << Record->getTagKind();
11588 Diag(FD->getLocation(), diag::ext_flexible_array_union_gnu)
11589 << FD->getDeclName();
11591 Diag(FD->getLocation(), diag::ext_flexible_array_empty_aggregate_gnu)
11592 << FD->getDeclName() << Record->getTagKind();
11595 Diag(FD->getLocation(), diag::ext_flexible_array_union_gnu)
11596 << FD->getDeclName();
11598 Diag(FD->getLocation(), diag::ext_c99_flexible_array_member)
11599 << FD->getDeclName() << Record->getTagKind();
11601 Diag(FD->getLocation(), diag::err_flexible_array_empty_struct)
11602 << FD->getDeclName();
11603 FD->setInvalidDecl();
11607 if (!FD->getType()->isDependentType() &&
11608 !Context.getBaseElementType(FD->getType()).isPODType(Context)) {
11609 Diag(FD->getLocation(), diag::err_flexible_array_has_nonpod_type)
11610 << FD->getDeclName() << FD->getType();
11611 FD->setInvalidDecl();
11619 RequireCompleteType(FD->getLocation(), FD->getType(),
11622 FD->setInvalidDecl();
11635 Diag(FD->getLocation(), diag::ext_variable_sized_type_in_struct)
11636 << FD->getDeclName() << FD->getType();
11640 Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
11641 << FD->getDeclName();
11648 RequireNonAbstractType(FD->getLocation(), FD->getType(),
11652 FD->setInvalidDecl();
11660 Diag(FD->getLocation(), diag::err_statically_allocated_object)
11661 << FixItHint::CreateInsertion(FD->getLocation(), "*");
11662 QualType T = Context.getObjCObjectPointerType(FD->getType());
11663 FD->setType(T);
11671 QualType T = FD->getType();
11674 SourceLocation loc = FD->getLocation();
11676 FD->hasAttr<UnavailableAttr>()) {
11677 FD->addAttr(new (Context) UnavailableAttr(loc, Context,
11681 Diag(FD->getLocation(), diag::err_arc_objc_object_in_tag)
11689 if (FD->getType()->isObjCObjectPointerType() ||
11690 FD->getType().isObjCGCStrong())
11692 else if (Context.getAsArrayType(FD->getType())) {
11693 QualType BaseType = Context.getBaseElementType(FD->getType());
11702 if (Record && FD->getType().isVolatileQualified())
11705 if (FD->getIdentifier())