Lines Matching refs:FnDecl
15243 const FunctionDecl *FnDecl) { in CheckOperatorNewDeleteDeclarationScope() argument
15244 const DeclContext *DC = FnDecl->getDeclContext()->getRedeclContext(); in CheckOperatorNewDeleteDeclarationScope()
15246 return SemaRef.Diag(FnDecl->getLocation(), in CheckOperatorNewDeleteDeclarationScope()
15248 << FnDecl->getDeclName(); in CheckOperatorNewDeleteDeclarationScope()
15252 FnDecl->getStorageClass() == SC_Static) { in CheckOperatorNewDeleteDeclarationScope()
15253 return SemaRef.Diag(FnDecl->getLocation(), in CheckOperatorNewDeleteDeclarationScope()
15255 << FnDecl->getDeclName(); in CheckOperatorNewDeleteDeclarationScope()
15269 CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl, in CheckOperatorNewDeleteTypes() argument
15275 FnDecl->getType()->castAs<FunctionType>()->getReturnType(); in CheckOperatorNewDeleteTypes()
15289 FnDecl->getLocation(), in CheckOperatorNewDeleteTypes()
15293 << FnDecl->getDeclName() << ExpectedResultType; in CheckOperatorNewDeleteTypes()
15297 if (FnDecl->getDescribedFunctionTemplate() && FnDecl->getNumParams() < 2) in CheckOperatorNewDeleteTypes()
15298 return SemaRef.Diag(FnDecl->getLocation(), in CheckOperatorNewDeleteTypes()
15300 << FnDecl->getDeclName(); in CheckOperatorNewDeleteTypes()
15303 if (FnDecl->getNumParams() == 0) in CheckOperatorNewDeleteTypes()
15304 return SemaRef.Diag(FnDecl->getLocation(), in CheckOperatorNewDeleteTypes()
15306 << FnDecl->getDeclName(); in CheckOperatorNewDeleteTypes()
15308 QualType FirstParamType = FnDecl->getParamDecl(0)->getType(); in CheckOperatorNewDeleteTypes()
15312 FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) { in CheckOperatorNewDeleteTypes()
15323 return SemaRef.Diag(FnDecl->getLocation(), FirstParamType->isDependentType() in CheckOperatorNewDeleteTypes()
15326 << FnDecl->getDeclName() << ExpectedFirstParamType; in CheckOperatorNewDeleteTypes()
15333 CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) { in CheckOperatorNewDeclaration() argument
15338 if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl)) in CheckOperatorNewDeclaration()
15347 if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl, SemaRef.Context.VoidPtrTy, in CheckOperatorNewDeclaration()
15355 if (FnDecl->getParamDecl(0)->hasDefaultArg()) in CheckOperatorNewDeclaration()
15356 return SemaRef.Diag(FnDecl->getLocation(), in CheckOperatorNewDeclaration()
15358 << FnDecl->getDeclName() << FnDecl->getParamDecl(0)->getDefaultArgRange(); in CheckOperatorNewDeclaration()
15364 CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) { in CheckOperatorDeleteDeclaration() argument
15369 if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl)) in CheckOperatorDeleteDeclaration()
15372 auto *MD = dyn_cast<CXXMethodDecl>(FnDecl); in CheckOperatorDeleteDeclaration()
15387 SemaRef, FnDecl, SemaRef.Context.VoidTy, ExpectedFirstParamType, in CheckOperatorDeleteDeclaration()
15408 bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { in CheckOverloadedOperatorDeclaration() argument
15409 assert(FnDecl && FnDecl->isOverloadedOperator() && in CheckOverloadedOperatorDeclaration()
15412 OverloadedOperatorKind Op = FnDecl->getOverloadedOperator(); in CheckOverloadedOperatorDeclaration()
15421 return CheckOperatorDeleteDeclaration(*this, FnDecl); in CheckOverloadedOperatorDeclaration()
15424 return CheckOperatorNewDeclaration(*this, FnDecl); in CheckOverloadedOperatorDeclaration()
15431 if (CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(FnDecl)) { in CheckOverloadedOperatorDeclaration()
15433 return Diag(FnDecl->getLocation(), in CheckOverloadedOperatorDeclaration()
15434 diag::err_operator_overload_static) << FnDecl->getDeclName(); in CheckOverloadedOperatorDeclaration()
15437 for (auto Param : FnDecl->parameters()) { in CheckOverloadedOperatorDeclaration()
15447 return Diag(FnDecl->getLocation(), in CheckOverloadedOperatorDeclaration()
15449 << FnDecl->getDeclName(); in CheckOverloadedOperatorDeclaration()
15459 for (auto Param : FnDecl->parameters()) { in CheckOverloadedOperatorDeclaration()
15463 << FnDecl->getDeclName() << Param->getDefaultArgRange(); in CheckOverloadedOperatorDeclaration()
15482 unsigned NumParams = FnDecl->getNumParams() in CheckOverloadedOperatorDeclaration()
15483 + (isa<CXXMethodDecl>(FnDecl)? 1 : 0); in CheckOverloadedOperatorDeclaration()
15500 return Diag(FnDecl->getLocation(), diag::err_operator_overload_must_be) in CheckOverloadedOperatorDeclaration()
15501 << FnDecl->getDeclName() << NumParams << ErrorKind; in CheckOverloadedOperatorDeclaration()
15506 FnDecl->getType()->castAs<FunctionProtoType>()->isVariadic()) { in CheckOverloadedOperatorDeclaration()
15507 return Diag(FnDecl->getLocation(), diag::err_operator_overload_variadic) in CheckOverloadedOperatorDeclaration()
15508 << FnDecl->getDeclName(); in CheckOverloadedOperatorDeclaration()
15512 if (MustBeMemberOperator && !isa<CXXMethodDecl>(FnDecl)) { in CheckOverloadedOperatorDeclaration()
15513 return Diag(FnDecl->getLocation(), in CheckOverloadedOperatorDeclaration()
15515 << FnDecl->getDeclName(); in CheckOverloadedOperatorDeclaration()
15529 ParmVarDecl *LastParam = FnDecl->getParamDecl(FnDecl->getNumParams() - 1); in CheckOverloadedOperatorDeclaration()
15600 bool Sema::CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl) { in CheckLiteralOperatorDeclaration() argument
15601 if (isa<CXXMethodDecl>(FnDecl)) { in CheckLiteralOperatorDeclaration()
15602 Diag(FnDecl->getLocation(), diag::err_literal_operator_outside_namespace) in CheckLiteralOperatorDeclaration()
15603 << FnDecl->getDeclName(); in CheckLiteralOperatorDeclaration()
15607 if (FnDecl->isExternC()) { in CheckLiteralOperatorDeclaration()
15608 Diag(FnDecl->getLocation(), diag::err_literal_operator_extern_c); in CheckLiteralOperatorDeclaration()
15610 FnDecl->getDeclContext()->getExternCContext()) in CheckLiteralOperatorDeclaration()
15616 FunctionTemplateDecl *TpDecl = FnDecl->getDescribedFunctionTemplate(); in CheckLiteralOperatorDeclaration()
15620 TpDecl = FnDecl->getPrimaryTemplate(); in CheckLiteralOperatorDeclaration()
15628 if (FnDecl->param_size() != 0) { in CheckLiteralOperatorDeclaration()
15629 Diag(FnDecl->getLocation(), in CheckLiteralOperatorDeclaration()
15637 } else if (FnDecl->param_size() == 1) { in CheckLiteralOperatorDeclaration()
15638 const ParmVarDecl *Param = FnDecl->getParamDecl(0); in CheckLiteralOperatorDeclaration()
15681 } else if (FnDecl->param_size() == 2) { in CheckLiteralOperatorDeclaration()
15682 FunctionDecl::param_iterator Param = FnDecl->param_begin(); in CheckLiteralOperatorDeclaration()
15736 Diag(FnDecl->getLocation(), diag::err_literal_operator_bad_param_count); in CheckLiteralOperatorDeclaration()
15744 for (auto Param : FnDecl->parameters()) { in CheckLiteralOperatorDeclaration()
15754 = FnDecl->getDeclName().getCXXLiteralIdentifier()->getName(); in CheckLiteralOperatorDeclaration()
15756 !getSourceManager().isInSystemHeader(FnDecl->getLocation())) { in CheckLiteralOperatorDeclaration()
15760 Diag(FnDecl->getLocation(), diag::warn_user_literal_reserved) in CheckLiteralOperatorDeclaration()