;
59 structCastOperation {
61: Self(S), SrcExpr(src), DestType(destType),
64 Kind(CK_Dependent), IsARCUnbridgedCast(
false) {
75!DestType->isArrayType()) {
76DestType = DestType.getAtomicUnqualifiedType();
81PlaceholderKind = placeholder->getKind();
95 boolIsARCUnbridgedCast;
101 voidCheckConstCast();
102 voidCheckReinterpretCast();
103 voidCheckStaticCast();
104 voidCheckDynamicCast();
105 voidCheckCXXCStyleCast(
bool FunctionalCast,
boolListInitialization);
106 voidCheckCStyleCast();
107 voidCheckBuiltinBitCast();
108 voidCheckAddrspaceCast();
110 voidupdatePartOfExplicitCastFlags(
CastExpr*CE) {
114 for(;
auto*ICE = dyn_cast<ImplicitCastExpr>(CE->
getSubExpr()); CE = ICE)
115ICE->setIsPartOfExplicitCast(
true);
123 if(IsARCUnbridgedCast) {
125Self.Context, Self.Context.ARCUnbridgedCastTy, CK_Dependent,
127Self.CurFPFeatureOverrides());
129updatePartOfExplicitCastFlags(
castExpr);
139 if(PlaceholderKind != K)
return false;
145 boolisPlaceholder()
const{
146 returnPlaceholderKind != 0;
149 returnPlaceholderKind == K;
155 voidcheckCastAlign() {
156Self.CheckCastAlign(SrcExpr.
get(), DestType, OpRange);
160assert(Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers());
163 if(Self.ObjC().CheckObjCConversion(OpRange, DestType, src, CCK) ==
165IsARCUnbridgedCast =
true;
170 voidcheckNonOverloadPlaceholders() {
171 if(!isPlaceholder() || isPlaceholder(BuiltinType::Overload))
174SrcExpr = Self.CheckPlaceholderExpr(SrcExpr.
get());
183 if(
const auto*PtrType = dyn_cast<PointerType>(FromType)) {
184 if(PtrType->getPointeeType()->hasAttr(attr::NoDeref)) {
185 if(
const auto*DestType = dyn_cast<PointerType>(ToType)) {
186 if(!DestType->getPointeeType()->hasAttr(attr::NoDeref)) {
187S.
Diag(OpLoc, diag::warn_noderef_to_dereferenceable_pointer);
194 structCheckNoDerefRAII {
195CheckNoDerefRAII(CastOperation &Op) : Op(Op) {}
196~CheckNoDerefRAII() {
197 if(!Op.SrcExpr.isInvalid())
198CheckNoDeref(Op.Self, Op.SrcExpr.get()->getType(), Op.ResultType,
199Op.OpRange.getBegin());
241 QualTypeOrigDestType,
unsigned&msg,
255 unsigned&msg,
CastKind&Kind,
boolListInitialization);
260 boolListInitialization);
279assert(!
D.isInvalidType());
282 if(
D.isInvalidType())
306CastOperation Op(*
this, DestType,
E);
308Op.DestRange = AngleBrackets;
311 default: llvm_unreachable(
"Unknown C++ cast!");
313 casetok::kw_addrspace_cast:
314 if(!TypeDependent) {
315Op.CheckAddrspaceCast();
316 if(Op.SrcExpr.isInvalid())
320 Context, Op.ResultType, Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
321DestTInfo, OpLoc,
Parens.getEnd(), AngleBrackets));
323 casetok::kw_const_cast:
324 if(!TypeDependent) {
326 if(Op.SrcExpr.isInvalid())
331Op.ValueKind, Op.SrcExpr.get(), DestTInfo,
335 casetok::kw_dynamic_cast: {
338 return ExprError(
Diag(OpLoc, diag::err_openclcxx_not_supported)
342 if(!TypeDependent) {
343Op.CheckDynamicCast();
344 if(Op.SrcExpr.isInvalid())
348Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
349&Op.BasePath, DestTInfo,
353 casetok::kw_reinterpret_cast: {
354 if(!TypeDependent) {
355Op.CheckReinterpretCast();
356 if(Op.SrcExpr.isInvalid())
361Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
362 nullptr, DestTInfo, OpLoc,
366 casetok::kw_static_cast: {
367 if(!TypeDependent) {
368Op.CheckStaticCast();
369 if(Op.SrcExpr.isInvalid())
375 Context, Op.ResultType, Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
377 Parens.getEnd(), AngleBrackets));
385assert(!
D.isInvalidType());
388 if(
D.isInvalidType())
397CastOperation Op(*
this, TSI->
getType(), Operand);
403Op.CheckBuiltinBitCast();
404 if(Op.SrcExpr.isInvalid())
410Op.SrcExpr.get(), TSI, KWLoc, RParenLoc);
411 returnOp.complete(BCE);
419 boollistInitialization) {
442range, listInitialization)
455 default:
return false;
487 case OR_Success: llvm_unreachable(
"successful failed overload");
489 if(candidates.
empty())
490msg = diag::err_ovl_no_conversion_in_cast;
492msg = diag::err_ovl_no_viable_conversion_in_cast;
497msg = diag::err_ovl_ambiguous_conversion_in_cast;
505assert(Res ==
OR_Deleted&&
"Inconsistent overload resolution");
510S.
PDiag(diag::err_ovl_deleted_conversion_in_cast)
511<< CT << srcType << destType << (Msg !=
nullptr)
512<< (Msg ? Msg->
getString() : StringRef())
521S.
PDiag(msg) << CT << srcType << destType << range
523S, howManyCandidates, src);
531 boollistInitialization) {
532 if(msg == diag::err_bad_cxx_cast_generic &&
541 intDifferentPtrness = 0;
552 if(!DifferentPtrness) {
555 if(RecFrom && RecTo) {
557 if(!DeclFrom->isCompleteDefinition())
558S.
Diag(DeclFrom->getLocation(), diag::note_type_incomplete) << DeclFrom;
560 if(!DeclTo->isCompleteDefinition())
561S.
Diag(DeclTo->getLocation(), diag::note_type_incomplete) << DeclTo;
569enumCastAwayConstnessKind {
576CACK_SimilarKind = 2,
595staticCastAwayConstnessKind
597 enum{
None, Ptr, MemPtr, BlockPtr, Array };
610 returnAT->getElementType();
614CastAwayConstnessKind Kind;
622Kind = CastAwayConstnessKind::CACK_Similar;
624Kind = CastAwayConstnessKind::CACK_Similar;
627 intT1Class = Classify(T1);
628 if(T1Class ==
None)
629 returnCastAwayConstnessKind::CACK_None;
631 intT2Class = Classify(T2);
632 if(T2Class ==
None)
633 returnCastAwayConstnessKind::CACK_None;
637Kind = T1Class == T2Class ? CastAwayConstnessKind::CACK_SimilarKind
638: CastAwayConstnessKind::CACK_Incoherent;
648 if(Classify(T1) != Array)
651 autoT2Class = Classify(T2);
652 if(T2Class ==
None)
655 if(T2Class != Array)
656Kind = CastAwayConstnessKind::CACK_Incoherent;
657 else if(Kind != CastAwayConstnessKind::CACK_Incoherent)
658Kind = CastAwayConstnessKind::CACK_SimilarKind;
673staticCastAwayConstnessKind
675 boolCheckCVR,
boolCheckObjCLifetime,
676 QualType*TheOffendingSrcType =
nullptr,
677 QualType*TheOffendingDestType =
nullptr,
681 if(!CheckCVR && CheckObjCLifetime && !
Self.Context.getLangOpts().ObjC)
682 returnCastAwayConstnessKind::CACK_None;
687 "Source type is not pointer or pointer to member.");
690 "Destination type is not pointer or pointer to member.");
693 QualTypeUnwrappedSrcType =
Self.Context.getCanonicalType(SrcType),
694UnwrappedDestType =
Self.Context.getCanonicalType(DestType);
699 QualTypePrevUnwrappedSrcType = UnwrappedSrcType;
700 QualTypePrevUnwrappedDestType = UnwrappedDestType;
701 autoWorstKind = CastAwayConstnessKind::CACK_Similar;
702 boolAllConstSoFar =
true;
704 Self.Context, UnwrappedSrcType, UnwrappedDestType)) {
707 if(Kind > WorstKind)
712 Self.Context.getUnqualifiedArrayType(UnwrappedSrcType, SrcQuals);
713 Self.Context.getUnqualifiedArrayType(UnwrappedDestType, DestQuals);
719UnwrappedDestType->isObjCObjectType())
728 if(SrcCvrQuals != DestCvrQuals) {
729 if(CastAwayQualifiers)
730*CastAwayQualifiers = SrcCvrQuals - DestCvrQuals;
733 if(!DestCvrQuals.compatiblyIncludes(SrcCvrQuals,
734 Self.getASTContext())) {
735 if(TheOffendingSrcType)
736*TheOffendingSrcType = PrevUnwrappedSrcType;
737 if(TheOffendingDestType)
738*TheOffendingDestType = PrevUnwrappedDestType;
749 if(CheckObjCLifetime &&
755 if(AllConstSoFar && !DestQuals.
hasConst()) {
756AllConstSoFar =
false;
757 if(TheOffendingSrcType)
758*TheOffendingSrcType = PrevUnwrappedSrcType;
759 if(TheOffendingDestType)
760*TheOffendingDestType = PrevUnwrappedDestType;
763PrevUnwrappedSrcType = UnwrappedSrcType;
764PrevUnwrappedDestType = UnwrappedDestType;
767 returnCastAwayConstnessKind::CACK_None;
773 caseCastAwayConstnessKind::CACK_None:
774llvm_unreachable(
"did not cast away constness");
776 caseCastAwayConstnessKind::CACK_Similar:
778 caseCastAwayConstnessKind::CACK_SimilarKind:
779DiagID = diag::err_bad_cxx_cast_qualifiers_away;
782 caseCastAwayConstnessKind::CACK_Incoherent:
783DiagID = diag::ext_bad_cxx_cast_qualifiers_away_incoherent;
787llvm_unreachable(
"unexpected cast away constness kind");
793voidCastOperation::CheckDynamicCast() {
794CheckNoDerefRAII NoderefCheck(*
this);
797SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
798 else if(isPlaceholder())
799SrcExpr =
Self.CheckPlaceholderExpr(SrcExpr.get());
800 if(SrcExpr.isInvalid())
803 QualTypeOrigSrcType = SrcExpr.get()->getType();
804 QualTypeDestType =
Self.Context.getCanonicalType(this->DestType);
817 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ref_or_ptr)
818<< this->DestType << DestRange;
825assert(DestPointer &&
"Reference to void is not possible");
826}
else if(DestRecord) {
827 if(
Self.RequireCompleteType(OpRange.getBegin(), DestPointee,
828diag::err_bad_cast_incomplete,
834 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
844 QualTypeSrcType =
Self.Context.getCanonicalType(OrigSrcType);
850 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_ptr)
851<< OrigSrcType << this->DestType << SrcExpr.get()->getSourceRange();
855}
else if(DestReference->isLValueReferenceType()) {
856 if(!SrcExpr.get()->isLValue()) {
857 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_rvalue)
858<<
CT_Dynamic<< OrigSrcType << this->DestType << OpRange;
860SrcPointee = SrcType;
864 if(SrcExpr.get()->isPRValue())
865SrcExpr =
Self.CreateMaterializeTemporaryExpr(
866SrcType, SrcExpr.get(),
false);
867SrcPointee = SrcType;
872 if(
Self.RequireCompleteType(OpRange.getBegin(), SrcPointee,
873diag::err_bad_cast_incomplete,
879 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_class)
885assert((DestPointer || DestReference) &&
886 "Bad destination non-ptr/ref slipped through.");
887assert((DestRecord || DestPointee->
isVoidType()) &&
888 "Bad destination pointee slipped through.");
889assert(SrcRecord &&
"Bad source pointee slipped through.");
893 Self.Diag(OpRange.getBegin(), diag::err_bad_cxx_cast_qualifiers_away)
894<<
CT_Dynamic<< OrigSrcType << this->DestType << OpRange;
901 if(DestRecord == SrcRecord) {
909 Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) {
910 if(
Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
911OpRange.getBegin(), OpRange,
917 Kind= CK_DerivedToBase;
923assert(SrcDecl &&
"Definition missing");
924 if(!cast<CXXRecordDecl>(SrcDecl)->isPolymorphic()) {
925 Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic)
934 Self.Diag(OpRange.getBegin(), diag::err_no_dynamic_cast_with_fno_rtti);
940 if(!
Self.getLangOpts().RTTIData) {
942 Self.getASTContext().getTargetInfo().getCXXABI().isMicrosoft();
943 boolisClangCL =
Self.getDiagnostics().getDiagnosticOptions().getFormat() ==
945 if(MicrosoftABI || !DestPointee->
isVoidType())
946 Self.Diag(OpRange.getBegin(),
947diag::warn_no_dynamic_cast_with_rtti_disabled)
955 if(DestDecl->isEffectivelyFinal())
956 Self.MarkVTableUsed(OpRange.getBegin(), DestDecl);
968voidCastOperation::CheckConstCast() {
969CheckNoDerefRAII NoderefCheck(*
this);
972SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
973 else if(isPlaceholder())
974SrcExpr =
Self.CheckPlaceholderExpr(SrcExpr.get());
975 if(SrcExpr.isInvalid())
978 unsignedmsg = diag::err_bad_cxx_cast_generic;
982<< SrcExpr.get()->getType() << DestType << OpRange;
988voidCastOperation::CheckAddrspaceCast() {
989 unsignedmsg = diag::err_bad_cxx_cast_generic;
993 Self.Diag(OpRange.getBegin(), msg)
994<<
CT_Addrspace<< SrcExpr.get()->getType() << DestType << OpRange;
1031ReinterpretKind = ReinterpretUpcast;
1033ReinterpretKind = ReinterpretDowncast;
1038 boolNonZeroOffset =
false;
1040 E= BasePaths.
end();
1044 boolIsVirtual =
false;
1045 for(CXXBasePath::const_iterator IElem =
Path.begin(), EElem =
Path.end();
1046IElem != EElem; ++IElem) {
1047IsVirtual = IElem->Base->isVirtual();
1050 const CXXRecordDecl*BaseRD = IElem->Base->getType()->getAsCXXRecordDecl();
1051assert(BaseRD &&
"Base type should be a valid unqualified class type");
1055*ClassDefinition =
Class->getDefinition();
1056 if(
Class->isInvalidDecl() || !ClassDefinition ||
1057!ClassDefinition->isCompleteDefinition())
1061 Self.Context.getASTRecordLayout(
Class);
1066 if(Offset.isZero())
1070NonZeroOffset =
true;
1075(void) NonZeroOffset;
1077 "Should have returned if has non-virtual base with zero offset");
1080ReinterpretKind == ReinterpretUpcast? DestType : SrcType;
1082ReinterpretKind == ReinterpretUpcast? SrcType : DestType;
1085 Self.Diag(BeginLoc, diag::warn_reinterpret_different_from_static)
1086<< DerivedType << BaseType << !
VirtualBase<<
int(ReinterpretKind)
1088 Self.Diag(BeginLoc, diag::note_reinterpret_updowncast_use_static)
1089<<
int(ReinterpretKind)
1110 unsigned intDiagID = 0;
1111 const unsigned int DiagList[] = {diag::warn_cast_function_type_strict,
1112diag::warn_cast_function_type};
1137assert(SrcFTy && DstFTy);
1139 if(
Self.Context.hasSameType(SrcFTy, DstFTy))
1143 if(DiagID == diag::warn_cast_function_type_strict)
1150 return!PT->isVariadic() && PT->getNumParams() == 0;
1155 if(IsVoidVoid(SrcFTy) || IsVoidVoid(DstFTy))
1169 const auto*SrcFPTy = cast<FunctionProtoType>(SrcFTy);
1170 const auto*DstFPTy = cast<FunctionProtoType>(DstFTy);
1174 unsignedNumParams = SrcFPTy->getNumParams();
1175 unsignedDstNumParams = DstFPTy->getNumParams();
1176 if(NumParams > DstNumParams) {
1177 if(!DstFPTy->isVariadic())
1179NumParams = DstNumParams;
1180}
else if(NumParams < DstNumParams) {
1181 if(!SrcFPTy->isVariadic())
1185 for(
unsignedi = 0; i < NumParams; ++i)
1187DstFPTy->getParamType(i),
Self.Context))
1198voidCastOperation::CheckReinterpretCast() {
1199 if(ValueKind ==
VK_PRValue&& !isPlaceholder(BuiltinType::Overload))
1200SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
1202checkNonOverloadPlaceholders();
1203 if(SrcExpr.isInvalid())
1206 unsignedmsg = diag::err_bad_cxx_cast_generic;
1209 false, OpRange, msg, Kind);
1211 if(SrcExpr.isInvalid())
1213 if(SrcExpr.get()->getType() ==
Self.Context.OverloadTy) {
1215 Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload)
1217<< DestType << OpRange;
1218 Self.NoteAllOverloadCandidates(SrcExpr.get());
1227 if(
Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers())
1232 Self.Diag(OpRange.getBegin(), DiagID)
1233<< SrcExpr.get()->getType() << DestType << OpRange;
1243voidCastOperation::CheckStaticCast() {
1244CheckNoDerefRAII NoderefCheck(*
this);
1246 if(isPlaceholder()) {
1247checkNonOverloadPlaceholders();
1248 if(SrcExpr.isInvalid())
1258 if(claimPlaceholder(BuiltinType::Overload)) {
1259 Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr,
1262OpRange, DestType, diag::err_bad_static_cast_overload);
1263 if(SrcExpr.isInvalid())
1267SrcExpr =
Self.IgnoredValueConversions(SrcExpr.get());
1272!isPlaceholder(BuiltinType::Overload)) {
1273SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
1274 if(SrcExpr.isInvalid())
1278 unsignedmsg = diag::err_bad_cxx_cast_generic;
1281OpRange, msg, Kind, BasePath,
false);
1283 if(SrcExpr.isInvalid())
1285 if(SrcExpr.get()->getType() ==
Self.Context.OverloadTy) {
1287 Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload)
1288<< oe->
getName() << DestType << OpRange
1290 Self.NoteAllOverloadCandidates(SrcExpr.get());
1298 if(Kind == CK_BitCast)
1300 if(
Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers())
1315DestPtrType->getPointeeType().getAddressSpace();
1325 boolListInitialization) {
1351OpRange, msg, Kind, BasePath);
1366Kind, ListInitialization);
1388 if(
Enum->getDecl()->isScoped()) {
1390Kind = CK_IntegralToBoolean;
1393Kind = CK_IntegralCast;
1396Kind = CK_IntegralToFloating;
1411 if(
Self.RequireCompleteType(OpRange.
getBegin(), DestType,
1412diag::err_bad_cast_incomplete)) {
1420Kind =
Enum->getDecl()->isFixed() &&
1421 Enum->getDecl()->getIntegerType()->isBooleanType()
1422? CK_IntegralToBoolean
1426Kind = CK_FloatingToIntegral;
1442OpRange, msg, Kind, BasePath);
1465 if(DestPointeeQuals != SrcPointeeQuals &&
1467 Self.getASTContext())) {
1468msg = diag::err_bad_cxx_cast_qualifiers_away;
1473? CK_AddressSpaceConversion
1480 if(!CStyle &&
Self.getLangOpts().MSVCCompat &&
1482 Self.Diag(OpRange.
getBegin(), diag::ext_ms_cast_fn_obj) << OpRange;
1490Kind = CK_CPointerToObjCPointerCast;
1495Kind = CK_AnyPointerToBlockPointerCast;
1509 Self.ObjC().CheckTollFreeBridgeStaticCast(DestType, SrcExpr.
get(), Kind))
1516 if(SrcPointer->getPointeeType()->getAs<
RecordType>() &&
1518msg = diag::err_bad_cxx_cast_unrelated_class;
1521 if(
Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind)) {
1559SrcExpr->
getBeginLoc(), ToType, FromType, &RefConv);
1566msg = SrcExpr->
isLValue() ? diag::err_bad_lvalue_to_rvalue_cast
1567: diag::err_bad_rvalue_to_rvalue_cast;
1571 if(RefConv & Sema::ReferenceConversions::DerivedToBase) {
1572Kind = CK_DerivedToBase;
1579 Self.BuildBasePathArray(Paths, BasePath);
1602 if(!DestReference) {
1606 if(!RValueRef && !SrcExpr->
isLValue()) {
1608msg = diag::err_bad_cxx_cast_rvalue;
1618 Self.Context.getCanonicalType(SrcExpr->
getType()),
1619 Self.Context.getCanonicalType(DestPointee), CStyle,
1620OpRange, SrcExpr->
getType(), DestType, msg, Kind,
1645msg = diag::err_bad_static_cast_pointer_nonpointer;
1652CStyle, OpRange, SrcType, DestType, msg, Kind,
1662 QualTypeOrigDestType,
unsigned&msg,
1665 if(!
Self.isCompleteType(OpRange.
getBegin(), SrcType) ||
1666!
Self.isCompleteType(OpRange.
getBegin(), DestType))
1676 if(!
Self.IsDerivedFrom(OpRange.
getBegin(), DestType, SrcType, Paths)) {
1701msg = diag::err_bad_cxx_cast_qualifiers_away;
1710 if(!Paths.isRecordingPaths()) {
1712Paths.setRecordingPaths(
true);
1713 Self.IsDerivedFrom(OpRange.
getBegin(), DestType, SrcType, Paths);
1715std::string PathDisplayStr;
1716std::set<unsigned> DisplayedPaths;
1718 if(DisplayedPaths.insert(
Path.back().SubobjectNumber).second) {
1721PathDisplayStr +=
"\n ";
1723PathDisplayStr += PE.Base->getType().getAsString() +
" -> ";
1728 Self.Diag(OpRange.
getBegin(), diag::err_ambiguous_base_to_derived_cast)
1731<< PathDisplayStr << OpRange;
1736 if(Paths.getDetectedVirtual() !=
nullptr) {
1738 Self.Diag(OpRange.
getBegin(), diag::err_static_downcast_via_virtual)
1739<< OrigSrcType << OrigDestType <<
VirtualBase<< OpRange;
1745 switch(
Self.CheckBaseClassAccess(OpRange.
getBegin(),
1748diag::err_downcast_from_inaccessible_base)) {
1760 Self.BuildBasePathArray(Paths, BasePath);
1761Kind = CK_BaseToDerived;
1782 boolWasOverloadedFunction =
false;
1786=
Self.ResolveAddressOfOverloadedFunction(SrcExpr.
get(), DestType,
false,
1789SrcType =
Self.Context.getMemberPointerType(Fn->getType(),
1790 Self.Context.getTypeDeclType(M->
getParent()).getTypePtr());
1791WasOverloadedFunction =
true;
1797msg = diag::err_bad_static_cast_member_pointer_nonmp;
1803 if(
Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) {
1804(void)
Self.isCompleteType(OpRange.
getBegin(), SrcType);
1805(void)
Self.isCompleteType(OpRange.
getBegin(), DestType);
1818 if(!
Self.IsDerivedFrom(OpRange.
getBegin(), SrcClass, DestClass, Paths))
1822 if(Paths.isAmbiguous(
Self.Context.getCanonicalType(DestClass))) {
1824Paths.setRecordingPaths(
true);
1826 Self.IsDerivedFrom(OpRange.
getBegin(), SrcClass, DestClass, Paths);
1829std::string PathDisplayStr =
Self.getAmbiguousPathsDisplayString(Paths);
1830 Self.Diag(OpRange.
getBegin(), diag::err_ambiguous_memptr_conv)
1831<< 1 << SrcClass << DestClass << PathDisplayStr << OpRange;
1836 if(
const RecordType*VBase = Paths.getDetectedVirtual()) {
1837 Self.Diag(OpRange.
getBegin(), diag::err_memptr_conv_via_virtual)
1838<< SrcClass << DestClass <<
QualType(VBase, 0) << OpRange;
1844 switch(
Self.CheckBaseClassAccess(OpRange.
getBegin(),
1845DestClass, SrcClass,
1847diag::err_upcast_to_inaccessible_base)) {
1861 if(WasOverloadedFunction) {
1873SrcExpr =
Self.FixOverloadedFunctionReference(SrcExpr, FoundOverload, Fn);
1880 Self.BuildBasePathArray(Paths, BasePath);
1881Kind = CK_DerivedToBaseMemberPointer;
1894 CastKind&Kind,
boolListInitialization) {
1896 if(
Self.RequireCompleteType(OpRange.
getBegin(), DestType,
1897diag::err_bad_cast_incomplete) ||
1898 Self.RequireNonAbstractType(OpRange.
getBegin(), DestType,
1899diag::err_allocation_of_abstract_type)) {
1914 Expr*SrcExprRaw = SrcExpr.
get();
1931 if(
Result.isInvalid()) {
1937Kind = CK_ConstructorConversion;
1950DestType =
Self.Context.getCanonicalType(DestType);
1952 boolNeedToMaterializeTemporary =
false;
1966 if(isa<LValueReferenceType>(DestTypeTmp) && !SrcExpr.
get()->
isLValue()) {
1970msg = diag::err_bad_cxx_cast_rvalue;
1974 if(isa<RValueReferenceType>(DestTypeTmp) && SrcExpr.
get()->
isPRValue()) {
1978msg = diag::err_bad_cxx_cast_rvalue;
1984NeedToMaterializeTemporary =
true;
1993msg = diag::err_bad_cxx_cast_bitfield;
1997DestType =
Self.Context.getPointerType(DestTypeTmp->getPointeeType());
1998SrcType =
Self.Context.getPointerType(SrcType);
2013msg = diag::err_bad_const_cast_dest;
2022msg = diag::err_bad_const_cast_dest;
2032 if(!
Self.Context.hasCvrSimilarType(SrcType, DestType))
2035 if(NeedToMaterializeTemporary)
2038SrcExpr =
Self.CreateMaterializeTemporaryExpr(SrcExpr.
get()->
getType(),
2053 unsignedDiagID = IsDereference ?
2054diag::warn_pointer_indirection_from_incompatible_type :
2055diag::warn_undefined_reinterpret_cast;
2061 if(IsDereference) {
2107 if(
Self.Context.hasSameType(SrcType, DestType))
2110 if(SrcPtrTy->isObjCSelType()) {
2112 if(isa<PointerType>(DestType))
2116diag::warn_cast_pointer_from_sel)
2128 if(
Self.Context.hasSameType(SrcType, DstType) ||
2131 const auto*SrcFTy =
2133 const auto*DstFTy =
2143 if(
auto*UO = dyn_cast<UnaryOperator>(Src))
2144 if(UO->getOpcode() == UO_AddrOf)
2146 auto*DRE = dyn_cast<DeclRefExpr>(Src);
2149 auto*FD = dyn_cast<FunctionDecl>(DRE->getDecl());
2157 CallingConvDefaultCC =
Self.getASTContext().getDefaultCallingConvention(
2158FD->isVariadic(), FD->isCXXInstanceMember());
2159 if(DstCC == DefaultCC || SrcCC != DefaultCC)
2165 Self.Diag(OpRange.
getBegin(), diag::warn_cast_calling_conv)
2166<< SrcCCName << DstCCName << OpRange;
2171 if(
Self.Diags.isIgnored(diag::warn_cast_calling_conv, OpRange.
getBegin()))
2178 SourceLocationNameLoc = FD->getFirstDecl()->getNameInfo().getLoc();
2182llvm::raw_svector_ostream OS(CCAttrText);
2183 if(
Self.getLangOpts().MicrosoftExt) {
2185OS <<
"__"<< DstCCName;
2192OS <<
"__attribute__(("<< DstCCName <<
"))";
2193AttrTokens.push_back(tok::kw___attribute);
2194AttrTokens.push_back(tok::l_paren);
2195AttrTokens.push_back(tok::l_paren);
2200AttrTokens.push_back(tok::r_paren);
2201AttrTokens.push_back(tok::r_paren);
2204 if(!AttrSpelling.empty())
2205CCAttrText = AttrSpelling;
2207 Self.Diag(NameLoc, diag::note_change_calling_conv_fixit)
2223&&
Self.Context.getTypeSize(DestType) >
2224 Self.Context.getTypeSize(SrcType)) {
2231diag::warn_int_to_void_pointer_cast
2232: diag::warn_int_to_pointer_cast;
2248 if(
Self.ResolveAndFixSingleFunctionTemplateSpecialization(
2259 if(!
Self.resolveAndFixAddressOfSingleOverloadCandidate(
2262 return Result.isUsable();
2270 boolIsLValueCast =
false;
2272DestType =
Self.Context.getCanonicalType(DestType);
2277 if(SrcType ==
Self.Context.OverloadTy) {
2282assert(FixedExpr.
isUsable() &&
"Invalid result fixing overloaded expr");
2283SrcExpr = FixedExpr;
2291msg = diag::err_bad_cxx_cast_rvalue;
2296 Self.CheckCompatibleReinterpretCast(SrcType, DestType,
2304 const char*inappropriate =
nullptr;
2309msg = diag::err_bad_cxx_cast_bitfield;
2314inappropriate =
"matrix element";
2316 case OK_ObjCProperty: inappropriate =
"property expression";
break;
2317 case OK_ObjCSubscript: inappropriate =
"container subscripting expression";
2320 if(inappropriate) {
2321 Self.Diag(OpRange.
getBegin(), diag::err_bad_reinterpret_cast_reference)
2322<< inappropriate << DestType
2329DestType =
Self.Context.getPointerType(DestTypeTmp->getPointeeType());
2330SrcType =
Self.Context.getPointerType(SrcType);
2332IsLValueCast =
true;
2336SrcType =
Self.Context.getCanonicalType(SrcType);
2340 if(DestMemPtr && SrcMemPtr) {
2346SrcMemPtr->isMemberFunctionPointer())
2349 if(
Self.Context.getTargetInfo().getCXXABI().isMicrosoft()) {
2352(void)
Self.isCompleteType(OpRange.
getBegin(), SrcType);
2353(void)
Self.isCompleteType(OpRange.
getBegin(), DestType);
2357 if(
Self.Context.getTypeSize(DestMemPtr) !=
2358 Self.Context.getTypeSize(SrcMemPtr)) {
2359msg = diag::err_bad_cxx_cast_member_pointer_size;
2373assert(!IsLValueCast);
2374Kind = CK_ReinterpretMemberPointer;
2384 if(
Self.Context.getTypeSize(SrcType) >
2385 Self.Context.getTypeSize(DestType)) {
2386msg = diag::err_bad_reinterpret_cast_small_int;
2389Kind = CK_PointerToIntegral;
2397 if(srcIsVector || destIsVector) {
2399 if(
Self.isValidSveBitcast(SrcType, DestType)) {
2405 if(
Self.RISCV().isValidRVVBitcast(SrcType, DestType)) {
2419 if(
Self.areLaxCompatibleVectorTypes(SrcType, DestType)) {
2424 if(
Self.LangOpts.OpenCL && !CStyle) {
2427 if(
Self.areVectorTypesSameSize(SrcType, DestType)) {
2436msg = diag::err_bad_cxx_cast_vector_to_scalar_different_size;
2437 else if(!srcIsVector)
2438msg = diag::err_bad_cxx_cast_scalar_to_vector_different_size;
2440msg = diag::err_bad_cxx_cast_vector_to_vector_different_size;
2445 if(SrcType == DestType) {
2469 if(!destIsPtr && !srcIsPtr) {
2476assert(srcIsPtr &&
"One type must be a pointer");
2480 if((
Self.Context.getTypeSize(SrcType) >
2481 Self.Context.getTypeSize(DestType))) {
2482 boolMicrosoftException =
2484 if(MicrosoftException) {
2486? diag::warn_void_pointer_to_int_cast
2487: diag::warn_pointer_to_int_cast;
2490msg = diag::err_bad_reinterpret_cast_small_int;
2494Kind = CK_PointerToIntegral;
2499assert(destIsPtr &&
"One type must be a pointer");
2505Kind = CK_IntegralToPointer;
2509 if(!destIsPtr || !srcIsPtr) {
2529Kind = CK_AddressSpaceConversion;
2536}
else if(IsLValueCast) {
2537Kind = CK_LValueBitCast;
2539Kind =
Self.ObjC().PrepareCastToObjCObjectPointer(SrcExpr);
2542Kind = CK_AnyPointerToBlockPointerCast;
2553 returnSuccessResult;
2567 returnSuccessResult;
2577 Self.getLangOpts().CPlusPlus11 ?
2578diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj)
2580 returnSuccessResult;
2586 Self.getLangOpts().CPlusPlus11 ?
2587diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj)
2589 returnSuccessResult;
2602diag::warn_bad_cxx_cast_nested_pointer_addr_space)
2615 returnSuccessResult;
2621 if(!
Self.getLangOpts().OpenCL && !
Self.getLangOpts().SYCLIsDevice)
2638 autoSrcPointeeType = SrcPtrType->getPointeeType();
2639 autoDestPointeeType = DestPtrType->getPointeeType();
2640 if(!DestPointeeType.isAddressSpaceOverlapping(SrcPointeeType,
2641 Self.getASTContext())) {
2642msg = diag::err_bad_cxx_cast_addr_space_mismatch;
2645 autoSrcPointeeTypeWithoutAS =
2646 Self.Context.removeAddrSpaceQualType(SrcPointeeType.getCanonicalType());
2647 autoDestPointeeTypeWithoutAS =
2648 Self.Context.removeAddrSpaceQualType(DestPointeeType.getCanonicalType());
2649 if(
Self.Context.hasSameType(SrcPointeeTypeWithoutAS,
2650DestPointeeTypeWithoutAS)) {
2651Kind = SrcPointeeType.getAddressSpace() == DestPointeeType.getAddressSpace()
2653: CK_AddressSpaceConversion;
2660voidCastOperation::checkAddressSpaceCast(
QualTypeSrcType,
QualTypeDestType) {
2672 if(
Self.getLangOpts().OpenCL) {
2673 const Type*DestPtr, *SrcPtr;
2674 boolNested =
false;
2675 unsignedDiagID = diag::err_typecheck_incompatible_address_space;
2676DestPtr =
Self.getASTContext().getCanonicalType(DestType.
getTypePtr()),
2677SrcPtr =
Self.getASTContext().getCanonicalType(SrcType.
getTypePtr());
2679 while(isa<PointerType>(DestPtr) && isa<PointerType>(SrcPtr)) {
2680 const PointerType*DestPPtr = cast<PointerType>(DestPtr);
2681 const PointerType*SrcPPtr = cast<PointerType>(SrcPtr);
2687 Self.getASTContext())) {
2688 Self.Diag(OpRange.getBegin(), DiagID)
2690<< SrcExpr.get()->getSourceRange();
2699DiagID = diag::ext_nested_pointer_qualifier_mismatch;
2705 boolSrcCompatXL = this->
getLangOpts().getAltivecSrcCompat() ==
2719 boolSrcCompatGCC = this->
getLangOpts().getAltivecSrcCompat() ==
2721 if(this->
getLangOpts().AltiVec && SrcCompatGCC) {
2723diag::err_invalid_conversion_between_vector_and_integer)
2724<< VecTy << SrcTy << R;
2730voidCastOperation::CheckCXXCStyleCast(
boolFunctionalStyle,
2731 boolListInitialization) {
2732assert(
Self.getLangOpts().CPlusPlus);
2735 if(isPlaceholder()) {
2737 if(claimPlaceholder(BuiltinType::UnknownAny)) {
2738SrcExpr =
Self.checkUnknownAnyCast(DestRange, DestType,
2739SrcExpr.get(), Kind,
2740ValueKind, BasePath);
2744checkNonOverloadPlaceholders();
2745 if(SrcExpr.isInvalid())
2755 if(claimPlaceholder(BuiltinType::Overload)) {
2756 Self.ResolveAndFixSingleFunctionTemplateSpecialization(
2758 true, DestRange, DestType,
2759diag::err_bad_cstyle_cast_overload);
2760 if(SrcExpr.isInvalid())
2764SrcExpr =
Self.IgnoredValueConversions(SrcExpr.get());
2769 if(DestType->
isDependentType() || SrcExpr.get()->isTypeDependent() ||
2770SrcExpr.get()->isValueDependent()) {
2771assert(Kind == CK_Dependent);
2776!isPlaceholder(BuiltinType::Overload)) {
2777SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
2778 if(SrcExpr.isInvalid())
2784 if(
Self.CheckAltivecInitFromScalar(OpRange, DestType,
2785SrcExpr.get()->getType())) {
2789 if(
Self.ShouldSplatAltivecScalarInCast(vecTy) &&
2790(SrcExpr.get()->getType()->isIntegerType() ||
2791SrcExpr.get()->getType()->isFloatingType())) {
2792 Kind= CK_VectorSplat;
2793SrcExpr =
Self.prepareVectorSplat(DestType, SrcExpr.get());
2799 QualTypeSrcType = SrcExpr.get()->getType();
2801 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table)
2802<< 1 << SrcExpr.get()->getSourceRange();
2819 unsignedmsg = diag::err_bad_cxx_cast_generic;
2822 if(SrcExpr.isInvalid())
2833 if(SrcExpr.isInvalid())
2840BasePath, ListInitialization);
2841 if(SrcExpr.isInvalid())
2847OpRange, msg, Kind);
2848 if(SrcExpr.isInvalid())
2854 if(
Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
2856checkObjCConversion(CCK);
2859 if(SrcExpr.get()->getType() ==
Self.Context.OverloadTy) {
2870 Self.Diag(OpRange.getBegin(), diag::err_bad_cstyle_cast_overload)
2871<< OE->
getName() << DestType << OpRange
2873 Self.NoteAllOverloadCandidates(SrcExpr.get());
2877OpRange, SrcExpr.get(), DestType, ListInitialization);
2882 if(Kind == CK_BitCast)
2886 Self.Diag(OpRange.getBegin(), DiagID)
2887<< SrcExpr.get()->getType() << DestType << OpRange;
2899 if(
Self.Diags.isIgnored(diag::warn_bad_function_cast,
2903 if(!isa<CallExpr>(SrcExpr.
get()))
2928diag::warn_bad_function_cast)
2933voidCastOperation::CheckCStyleCast() {
2934assert(!
Self.getLangOpts().CPlusPlus);
2937 if(claimPlaceholder(BuiltinType::UnknownAny)) {
2938SrcExpr =
Self.checkUnknownAnyCast(DestRange, DestType,
2939SrcExpr.get(), Kind,
2940ValueKind, BasePath);
2948SrcExpr =
Self.IgnoredValueConversions(SrcExpr.get());
2949 if(SrcExpr.isInvalid())
2958 if(
Self.getASTContext().isDependenceAllowed() &&
2960SrcExpr.get()->isValueDependent())) {
2961assert((DestType->
containsErrors() || SrcExpr.get()->containsErrors() ||
2962SrcExpr.get()->containsErrors()) &&
2963 "should only occur in error-recovery path.");
2964assert(Kind == CK_Dependent);
2969 if(SrcExpr.get()->getType() ==
Self.Context.OverloadTy) {
2972SrcExpr.get(), DestType,
true, DAP))
2973SrcExpr =
Self.FixOverloadedFunctionReference(SrcExpr.get(), DAP, FD);
2976assert(SrcExpr.isUsable());
2978SrcExpr =
Self.DefaultFunctionArrayLvalueConversion(SrcExpr.get());
2979 if(SrcExpr.isInvalid())
2981 QualTypeSrcType = SrcExpr.get()->getType();
2984 Self.Diag(OpRange.getBegin(), diag::err_wasm_cast_table)
2985<< 1 << SrcExpr.get()->getSourceRange();
2992checkAddressSpaceCast(SrcType, DestType);
2993 if(SrcExpr.isInvalid())
2996 if(
Self.RequireCompleteType(OpRange.getBegin(), DestType,
2997diag::err_typecheck_cast_to_incomplete)) {
3004 Self.Context.hasSameUnqualifiedType(DestType, SrcType)) {
3011 Self.isValidSveBitcast(SrcType, DestType)) {
3018 Self.RISCV().isValidRVVBitcast(SrcType, DestType)) {
3027 if(DestRecordTy &&
Self.Context.hasSameUnqualifiedType(DestType, SrcType)){
3029 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_nonscalar)
3030<< DestType << SrcExpr.get()->getSourceRange();
3039 Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union)
3040<< SrcExpr.get()->getSourceRange();
3044 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type)
3045<< SrcType << SrcExpr.get()->getSourceRange();
3052 if(
Self.getLangOpts().OpenCL && DestType->
isEventT()) {
3054 if(SrcExpr.get()->EvaluateAsInt(
Result,
Self.Context)) {
3055llvm::APSInt CastInt =
Result.Val.getInt();
3057 Kind= CK_ZeroToOCLOpaqueType;
3060 Self.Diag(OpRange.getBegin(),
3061diag::err_opencl_cast_non_zero_to_event_t)
3062<<
toString(CastInt, 10) << SrcExpr.get()->getSourceRange();
3069 Self.Diag(OpRange.getBegin(), diag::err_typecheck_cond_expect_scalar)
3070<< DestType << SrcExpr.get()->getSourceRange();
3080 Self.Diag(SrcExpr.get()->getExprLoc(),
3081diag::err_typecheck_expect_scalar_operand)
3082<< SrcType << SrcExpr.get()->getSourceRange();
3097 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast)
3108 Self.CurFPFeatureOverrides());
3112 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast)
3119SrcExpr =
Self.CheckExtVectorCast(OpRange, DestType, SrcExpr.get(), Kind);
3124 if(
Self.CheckMatrixCast(OpRange, DestType, SrcType, Kind))
3130 if(
Self.CheckAltivecInitFromScalar(OpRange, DestType, SrcType)) {
3134 if(
Self.ShouldSplatAltivecScalarInCast(DestVecTy) &&
3136 Kind= CK_VectorSplat;
3137SrcExpr =
Self.prepareVectorSplat(DestType, SrcExpr.get());
3138}
else if(
Self.CheckVectorCast(OpRange, DestType, SrcType, Kind)) {
3145 if(
Self.CheckVectorCast(OpRange, SrcType, DestType, Kind))
3155 if(isa<ObjCSelectorExpr>(SrcExpr.get())) {
3156 Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_cast_selector_expr);
3165 Self.Diag(SrcExpr.get()->getExprLoc(),
3166diag::err_cast_pointer_from_non_pointer_int)
3167<< SrcType << SrcExpr.get()->getSourceRange();
3176 Self.Diag(SrcExpr.get()->getBeginLoc(),
3177diag::err_cast_pointer_to_non_pointer_int)
3178<< DestType << SrcExpr.get()->getSourceRange();
3183 if((
Self.Context.getTypeSize(SrcType) >
3184 Self.Context.getTypeSize(DestType)) &&
3194: diag::warn_void_pointer_to_int_cast;
3196 Diag= diag::warn_pointer_to_enum_cast;
3198 Diag= diag::warn_pointer_to_int_cast;
3199 Self.Diag(OpRange.getBegin(),
Diag) << SrcType << DestType << OpRange;
3203 if(
Self.getLangOpts().OpenCL && !
Self.getOpenCLOptions().isAvailableOption(
3204 "cl_khr_fp16",
Self.getLangOpts())) {
3206 Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half)
3207<< DestType << SrcExpr.get()->getSourceRange();
3214 if(
Self.getLangOpts().allowsNonTrivialObjCLifetimeQualifiers()) {
3216 if(SrcExpr.isInvalid())
3220 if(
Self.getLangOpts().ObjCAutoRefCount && CastPtr) {
3223 QualifiersExprQuals = ExprPtr->getPointeeType().getQualifiers();
3225ExprPtr->getPointeeType()->isObjCLifetimeType() &&
3227 Self.Diag(SrcExpr.get()->getBeginLoc(),
3228diag::err_typecheck_incompatible_ownership)
3230<< SrcExpr.get()->getSourceRange();
3234}
else if(!
Self.ObjC().CheckObjCARCUnavailableWeakConversion(DestType,
3236 Self.Diag(SrcExpr.get()->getBeginLoc(),
3237diag::err_arc_convesion_of_weak_unavailable)
3238<< 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
3245 Self.Diag(OpRange.getBegin(), DiagID) << SrcType << DestType << OpRange;
3247 if(isa<PointerType>(SrcType) && isa<PointerType>(DestType)) {
3254 if(SrcRD && DestRD && SrcRD->
hasAttr<RandomizeLayoutAttr>() &&
3257 Self.Diag(OpRange.getBegin(), diag::err_cast_from_randomized_struct)
3258<< SrcType << DestType;
3267 Kind=
Self.PrepareScalarCast(SrcExpr, DestType);
3268 if(SrcExpr.isInvalid())
3271 if(Kind == CK_BitCast)
3275voidCastOperation::CheckBuiltinBitCast() {
3276 QualTypeSrcType = SrcExpr.get()->getType();
3278 if(
Self.RequireCompleteType(OpRange.getBegin(), DestType,
3279diag::err_typecheck_cast_to_incomplete) ||
3280 Self.RequireCompleteType(OpRange.getBegin(), SrcType,
3281diag::err_incomplete_type)) {
3286 if(SrcExpr.get()->isPRValue())
3287SrcExpr =
Self.CreateMaterializeTemporaryExpr(SrcType, SrcExpr.get(),
3290 CharUnitsDestSize =
Self.Context.getTypeSizeInChars(DestType);
3291 CharUnitsSourceSize =
Self.Context.getTypeSizeInChars(SrcType);
3292 if(DestSize != SourceSize) {
3293 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_type_size_mismatch)
3301 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable)
3308 Self.Diag(OpRange.getBegin(), diag::err_bit_cast_non_trivially_copyable)
3314 Kind= CK_LValueToRValueBitCast;
3329 QualTypeTheOffendingSrcType, TheOffendingDestType;
3332&TheOffendingSrcType, &TheOffendingDestType,
3333&CastAwayQualifiers) !=
3334CastAwayConstnessKind::CACK_Similar)
3338 intqualifiers = -1;
3341}
else if(CastAwayQualifiers.
hasConst()) {
3347 if(qualifiers == -1)
3349<< SrcType << DestType;
3352<< TheOffendingSrcType << TheOffendingDestType << qualifiers;
3364Op.CheckCXXCStyleCast(
false,
3367Op.CheckCStyleCast();
3370 if(Op.SrcExpr.isInvalid())
3377 Context, Op.ResultType, Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
3386assert(LPLoc.
isValid() &&
"List-initialization shouldn't get here.");
3389Op.OpRange =
SourceRange(Op.DestRange.getBegin(), RPLoc);
3391Op.CheckCXXCStyleCast(
true,
false);
3392 if(Op.SrcExpr.isInvalid())
3395 auto*SubExpr = Op.SrcExpr.get();
3396 if(
auto*BindExpr = dyn_cast<CXXBindTemporaryExpr>(SubExpr))
3397SubExpr = BindExpr->getSubExpr();
3398 if(
auto*ConstructExpr = dyn_cast<CXXConstructExpr>(SubExpr))
3399ConstructExpr->setParenOrBraceRange(
SourceRange(LPLoc, RPLoc));
3405 Context, Op.ResultType, Op.ValueKind, CastTypeInfo, Op.Kind,
Defines the clang::ASTContext interface.
Defines the clang::Expr interface and subclasses for C++ expressions.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
static void DiagnoseReinterpretUpDownCast(Sema &Self, const Expr *SrcExpr, QualType DestType, SourceRange OpRange)
Check that a reinterpret_cast<DestType>(SrcExpr) is not used as upcast or downcast between respective...
static CastAwayConstnessKind CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, bool CheckCVR, bool CheckObjCLifetime, QualType *TheOffendingSrcType=nullptr, QualType *TheOffendingDestType=nullptr, Qualifiers *CastAwayQualifiers=nullptr)
Check if the pointer conversion from SrcType to DestType casts away constness as defined in C++ [expr...
static TryCastResult getCastAwayConstnessCastKind(CastAwayConstnessKind CACK, unsigned &DiagID)
static bool IsAddressSpaceConversion(QualType SrcType, QualType DestType)
@ CT_Reinterpret
reinterpret_cast
@ CT_Functional
Type(expr)
@ CT_Dynamic
dynamic_cast
@ CT_Addrspace
addrspace_cast
static TryCastResult TryConstCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, bool CStyle, unsigned &msg)
TryConstCast - See if a const_cast from source to destination is allowed, and perform it if it is.
static bool isValidCast(TryCastResult TCR)
static void diagnoseBadCast(Sema &S, unsigned msg, CastType castType, SourceRange opRange, Expr *src, QualType destType, bool listInitialization)
Diagnose a failed cast.
static bool tryDiagnoseOverloadedCast(Sema &S, CastType CT, SourceRange range, Expr *src, QualType destType, bool listInitialization)
Try to diagnose a failed overloaded cast.
static bool argTypeIsABIEquivalent(QualType SrcType, QualType DestType, ASTContext &Context)
static unsigned int checkCastFunctionType(Sema &Self, const ExprResult &SrcExpr, QualType DestType)
@ TC_Success
The cast method is appropriate and successful.
@ TC_Extension
The cast method is appropriate and accepted as a language extension.
@ TC_Failed
The cast method is appropriate, but failed.
@ TC_NotApplicable
The cast method is not applicable.
static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType, bool CStyle, SourceRange OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath)
Tests whether a conversion according to C++ 5.2.9p5 is valid.
static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr, QualType DestType)
DiagnoseCastQual - Warn whenever casts discards a qualifiers, be it either const, volatile or both.
static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, CheckedConversionKind CCK, SourceRange OpRange, unsigned &msg, CastKind &Kind, bool ListInitialization)
TryStaticImplicitCast - Tests whether a conversion according to C++ 5.2.9p2 is valid:
static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr, QualType DestType)
static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr, QualType DestType)
DiagnoseBadFunctionCast - Warn whenever a function call is cast to a non-matching type.
static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType, bool CStyle, SourceRange OpRange, QualType OrigSrcType, QualType OrigDestType, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath)
TryStaticDowncast - Common functionality of TryStaticReferenceDowncast and TryStaticPointerDowncast.
static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, bool CStyle, SourceRange OpRange, unsigned &msg, CastKind &Kind)
static bool fixOverloadedReinterpretCastExpr(Sema &Self, QualType DestType, ExprResult &Result)
static CastAwayConstnessKind unwrapCastAwayConstnessLevel(ASTContext &Context, QualType &T1, QualType &T2)
Unwrap one level of types for CastsAwayConstness.
static void DiagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr, QualType DstType, SourceRange OpRange)
Diagnose casts that change the calling convention of a pointer to a function defined in the current T...
static TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType, bool CStyle, CastKind &Kind, CXXCastPath &BasePath, unsigned &msg)
Tests whether a conversion according to N2844 is valid.
static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType, QualType DestType, bool CStyle, SourceRange OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath)
TryStaticMemberPointerUpcast - Tests whether a conversion according to C++ 5.2.9p9 is valid:
static void checkIntToPointerCast(bool CStyle, const SourceRange &OpRange, const Expr *SrcExpr, QualType DestType, Sema &Self)
static TryCastResult TryAddressSpaceCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, bool CStyle, unsigned &msg, CastKind &Kind)
static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType, bool CStyle, SourceRange OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath)
Tests whether a conversion according to C++ 5.2.9p8 is valid.
static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, CheckedConversionKind CCK, SourceRange OpRange, unsigned &msg, CastKind &Kind, CXXCastPath &BasePath, bool ListInitialization)
TryStaticCast - Check if a static cast can be performed, and do so if possible.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis functions specific to RISC-V.
static QualType getPointeeType(const MemRegion *R)
TextDiagnosticBuffer::DiagList DiagList
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
Represents a C++2a __builtin_bit_cast(T, v) expression.
This class is used for builtin types like 'int'.
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, FPOptionsOverride FPO, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
static CXXAddrspaceCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
std::list< CXXBasePath >::const_iterator const_paths_iterator
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXDynamicCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, FPOptionsOverride FPO, SourceLocation LPLoc, SourceLocation RPLoc)
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a C++ struct/union/class.
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
static CXXReinterpretCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, FPOptionsOverride FPO, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
bool isAtLeastAsQualifiedAs(CanQual< T > Other, const ASTContext &Ctx) const
Determines whether this canonical type is at least as qualified as the Other canonical type.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
static const FieldDecl * getTargetFieldForToUnionCast(QualType unionType, QualType opType)
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
A POD class for pairing a NamedDecl* with an access specifier.
bool isInvalidDecl() const
Information about one declarator, including the parsed type information and the identifier.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
FunctionType - C99 6.7.5.3 - Function Declarators.
static StringRef getNameForCallConv(CallingConv CC)
CallingConv getCallConv() const
QualType getReturnType() const
One of these records is kept for each identifier that is lexed.
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool isKeyword(const LangOptions &LangOpts) const
Return true if this token is a keyword in the specified language.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateCast(SourceRange TypeRange)
Create a direct initialization due to a cast that isn't a C-style or functional cast.
static InitializationKind CreateFunctionalCast(SourceRange TypeRange, bool InitList)
Create a direct initialization for a functional cast.
static InitializationKind CreateCStyleCast(SourceLocation StartLoc, SourceRange TypeRange, bool InitList)
Create a direct initialization for a C-style cast.
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
FailureKind getFailureKind() const
Determine why initialization failed.
OverloadingResult getFailedOverloadResult() const
Get the overloading result, for when the initialization sequence failed due to a bad overload.
bool Failed() const
Determine whether the initialization sequence is invalid.
@ FK_UserConversionOverloadFailed
Overloading for a user-defined conversion failed.
@ FK_ConstructorOverloadFailed
Overloading for initialization by constructor failed.
@ FK_ParenthesizedListInitFailed
Parenthesized list initialization failed at some point.
bool isConstructorInitialization() const
Determine whether this initialization is direct call to a constructor.
OverloadCandidateSet & getFailedCandidateSet()
Retrieve a reference to the candidate set when overload resolution fails.
Describes an entity that is being initialized.
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
Represents a matrix type, as defined in the Matrix Types clang extensions.
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
const Type * getClass() const
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
SmallVectorImpl< OverloadCandidate >::iterator iterator
void NoteCandidates(PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
When overload resolution fails, prints diagnostic messages containing the candidates in the candidate...
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
DeclarationName getName() const
Gets the name looked up.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
StringRef getLastMacroWithSpelling(SourceLocation Loc, ArrayRef< TokenValue > Tokens) const
Return the name of the macro defined before Loc that has spelling Tokens.
A (possibly-)qualified type.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
bool isAddressSpaceOverlapping(QualType T, const ASTContext &Ctx) const
Returns true if address space qualifiers overlap with T address space qualifiers.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
QualType withCVRQualifiers(unsigned CVR) const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool isAtLeastAsQualifiedAs(QualType Other, const ASTContext &Ctx) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeObjCLifetime()
bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
static Qualifiers fromCVRMask(unsigned CVR)
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Sema - This implements semantic analysis and AST building for C.
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
FPOptionsOverride CurFPFeatureOverrides()
bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
const LangOptions & getLangOpts() const
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
DiagnosticsEngine & Diags
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
bool CheckAltivecInitFromScalar(SourceRange R, QualType VecTy, QualType SrcTy)
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
StringRef getString() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Stores token information for comparing actual tokens with predefined values.
Base wrapper for a particular "section" of type source info.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
SourceLocation getEndLoc() const
Get the end source location.
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isFunctionReferenceType() const
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
bool isRValueReferenceType() const
bool isConstantArrayType() const
bool isVoidPointerType() const
bool isFunctionPointerType() const
bool isArithmeticType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
bool isScalarType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isSizelessBuiltinType() const
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isExtVectorType() const
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isLValueReferenceType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const BuiltinType * getAsPlaceholderType() const
bool isWebAssemblyTableType() const
Returns true if this is a WebAssembly table type: either an array of reference types,...
bool containsErrors() const
Whether this type is an error type.
bool isMemberPointerType() const
bool isMatrixType() const
bool isComplexIntegerType() const
bool isObjCObjectType() const
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isMemberFunctionPointerType() const
bool isVectorType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
bool isRecordType() const
bool isFunctionNoProtoType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Represents a GCC generic vector type.
VectorKind getVectorKind() const
Defines the clang::TargetInfo interface.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadingResult
OverloadingResult - Capture the result of performing overload resolution.
@ OR_Deleted
Succeeded, but refers to a deleted function.
@ OR_Success
Overload resolution succeeded.
@ OR_Ambiguous
Ambiguous candidates found.
@ OR_No_Viable_Function
No viable function found.
OverloadCandidateDisplayKind
@ OCD_AmbiguousCandidates
Requests that only tied-for-best candidates be shown.
@ OCD_ViableCandidates
Requests that only viable candidates be shown.
@ OCD_AllCandidates
Requests that all candidates be shown.
@ OK_VectorComponent
A vector component is an element or range of elements on a vector.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
@ OK_ObjCSubscript
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
@ OK_MatrixComponent
A matrix component is a single element of a matrix.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
const FunctionProtoType * T
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ AltiVecBool
is AltiVec 'vector bool ...'
@ AltiVecVector
is AltiVec vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ None
The alignment was not explicit in code.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Parens
New-expression has a C++98 paren-delimited initializer.
CheckedConversionKind
The kind of conversion being performed.
@ CStyleCast
A C-style cast.
@ OtherCast
A cast other than a C-style cast.
@ FunctionalCast
A functional-style cast.
Represents an element in a path from a derived class to a base class.
EvalResult is a struct with detailed info about an evaluated expression.
OverloadExpr * Expression
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4