Lines Matching defs:SemaRef

1725 static bool CheckLiteralType(Sema &SemaRef, Sema::CheckConstexprKind Kind,
1733 return SemaRef.RequireLiteralType(Loc, T, DiagID,
1737 return !T->isLiteralType(SemaRef.Context);
1744 static bool CheckConstexprDestructorSubobjects(Sema &SemaRef,
1747 assert(!SemaRef.getLangOpts().CPlusPlus23 &&
1756 SemaRef.Diag(DD->getLocation(), diag::err_constexpr_dtor_subobject)
1759 SemaRef.Diag(Loc, diag::note_constexpr_dtor_subobject)
1777 static bool CheckConstexprParameterTypes(Sema &SemaRef,
1780 assert(!SemaRef.getLangOpts().CPlusPlus23 &&
1790 if (CheckLiteralType(SemaRef, Kind, ParamLoc, *i,
1801 static bool CheckConstexprReturnType(Sema &SemaRef, const FunctionDecl *FD,
1803 assert(!SemaRef.getLangOpts().CPlusPlus23 &&
1805 if (CheckLiteralType(SemaRef, Kind, FD->getLocation(), FD->getReturnType(),
1829 static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
1832 static bool CheckConstexprMissingReturn(Sema &SemaRef, const FunctionDecl *Dcl);
1924 static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
1954 SemaRef.Diag(TL.getBeginLoc(), diag::err_constexpr_vla)
1968 SemaRef.Diag(DS->getBeginLoc(),
1969 SemaRef.getLangOpts().CPlusPlus14
1973 } else if (!SemaRef.getLangOpts().CPlusPlus14) {
1996 SemaRef.Diag(VD->getLocation(),
1997 SemaRef.getLangOpts().CPlusPlus23
2002 } else if (!SemaRef.getLangOpts().CPlusPlus23) {
2006 if (SemaRef.LangOpts.CPlusPlus23) {
2007 CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
2012 SemaRef, Kind, VD->getLocation(), VD->getType(),
2020 SemaRef.Diag(
2022 SemaRef.getLangOpts().CPlusPlus20
2026 } else if (!SemaRef.getLangOpts().CPlusPlus20) {
2033 SemaRef.Diag(VD->getLocation(),
2034 SemaRef.getLangOpts().CPlusPlus14
2038 } else if (!SemaRef.getLangOpts().CPlusPlus14) {
2054 SemaRef.Diag(DS->getBeginLoc(), diag::err_constexpr_body_invalid_stmt)
2077 static bool CheckConstexprCtorInitializer(Sema &SemaRef,
2085 SemaRef.getLangOpts().CPlusPlus20)
2106 SemaRef.Diag(Dcl->getLocation(),
2107 SemaRef.getLangOpts().CPlusPlus20
2112 SemaRef.Diag(Field->getLocation(),
2114 } else if (!SemaRef.getLangOpts().CPlusPlus20) {
2123 if (!CheckConstexprCtorInitializer(SemaRef, Dcl, I, Inits, Diagnosed,
2133 CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
2150 if (!CheckConstexprDeclStmt(SemaRef, Dcl, cast<DeclStmt>(S), Cxx1yLoc, Kind))
2170 SemaRef, Dcl, cast<AttributedStmt>(S)->getSubStmt(), ReturnStmts,
2180 if (!CheckConstexprFunctionStmt(SemaRef, Dcl, BodyIt, ReturnStmts,
2193 if (!CheckConstexprFunctionStmt(SemaRef, Dcl, If->getThen(), ReturnStmts,
2197 !CheckConstexprFunctionStmt(SemaRef, Dcl, If->getElse(), ReturnStmts,
2210 if (!SemaRef.getLangOpts().CPlusPlus14)
2216 !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
2232 !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
2244 !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
2258 !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
2268 SemaRef, Dcl, cast<CXXCatchStmt>(S)->getHandlerBlock(), ReturnStmts,
2284 SemaRef.Diag(S->getBeginLoc(), diag::err_constexpr_body_invalid_stmt)
2295 static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
2315 if (!SemaRef.getLangOpts().CPlusPlus20)
2320 SemaRef.Diag(Body->getBeginLoc(),
2321 !SemaRef.getLangOpts().CPlusPlus20
2337 !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
2345 if ((Cxx2bLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus23) ||
2346 (Cxx2aLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus20) ||
2347 (Cxx1yLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus17))
2350 SemaRef.Diag(Cxx2bLoc,
2351 SemaRef.getLangOpts().CPlusPlus23
2356 SemaRef.Diag(Cxx2aLoc,
2357 SemaRef.getLangOpts().CPlusPlus20
2362 SemaRef.Diag(Cxx1yLoc,
2363 SemaRef.getLangOpts().CPlusPlus14
2382 SemaRef.Diag(
2384 SemaRef.getLangOpts().CPlusPlus20
2387 } else if (!SemaRef.getLangOpts().CPlusPlus20) {
2425 if (!CheckConstexprCtorInitializer(SemaRef, Dcl, I, Inits, Diagnosed,
2434 if (!CheckConstexprMissingReturn(SemaRef, Dcl))
2442 if (!SemaRef.getLangOpts().CPlusPlus14)
2449 SemaRef.Diag(
2451 SemaRef.getLangOpts().CPlusPlus14
2455 SemaRef.Diag(ReturnStmts[I],
2460 if (!SemaRef.getLangOpts().CPlusPlus14)
2484 !SemaRef.getLangOpts().CheckConstexprFunctionBodies ||
2485 SemaRef.getSourceManager().isInSystemHeader(Dcl->getLocation()) ||
2486 SemaRef.getDiagnostics().isIgnored(
2491 SemaRef.Diag(Dcl->getLocation(),
2496 SemaRef.Diag(Diags[I].first, Diags[I].second);
2504 static bool CheckConstexprMissingReturn(Sema &SemaRef,
2511 if (SemaRef.getLangOpts().CPlusPlus23 && !IsVoidOrDependentType)
2518 bool OK = SemaRef.getLangOpts().CPlusPlus14 && IsVoidOrDependentType;
2519 SemaRef.Diag(Dcl->getLocation(),
2551 Sema &SemaRef;
2558 ImmediateEscalatingExpressionsVisitor(Sema &SemaRef, FunctionDecl *FD)
2559 : SemaRef(SemaRef), ImmediateFn(FD),
2576 SemaRef.Diag(Loc, diag::note_immediate_function_reason)
4026 Sema &SemaRef, const CXXConstructorDecl *Constructor) {
4028 if (SemaRef.getDiagnostics().isIgnored(diag::warn_field_is_uninit,
4060 UninitializedFieldVisitor UninitializedChecker(SemaRef,
4193 static bool FindBaseInitializer(Sema &SemaRef,
4201 if (SemaRef.Context.hasSameUnqualifiedType(BaseType, Base.getType())) {
4218 if (SemaRef.IsDerivedFrom(ClassDecl->getLocation(),
4219 SemaRef.Context.getTypeDeclType(ClassDecl),
4828 static Expr *CastForMoving(Sema &SemaRef, Expr *E) {
4830 SemaRef.BuildReferenceType(E->getType(), /*SpelledAsLValue*/ false,
4833 TypeSourceInfo *TargetLoc = SemaRef.Context.getTrivialTypeSourceInfo(
4836 return SemaRef.BuildCXXNamedCast(ExprLoc, tok::kw_static_cast, TargetLoc, E,
4851 BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
4857 = InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec,
4867 InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
4868 BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
4879 DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
4884 SemaRef.MarkDeclRefReferenced(cast<DeclRefExpr>(CopyCtorArg));
4888 SemaRef.Context.getQualifiedType(BaseSpec->getType().getUnqualifiedType(),
4892 CopyCtorArg = CastForMoving(SemaRef, CopyCtorArg);
4897 CopyCtorArg = SemaRef.ImpCastExprToType(CopyCtorArg, ArgTy,
4905 InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, CopyCtorArg);
4906 BaseInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, CopyCtorArg);
4911 BaseInit = SemaRef.MaybeCreateExprWithCleanups(BaseInit);
4916 new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context,
4917 SemaRef.Context.getTrivialTypeSourceInfo(BaseSpec->getType(),
4934 BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
4953 DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
4957 SemaRef.MarkDeclRefReferenced(cast<DeclRefExpr>(MemberExprBase));
4960 MemberExprBase = CastForMoving(SemaRef, MemberExprBase);
4965 LookupResult MemberLookup(SemaRef, Field->getDeclName(), Loc,
4971 = SemaRef.BuildMemberReferenceExpr(MemberExprBase,
4987 CtorArg = CastForMoving(SemaRef, CtorArg.get());
5001 InitializationSequence InitSeq(SemaRef, Entity, InitKind, CtorArgE);
5003 InitSeq.Perform(SemaRef, Entity, InitKind, MultiExprArg(&CtorArgE, 1));
5004 MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
5009 CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(
5010 SemaRef.Context, Indirect, Loc, Loc, MemberInit.getAs<Expr>(), Loc);
5012 CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(
5013 SemaRef.Context, Field, Loc, Loc, MemberInit.getAs<Expr>(), Loc);
5021 SemaRef.Context.getBaseElementType(Field->getType());
5032 InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, {});
5033 ExprResult MemberInit = InitSeq.Perform(SemaRef, InitEntity, InitKind, {});
5035 MemberInit = SemaRef.MaybeCreateExprWithCleanups(MemberInit);
5040 CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context,
5046 CXXMemberInit = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context,
5055 SemaRef.Diag(Constructor->getLocation(),
5058 << SemaRef.Context.getTagDeclType(Constructor->getParent())
5060 SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
5065 SemaRef.Diag(Constructor->getLocation(),
5068 << SemaRef.Context.getTagDeclType(Constructor->getParent())
5070 SemaRef.Diag(Field->getLocation(), diag::note_declared_at);
5079 = new (SemaRef.Context) CXXCtorInitializer(SemaRef.Context, Field,
5081 new (SemaRef.Context) ImplicitValueInitExpr(Field->getType()),
5197 static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info,
5225 SemaRef.BuildCXXDefaultInitExpr(Info.Ctor->getLocation(), Field);
5230 SemaRef.checkInitializerLifetime(Entity, DIE.get());
5234 Init = new (SemaRef.Context)
5235 CXXCtorInitializer(SemaRef.Context, Indirect, SourceLocation(),
5238 Init = new (SemaRef.Context)
5239 CXXCtorInitializer(SemaRef.Context, Field, SourceLocation(),
5245 if (isIncompleteOrZeroLengthArrayType(SemaRef.Context, Field->getType()))
5502 Sema &SemaRef, const CXXConstructorDecl *Constructor,
5512 if (!SemaRef.Diags.isIgnored(diag::warn_initializer_out_of_order,
5530 IdealInitKeys.push_back(GetKeyForBase(SemaRef.Context, VBase.getType()));
5536 IdealInitKeys.push_back(GetKeyForBase(SemaRef.Context, Base.getType()));
5558 const void *InitKey = GetKeyForMember(SemaRef.Context, Inits[InitIndex]);
5592 Sema::SemaDiagnosticBuilder D = SemaRef.Diag(
5608 SemaRef.getSourceManager(), SemaRef.getLangOpts()));
5623 auto D = SemaRef.Diag(PrevInit->getSourceLocation(),
16202 CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef,
16206 return SemaRef.Diag(FnDecl->getLocation(),
16213 return SemaRef.Diag(FnDecl->getLocation(),
16221 static CanQualType RemoveAddressSpaceFromPtr(Sema &SemaRef,
16223 auto &Ctx = SemaRef.Context;
16231 CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
16239 if (SemaRef.getLangOpts().OpenCLCPlusPlus) {
16243 ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
16246 ExpectedResultType = RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy);
16250 if (SemaRef.Context.getCanonicalType(ResultType) != ExpectedResultType) {
16253 return SemaRef.Diag(
16263 return SemaRef.Diag(FnDecl->getLocation(),
16269 return SemaRef.Diag(FnDecl->getLocation(),
16274 if (SemaRef.getLangOpts().OpenCLCPlusPlus) {
16279 FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
16283 RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy);
16287 if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType() !=
16292 return SemaRef.Diag(FnDecl->getLocation(), FirstParamType->isDependentType()
16302 CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) {
16307 if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl))
16311 SemaRef.Context.getCanonicalType(SemaRef.Context.getSizeType());
16316 if (CheckOperatorNewDeleteTypes(SemaRef, FnDecl, SemaRef.Context.VoidPtrTy,
16325 return SemaRef.Diag(FnDecl->getLocation(),
16333 CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
16338 if (CheckOperatorNewDeleteDeclarationScope(SemaRef, FnDecl))
16349 ? SemaRef.Context.getCanonicalType(SemaRef.Context.getPointerType(
16350 SemaRef.Context.getRecordType(MD->getParent())))
16351 : SemaRef.Context.VoidPtrTy;
16356 SemaRef, FnDecl, SemaRef.Context.VoidTy, ExpectedFirstParamType,
16365 !SemaRef.isUsualDeallocationFunction(MD)) {
16366 SemaRef.Diag(MD->getLocation(),
16544 checkLiteralOperatorTemplateParameterList(Sema &SemaRef,
16555 SemaRef.Context.hasSameType(PmDecl->getType(), SemaRef.Context.CharTy))
16565 if (SemaRef.getLangOpts().CPlusPlus20 && PmDecl &&
16584 if (!SemaRef.inTemplateInstantiation())
16585 SemaRef.Diag(TpDecl->getLocation(),
16592 SemaRef.Diag(TpDecl->getTemplateParameters()->getSourceRange().getBegin(),