54#include "llvm/ADT/STLExtras.h"
55#include "llvm/ADT/StringExtras.h"
56#include "llvm/Support/Casting.h"
57#include "llvm/Support/ConvertUTF.h"
58#include "llvm/Support/SaveAndRestore.h"
59#include "llvm/Support/TypeSize.h"
85 if (TreatUnavailableAsInvalid &&
95 if (isa<UnresolvedUsingIfExistsDecl>(D))
103 if (
const auto *A = D->
getAttr<UnusedAttr>()) {
106 if (A->getSemanticSpelling() != UnusedAttr::CXX11_maybe_unused &&
107 A->getSemanticSpelling() != UnusedAttr::C2x_maybe_unused) {
109 if (DC && !DC->
hasAttr<UnusedAttr>())
110 S.
Diag(Loc, diag::warn_used_but_marked_unused) << D;
119 if (
Decl->isDefaulted()) {
130 auto *Ctor = dyn_cast<CXXConstructorDecl>(
Decl);
131 if (Ctor && Ctor->isInheritingConstructor())
142 if (I->getStorageClass() !=
SC_None)
169 if (!Current->isInlined())
171 if (!Current->isExternallyVisible())
187 if (!DowngradeWarning && UsedFn)
190 S.
Diag(Loc, DowngradeWarning ? diag::ext_internal_in_extern_inline_quiet
191 : diag::ext_internal_in_extern_inline)
206 Diag(DeclBegin, diag::note_convert_inline_to_static)
225 bool ObjCPropertyAccess,
226 bool AvoidPartialAvailabilityChecks,
228 bool SkipTrailingRequiresClause) {
236 Diag(Suppressed.first, Suppressed.second);
247 if (cast<FunctionDecl>(D)->isMain())
248 Diag(Loc, diag::ext_main_used);
255 if (isa<BindingDecl>(D)) {
256 Diag(Loc, diag::err_binding_cannot_appear_in_own_initializer)
259 Diag(Loc, diag::err_auto_variable_cannot_appear_in_own_initializer)
260 << D->
getDeclName() << cast<VarDecl>(D)->getType();
267 if (FD->isDeleted()) {
268 auto *Ctor = dyn_cast<CXXConstructorDecl>(FD);
269 if (Ctor && Ctor->isInheritingConstructor())
270 Diag(Loc, diag::err_deleted_inherited_ctor_use)
272 << Ctor->getInheritedConstructor().getConstructor()->getParent();
274 Diag(Loc, diag::err_deleted_function_use);
287 if (!SkipTrailingRequiresClause && FD->getTrailingRequiresClause()) {
296 diag::err_reference_to_function_with_unsatisfied_constraints)
314 if (
auto *MD = dyn_cast<CXXMethodDecl>(D)) {
316 if (MD->getParent()->isLambda() &&
317 ((isa<CXXConstructorDecl>(MD) &&
318 cast<CXXConstructorDecl>(MD)->isDefaultConstructor()) ||
319 MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())) {
320 Diag(Loc, diag::warn_cxx17_compat_lambda_def_ctor_assign)
321 << !isa<CXXConstructorDecl>(MD);
325 auto getReferencedObjCProp = [](
const NamedDecl *D) ->
327 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
342 auto *DRD = dyn_cast<OMPDeclareReductionDecl>(
CurContext);
345 Diag(Loc, diag::err_omp_wrong_var_in_declare_reduction)
356 if (
LangOpts.OpenMP && isa<VarDecl>(D) &&
358 Diag(Loc, diag::err_omp_declare_mapper_wrong_var)
364 if (
const auto *EmptyD = dyn_cast<UnresolvedUsingIfExistsDecl>(D)) {
365 Diag(Loc, diag::err_use_of_empty_using_if_exists);
366 Diag(EmptyD->getLocation(), diag::note_empty_using_if_exists_here);
371 AvoidPartialAvailabilityChecks, ClassReceiver);
377 if (
auto *VD = dyn_cast<ValueDecl>(D))
382 if (
const auto *VD = dyn_cast<VarDecl>(D))
384 targetDiag(*Locs.begin(), diag::err_thread_unsupported);
387 if (isa<ParmVarDecl>(D) && isa<RequiresExprBodyDecl>(D->
getDeclContext()) &&
392 Diag(Loc, diag::err_requires_expr_parameter_referenced_in_evaluated_context)
407 const SentinelAttr *
attr = D->
getAttr<SentinelAttr>();
412 unsigned numFormalParams;
416 enum CalleeType { CT_Function, CT_Method, CT_Block } calleeType;
419 numFormalParams = MD->param_size();
420 calleeType = CT_Method;
421 }
else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
422 numFormalParams = FD->param_size();
423 calleeType = CT_Function;
424 }
else if (isa<VarDecl>(D)) {
430 calleeType = CT_Function;
433 calleeType = CT_Block;
439 numFormalParams = proto->getNumParams();
451 unsigned nullPos =
attr->getNullPos();
452 assert((nullPos == 0 || nullPos == 1) &&
"invalid null position on sentinel");
453 numFormalParams = (nullPos > numFormalParams ? 0 : numFormalParams - nullPos);
456 unsigned numArgsAfterSentinel =
attr->getSentinel();
460 if (Args.size() < numFormalParams + numArgsAfterSentinel + 1) {
467 Expr *sentinelExpr = Args[Args.size() - numArgsAfterSentinel - 1];
468 if (!sentinelExpr)
return;
477 std::string NullValue;
481 NullValue =
"nullptr";
485 NullValue =
"(void*) 0";
488 Diag(Loc, diag::warn_missing_sentinel) <<
int(calleeType);
490 Diag(MissingNilLoc, diag::warn_missing_sentinel)
514 assert(!Ty.
isNull() &&
"DefaultFunctionArrayConversion - missing type");
518 if (
auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl()))
523 CK_FunctionToPointerDecay).
get();
538 CK_ArrayToPointerDecay);
554 if (UO && UO->getOpcode() == UO_Deref &&
555 UO->getSubExpr()->getType()->isPointerType()) {
557 UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
560 UO->getSubExpr()->IgnoreParenCasts()->isNullPointerConstant(
562 !UO->getType().isVolatileQualified()) {
564 S.
PDiag(diag::warn_indirection_through_null)
565 << UO->getSubExpr()->getSourceRange());
567 S.
PDiag(diag::note_indirection_through_null));
599 if (ObjectSetClass) {
643 assert(!T.
isNull() &&
"r-value conversion on typeless expression?");
683 SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()),
")");
731 T = Atomic->getValueType().getUnqualifiedType();
758 CK_FunctionToPointerDecay);
781 assert(!Ty.
isNull() &&
"UsualUnaryConversions - missing type");
788 switch (EvalMethod) {
790 llvm_unreachable(
"Unrecognized float evaluation method");
793 llvm_unreachable(
"Float evaluation method should be set by now");
801 CK_FloatingComplexCast)
810 CK_FloatingComplexCast)
858 assert(!Ty.
isNull() &&
"DefaultArgumentPromotion - missing type");
870 if (BTy && (BTy->
getKind() == BuiltinType::Half ||
871 BTy->
getKind() == BuiltinType::Float)) {
874 if (BTy->
getKind() == BuiltinType::Half) {
892 "Unexpected typesize for LongLongTy");
957 if (!Record->hasNonTrivialCopyConstructor() &&
958 !Record->hasNonTrivialMoveConstructor() &&
959 !Record->hasNonTrivialDestructor())
986 PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
993 PDiag(diag::warn_pass_class_arg_to_vararg)
1001 PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
1008 diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
1012 PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
1016 << isa<InitListExpr>(E) << Ty << CT;
1027 if (PlaceholderTy->getKind() == BuiltinType::ARCUnbridgedCast &&
1029 (FDecl && FDecl->
hasAttr<CFAuditedTransferAttr>()))) {
1068 if (Call.isInvalid())
1073 if (Comma.isInvalid())
1080 diag::err_call_incomplete_argument))
1097 if (SkipCast)
return false;
1102 CK_FloatingRealToComplex);
1106 CK_IntegralComplexToFloatingComplex);
1124 bool PromotePrecision) {
1129 if (PromotePrecision) {
1134 if (LongerIsComplex)
1146 QualType RHSType,
bool IsCompAssign) {
1171 bool ConvertFloat,
bool ConvertInt) {
1176 CK_IntegralToFloating);
1187 CK_IntegralComplexToFloatingComplex);
1192 CK_FloatingRealToComplex);
1201 QualType RHSType,
bool IsCompAssign) {
1211 else if (!IsCompAssign)
1213 return LHSFloat ? LHSType : RHSType;
1218 if (LHSFloat && RHSFloat) {
1225 assert(order < 0 &&
"illegal float comparison");
1259 QualType LHSElem = LHSComplex ? LHSComplex->getElementType() : LHSType;
1265 if ((&LHSSem != &llvm::APFloat::PPCDoubleDouble() ||
1266 &RHSSem != &llvm::APFloat::IEEEquad()) &&
1267 (&LHSSem != &llvm::APFloat::IEEEquad() ||
1268 &RHSSem != &llvm::APFloat::PPCDoubleDouble()))
1285 CK_IntegralComplexCast);
1291template <PerformCastFn doLHSCast, PerformCastFn doRHSCast>
1294 QualType RHSType,
bool IsCompAssign) {
1299 if (LHSSigned == RHSSigned) {
1302 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1304 }
else if (!IsCompAssign)
1305 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1307 }
else if (order != (LHSSigned ? 1 : -1)) {
1311 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1313 }
else if (!IsCompAssign)
1314 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1321 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1323 }
else if (!IsCompAssign)
1324 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1333 RHS = (*doRHSCast)(S, RHS.
get(), result);
1335 LHS = (*doLHSCast)(S, LHS.
get(), result);
1345 bool IsCompAssign) {
1349 if (LHSComplexInt && RHSComplexInt) {
1353 handleIntegerConversion<doComplexIntegralCast, doComplexIntegralCast>
1354 (S, LHS, RHS, LHSEltType, RHSEltType, IsCompAssign);
1359 if (LHSComplexInt) {
1362 handleIntegerConversion<doComplexIntegralCast, doIntegralCast>
1363 (S, LHS, RHS, LHSEltType, RHSType, IsCompAssign);
1366 CK_IntegralRealToComplex);
1371 assert(RHSComplexInt);
1375 handleIntegerConversion<doIntegralCast, doComplexIntegralCast>
1376 (S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
1381 CK_IntegralRealToComplex);
1390 assert(BTy &&
"Expected a builtin type.");
1392 switch (BTy->getKind()) {
1393 case BuiltinType::ShortFract:
1394 case BuiltinType::UShortFract:
1395 case BuiltinType::SatShortFract:
1396 case BuiltinType::SatUShortFract:
1398 case BuiltinType::Fract:
1399 case BuiltinType::UFract:
1400 case BuiltinType::SatFract:
1401 case BuiltinType::SatUFract:
1403 case BuiltinType::LongFract:
1404 case BuiltinType::ULongFract:
1405 case BuiltinType::SatLongFract:
1406 case BuiltinType::SatULongFract:
1408 case BuiltinType::ShortAccum:
1409 case BuiltinType::UShortAccum:
1410 case BuiltinType::SatShortAccum:
1411 case BuiltinType::SatUShortAccum:
1413 case BuiltinType::Accum:
1414 case BuiltinType::UAccum:
1415 case BuiltinType::SatAccum:
1416 case BuiltinType::SatUAccum:
1418 case BuiltinType::LongAccum:
1419 case BuiltinType::ULongAccum:
1420 case BuiltinType::SatLongAccum:
1421 case BuiltinType::SatULongAccum:
1424 if (BTy->isInteger())
1426 llvm_unreachable(
"Unexpected fixed point or integer type");
1438 "Expected at least one of the operands to be a fixed point type");
1441 "Special fixed point arithmetic operation conversions are only "
1442 "applied to ints or other fixed point types");
1464 QualType ResultTy = LHSTyRank > RHSTyRank ? LHSTy : RHSTy;
1486 REnum = R->isUnscopedEnumerationType();
1488 if ((!IsCompAssign && LEnum && R->isFloatingType()) ||
1491 ? diag::warn_arith_conv_enum_float_cxx20
1492 : diag::warn_arith_conv_enum_float)
1494 << (
int)ACK << LEnum << L << R;
1495 }
else if (!IsCompAssign && LEnum && REnum &&
1499 !R->castAs<
EnumType>()->getDecl()->hasNameForLinkage()) {
1504 ? diag::warn_arith_conv_mixed_anon_enum_types_cxx20
1505 : diag::warn_arith_conv_mixed_anon_enum_types;
1510 ? diag::warn_conditional_mixed_enum_types_cxx20
1511 : diag::warn_conditional_mixed_enum_types;
1516 ? diag::warn_comparison_mixed_enum_types_cxx20
1517 : diag::warn_comparison_mixed_enum_types;
1520 ? diag::warn_arith_conv_mixed_enum_types_cxx20
1521 : diag::warn_arith_conv_mixed_enum_types;
1524 << (
int)ACK << L << R;
1554 LHSType = AtomicLHS->getValueType();
1566 QualType LHSUnpromotedType = LHSType;
1570 if (!LHSBitfieldPromoteTy.
isNull())
1571 LHSType = LHSBitfieldPromoteTy;
1605 return handleIntegerConversion<doIntegralCast, doIntegralCast>
1618 Expr *ControllingExpr,
1621 unsigned NumAssocs = ArgTypes.size();
1622 assert(NumAssocs == ArgExprs.size());
1625 for (
unsigned i = 0; i < NumAssocs; ++i) {
1643 Expr *ControllingExpr,
1646 unsigned NumAssocs = Types.size();
1647 assert(NumAssocs == Exprs.size());
1657 ControllingExpr = R.
get();
1660 bool TypeErrorFound =
false,
1662 ContainsUnexpandedParameterPack
1670 diag::warn_side_effects_unevaluated_context);
1672 for (
unsigned i = 0; i < NumAssocs; ++i) {
1673 if (Exprs[i]->containsUnexpandedParameterPack())
1674 ContainsUnexpandedParameterPack =
true;
1677 if (Types[i]->getType()->containsUnexpandedParameterPack())
1678 ContainsUnexpandedParameterPack =
true;
1680 if (Types[i]->getType()->isDependentType()) {
1681 IsResultDependent =
true;
1686 if (Types[i]->getType()->isIncompleteType())
1687 D = diag::err_assoc_type_incomplete;
1688 else if (!Types[i]->getType()->isObjectType())
1689 D = diag::err_assoc_type_nonobject;
1690 else if (Types[i]->getType()->isVariablyModifiedType())
1691 D = diag::err_assoc_type_variably_modified;
1707 unsigned Reason = 0;
1716 Diag(Types[i]->getTypeLoc().getBeginLoc(),
1717 diag::warn_unreachable_association)
1718 << QT << (Reason - 1);
1722 Diag(Types[i]->getTypeLoc().getBeginLoc(), D)
1723 << Types[i]->getTypeLoc().getSourceRange()
1724 << Types[i]->getType();
1725 TypeErrorFound =
true;
1730 for (
unsigned j = i+1; j < NumAssocs; ++j)
1731 if (Types[j] && !Types[j]->getType()->isDependentType() &&
1733 Types[j]->getType())) {
1734 Diag(Types[j]->getTypeLoc().getBeginLoc(),
1735 diag::err_assoc_compatible_types)
1736 << Types[j]->getTypeLoc().getSourceRange()
1737 << Types[j]->getType()
1738 << Types[i]->getType();
1739 Diag(Types[i]->getTypeLoc().getBeginLoc(),
1740 diag::note_compat_assoc)
1741 << Types[i]->getTypeLoc().getSourceRange()
1742 << Types[i]->getType();
1743 TypeErrorFound =
true;
1753 if (IsResultDependent)
1755 Exprs, DefaultLoc, RParenLoc,
1756 ContainsUnexpandedParameterPack);
1759 unsigned DefaultIndex = -1U;
1763 for (
unsigned i = 0; i < NumAssocs; ++i) {
1768 Types[i]->getType()))
1769 CompatIndices.push_back(i);
1775 if (CompatIndices.size() > 1) {
1779 Diag(ControllingExpr->
getBeginLoc(), diag::err_generic_sel_multi_match)
1782 for (
unsigned I : CompatIndices) {
1783 Diag(Types[I]->getTypeLoc().getBeginLoc(),
1784 diag::note_compat_assoc)
1785 << Types[I]->getTypeLoc().getSourceRange()
1786 << Types[I]->getType();
1794 if (DefaultIndex == -1U && CompatIndices.size() == 0) {
1808 unsigned ResultIndex =
1809 CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
1812 Context, KeyLoc, ControllingExpr, Types, Exprs, DefaultLoc, RParenLoc,
1813 ContainsUnexpandedParameterPack, ResultIndex);
1831 assert(Args.size() <= 2 &&
"too many arguments for literal operator");
1834 for (
unsigned ArgIdx = 0; ArgIdx != Args.size(); ++ArgIdx) {
1835 ArgTy[ArgIdx] = Args[ArgIdx]->getType();
1836 if (ArgTy[ArgIdx]->isArrayType())
1863 assert(!StringToks.empty() &&
"Must have at least one string!");
1866 if (Literal.hadError)
1870 for (
const Token &Tok : StringToks)
1871 StringTokLocs.push_back(Tok.getLocation());
1875 if (Literal.isWide()) {
1878 }
else if (Literal.isUTF8()) {
1882 }
else if (Literal.isUTF16()) {
1885 }
else if (Literal.isUTF32()) {
1888 }
else if (Literal.isPascal()) {
1896 Diag(StringTokLocs.front(), diag::warn_cxx20_compat_utf8_string);
1902 auto RemovalDiag =
PDiag(diag::note_cxx20_compat_utf8_string_remove_u8);
1904 for (
const Token &Tok : StringToks) {
1905 if (Tok.getKind() == tok::utf8_string_literal) {
1907 RemovalDiagLoc = Tok.getLocation();
1914 Diag(RemovalDiagLoc, RemovalDiag);
1922 Kind, Literal.Pascal, StrTy,
1924 StringTokLocs.size());
1925 if (Literal.getUDSuffix().empty())
1932 Literal.getUDSuffixOffset());
1936 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_string_udl));
1961 Expr *Args[] = { Lit, LenArg };
1972 StringTokLocs.back(), &ExplicitArgs);
1980 llvm::APSInt
Value(CharBits, CharIsUnsigned);
1986 for (
unsigned I = 0, N = Lit->
getLength(); I != N; ++I) {
1993 StringTokLocs.back(), &ExplicitArgs);
1997 llvm_unreachable(
"unexpected literal operator lookup result");
2001 llvm_unreachable(
"unexpected literal operator lookup result");
2033 auto *DRE = dyn_cast<DeclRefExpr>(VD->
getInit());
2036 auto *Referee = dyn_cast<VarDecl>(DRE->getDecl());
2037 if (!Referee || !Referee->hasGlobalStorage() ||
2038 Referee->hasAttr<CUDADeviceAttr>())
2044 auto *MD = dyn_cast_or_null<CXXMethodDecl>(S.
CurContext);
2045 if (MD && MD->getParent()->isLambda() &&
2046 MD->getOverloadedOperator() == OO_Call && MD->hasAttr<CUDADeviceAttr>() &&
2068 if (
VarDecl *VD = dyn_cast<VarDecl>(D)) {
2069 if (VD->getType()->isReferenceType() &&
2072 VD->isUsableInConstantExpressions(
Context))
2089 bool RefersToCapturedVariable = isa<VarDecl, BindingDecl>(D) &&
2093 Context, NNS, TemplateKWLoc, D, RefersToCapturedVariable, NameInfo, Ty,
2121 const auto *FD = dyn_cast<FieldDecl>(D);
2122 if (
const auto *IFD = dyn_cast<IndirectFieldDecl>(D))
2123 FD = IFD->getAnonField();
2127 if (FD->isBitField())
2133 if (
const auto *BD = dyn_cast<BindingDecl>(D))
2134 if (
const auto *BE = BD->getBinding())
2159 Id.TemplateId->NumArgs);
2165 TemplateArgs = &Buffer;
2168 TemplateArgs =
nullptr;
2175 unsigned DiagnosticID,
unsigned DiagnosticSuggestID) {
2182 SemaRef.
Diag(TypoLoc, diag::err_no_member) << Typo << Ctx
2185 SemaRef.
Diag(TypoLoc, DiagnosticID) << Typo;
2190 bool DroppedSpecifier =
2193 ? diag::note_implicit_param_decl
2194 : diag::note_previous_decl;
2197 SemaRef.
PDiag(NoteID));
2200 << Typo << Ctx << DroppedSpecifier
2202 SemaRef.
PDiag(NoteID));
2217 bool isDefaultArgument =
2221 const auto *CurMethod = dyn_cast<CXXMethodDecl>(
CurContext);
2222 bool isInstance = CurMethod && CurMethod->isInstance() &&
2231 unsigned DiagID = diag::err_found_in_dependent_base;
2232 unsigned NoteID = diag::note_member_declared_at;
2234 DiagID =
getLangOpts().MSVCCompat ? diag::ext_found_later_in_class
2235 : diag::err_found_later_in_class;
2237 DiagID = diag::ext_found_in_dependent_base;
2238 NoteID = diag::note_dependent_member_use;
2254 Diag(D->getLocation(), NoteID);
2263 if (isDefaultArgument && ((*R.
begin())->isCXXInstanceMember())) {
2281 unsigned diagnostic = diag::err_undeclared_var_use;
2282 unsigned diagnostic_suggest = diag::err_undeclared_var_use_suggest;
2286 diagnostic = diag::err_undeclared_use;
2287 diagnostic_suggest = diag::err_undeclared_use_suggest;
2296 if (isa<CXXRecordDecl>(DC)) {
2312 R.
addDecl(Best->FoundDecl.getDecl(), Best->FoundDecl.getAccess());
2329 assert(!ExplicitTemplateArgs &&
2330 "Diagnosing an empty lookup with explicit template args!");
2334 emitEmptyLookupTypoDiagnostic(TC, *this, SS, Name, TypoLoc, Args,
2335 diagnostic, diagnostic_suggest);
2344 bool DroppedSpecifier =
2348 bool AcceptableWithRecovery =
false;
2349 bool AcceptableWithoutRecovery =
false;
2358 dyn_cast<FunctionTemplateDecl>(CD))
2362 else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(CD))
2363 if (!ExplicitTemplateArgs || ExplicitTemplateArgs->
size() == 0)
2369 ND = Best->FoundDecl;
2370 Corrected.setCorrectionDecl(ND);
2374 Corrected.setCorrectionDecl(ND);
2386 Record = cast<CXXRecordDecl>(
2392 AcceptableWithRecovery = isa<ValueDecl>(UnderlyingND) ||
2393 isa<FunctionTemplateDecl>(UnderlyingND);
2399 AcceptableWithoutRecovery = isa<TypeDecl>(UnderlyingND) ||
2401 isa<ObjCInterfaceDecl>(UnderlyingND);
2405 AcceptableWithoutRecovery =
true;
2408 if (AcceptableWithRecovery || AcceptableWithoutRecovery) {
2410 ? diag::note_implicit_param_decl
2411 : diag::note_previous_decl;
2414 PDiag(NoteID), AcceptableWithRecovery);
2418 << DroppedSpecifier << SS.
getRange(),
2419 PDiag(NoteID), AcceptableWithRecovery);
2422 return !AcceptableWithRecovery;
2458 else if (
auto *MD = dyn_cast<CXXMethodDecl>(S.
CurContext))
2466 auto DB = S.
Diag(Loc, diag::ext_undeclared_unqual_id_with_dependent_base);
2467 DB << NameInfo.
getName() << RD;
2469 if (!ThisType.
isNull()) {
2472 Context,
nullptr, ThisType,
true,
2474 nullptr, NameInfo, TemplateArgs);
2491 bool HasTrailingLParen,
bool IsAddressOfOperand,
2493 bool IsInlineAsmIdentifier,
Token *KeywordReplacement) {
2494 assert(!(IsAddressOfOperand && HasTrailingLParen) &&
2495 "cannot be direct & operand and have a trailing lparen");
2527 bool DependentID =
false;
2529 Name.getCXXNameType()->isDependentType()) {
2531 }
else if (SS.
isSet()) {
2542 IsAddressOfOperand, TemplateArgs);
2549 if (TemplateKWLoc.
isValid() || TemplateArgs) {
2555 bool MemberOfUnknownSpecialization;
2558 MemberOfUnknownSpecialization, TemplateKWLoc,
2562 if (MemberOfUnknownSpecialization ||
2565 IsAddressOfOperand, TemplateArgs);
2574 IsAddressOfOperand, TemplateArgs);
2578 if (IvarLookupFollowUp) {
2593 if (R.
empty() && HasTrailingLParen && II &&
2603 if (R.
empty() && !ADL) {
2606 TemplateKWLoc, TemplateArgs))
2611 if (IsInlineAsmIdentifier)
2621 "Typo correction callback misconfigured");
2632 std::nullopt, &TE)) {
2633 if (TE && KeywordReplacement) {
2635 auto BestTC = State.Consumer->getNextCorrection();
2636 if (BestTC.isKeyword()) {
2637 auto *II = BestTC.getCorrectionAsIdentifierInfo();
2638 if (State.DiagHandler)
2639 State.DiagHandler(BestTC);
2643 KeywordReplacement->
setLocation(BestTC.getCorrectionRange().getBegin());
2649 return (
Expr*)
nullptr;
2651 State.Consumer->resetCorrectionStream();
2656 assert(!R.
empty() &&
2657 "DiagnoseEmptyLookup returned false but added no results");
2674 assert(!R.
empty() || ADL);
2700 if (!R.
empty() && (*R.
begin())->isCXXClassMember()) {
2701 bool MightBeImplicitMember;
2702 if (!IsAddressOfOperand)
2703 MightBeImplicitMember =
true;
2705 MightBeImplicitMember =
false;
2707 MightBeImplicitMember =
false;
2709 MightBeImplicitMember =
true;
2711 MightBeImplicitMember = isa<FieldDecl>(R.
getFoundDecl()) ||
2715 if (MightBeImplicitMember)
2717 R, TemplateArgs, S);
2720 if (TemplateArgs || TemplateKWLoc.
isValid()) {
2728 "There should only be one declaration found.");
2771 if (
const auto *CD = dyn_cast<CXXRecordDecl>(DC))
2772 if (CD->isInvalidDecl())
2783 unsigned DiagID = diag::err_typename_missing;
2785 DiagID = diag::ext_typename_missing;
2787 auto D =
Diag(Loc, DiagID);
2818 if (!R.
empty() && (*R.
begin())->isCXXClassMember() && !IsAddressOfOperand)
2854 LookForIvars =
true;
2855 else if (IsClassMethod)
2856 LookForIvars =
false;
2867 if (IsClassMethod) {
2888 Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName();
2896 Diag(Loc, diag::err_ivar_use_in_class_method) << IV->getDeclName();
2909 "should not reference ivar from this context");
2912 assert(IFace &&
"should not reference ivar from this context");
2977 cast<ObjCIvarDecl>(Ivar.
get()));
2979 if (Lookup.
empty() && II && AllowBuiltinCreation)
3011 const auto *RD = dyn_cast<CXXRecordDecl>(
Member->getDeclContext());
3019 bool PointerConversions =
false;
3020 if (isa<FieldDecl>(
Member)) {
3024 DestRecordType, FromPtrType
3031 PointerConversions =
true;
3033 DestType = DestRecordType;
3034 FromRecordType = FromType;
3036 }
else if (
const auto *Method = dyn_cast<CXXMethodDecl>(
Member)) {
3037 if (Method->isStatic())
3040 DestType = Method->getThisType();
3045 PointerConversions =
true;
3047 FromRecordType = FromType;
3048 DestType = DestRecordType;
3053 if (FromAS != DestAS) {
3058 if (PointerConversions)
3099 if (Qualifier && Qualifier->getAsType()) {
3101 assert(QType->
isRecordType() &&
"lookup done with non-record type");
3111 FromLoc, FromRange, &BasePath))
3114 if (PointerConversions)
3117 VK, &BasePath).
get();
3120 FromRecordType = QRecordType;
3131 FromLoc, FromRange, &BasePath,
3141 bool HasTrailingLParen) {
3143 if (!HasTrailingLParen)
3161 if (D->isCXXClassMember())
3170 if (isa<UsingShadowDecl>(D))
3171 D = cast<UsingShadowDecl>(D)->getTargetDecl();
3172 else if (D->getLexicalDeclContext()->isFunctionOrMethod())
3179 if (
const auto *FDecl = dyn_cast<FunctionDecl>(D)) {
3181 if (FDecl->getBuiltinID() && FDecl->isImplicit())
3183 }
else if (!isa<FunctionTemplateDecl>(D))
3196 bool AcceptInvalid) {
3200 if (isa<TypedefNameDecl>(D)) {
3205 if (isa<ObjCInterfaceDecl>(D)) {
3210 if (isa<NamespaceDecl>(D)) {
3222 const auto *FD = dyn_cast<FunctionDecl>(R.
getFoundDecl());
3224 (FD->isCPUDispatchMultiVersion() || FD->isCPUSpecificMultiVersion());
3229 bool AcceptInvalidDecl) {
3270 bool AcceptInvalidDecl) {
3271 assert(D &&
"Cannot refer to a NULL declaration");
3272 assert(!isa<FunctionTemplateDecl>(D) &&
3273 "Cannot refer unambiguously to a function template");
3283 if (
TemplateDecl *Template = dyn_cast<TemplateDecl>(D)) {
3291 if (!isa<ValueDecl, UnresolvedUsingIfExistsDecl>(D)) {
3292 Diag(Loc, diag::err_ref_non_value) << D << SS.
getRange();
3304 auto *VD = cast<ValueDecl>(D);
3307 if (VD->isInvalidDecl() && !AcceptInvalidDecl)
3313 if (
auto *IndirectField = dyn_cast<IndirectFieldDecl>(VD);
3314 IndirectField && !IndirectField->isCXXClassMember())
3326 type =
type.getNonPackExpansionType();
3330#define ABSTRACT_DECL(kind)
3331#define VALUE(type, base)
3332#define DECL(type, base) case Decl::type:
3333#include "clang/AST/DeclNodes.inc"
3334 llvm_unreachable(
"invalid value decl kind");
3337 case Decl::ObjCAtDefsField:
3338 llvm_unreachable(
"forming non-member reference to ivar?");
3342 case Decl::EnumConstant:
3343 case Decl::UnresolvedUsingValue:
3344 case Decl::OMPDeclareReduction:
3345 case Decl::OMPDeclareMapper:
3354 case Decl::IndirectField:
3355 case Decl::ObjCIvar:
3366 case Decl::NonTypeTemplateParm: {
3368 type = reftype->getPointeeType();
3378 if (
type->isRecordType()) {
3379 type =
type.getUnqualifiedType().withConst();
3392 case Decl::VarTemplateSpecialization:
3393 case Decl::VarTemplatePartialSpecialization:
3394 case Decl::Decomposition:
3395 case Decl::OMPCapturedExpr:
3398 type->isVoidType()) {
3404 case Decl::ImplicitParam:
3405 case Decl::ParmVar: {
3415 if (!CapturedType.
isNull())
3416 type = CapturedType;
3428 case Decl::Function: {
3429 if (
unsigned BID = cast<FunctionDecl>(VD)->getBuiltinID()) {
3458 if (!cast<FunctionDecl>(VD)->hasPrototype() && isa<FunctionProtoType>(fty))
3467 case Decl::CXXDeductionGuide:
3468 llvm_unreachable(
"building reference to deduction guide");
3470 case Decl::MSProperty:
3472 case Decl::TemplateParamObject:
3478 case Decl::UnnamedGlobalConstant:
3482 case Decl::CXXMethod:
3487 dyn_cast<FunctionProtoType>(VD->getType()))
3495 if (cast<CXXMethodDecl>(VD)->isStatic()) {
3501 case Decl::CXXConversion:
3502 case Decl::CXXDestructor:
3503 case Decl::CXXConstructor:
3515 if (VD->isInvalidDecl() && E)
3522 Target.resize(CharByteWidth * (Source.size() + 1));
3523 char *ResultPtr = &
Target[0];
3524 const llvm::UTF8 *ErrorPtr;
3526 llvm::ConvertUTF8toWide(CharByteWidth, Source, ResultPtr, ErrorPtr);
3535 Decl *currentDecl =
nullptr;
3537 currentDecl = BSI->TheDecl;
3539 currentDecl = LSI->CallOperator;
3541 currentDecl = CSI->TheCapturedDecl;
3546 Diag(Loc, diag::ext_predef_outside_function);
3552 if (cast<DeclContext>(currentDecl)->isDependentContext())
3558 unsigned Length = Str.length();
3560 llvm::APInt LengthI(32, Length + 1);
3612 default: llvm_unreachable(
"Unknown simple primary expr!");
3634 if (Literal.hadError())
3638 if (Literal.isWide())
3644 else if (Literal.isUTF16())
3646 else if (Literal.isUTF32())
3655 if (Literal.isWide())
3657 else if (Literal.isUTF16())
3659 else if (Literal.isUTF32())
3661 else if (Literal.isUTF8())
3667 if (Literal.getUDSuffix().empty())
3677 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_character_udl));
3695 using llvm::APFloat;
3696 APFloat Val(Format);
3698 APFloat::opStatus result = Literal.GetFloatValue(Val);
3702 if ((result & APFloat::opOverflow) ||
3703 ((result & APFloat::opUnderflow) && Val.isZero())) {
3704 unsigned diagnostic;
3706 if (result & APFloat::opOverflow) {
3707 diagnostic = diag::warn_float_overflow;
3708 APFloat::getLargest(Format).toString(buffer);
3710 diagnostic = diag::warn_float_underflow;
3711 APFloat::getSmallest(Format).toString(buffer);
3714 S.
Diag(Loc, diagnostic)
3716 << StringRef(buffer.data(), buffer.size());
3719 bool isExact = (result == APFloat::opOK);
3724 assert(E &&
"Invalid expression");
3731 Diag(E->
getExprLoc(), diag::err_pragma_loop_invalid_argument_type) << QT;
3735 llvm::APSInt ValueAPS;
3741 bool ValueIsPositive = ValueAPS.isStrictlyPositive();
3742 if (!ValueIsPositive || ValueAPS.getActiveBits() > 31) {
3743 Diag(E->
getExprLoc(), diag::err_pragma_loop_invalid_argument_value)
3744 <<
toString(ValueAPS, 10) << ValueIsPositive;
3764 SpellingBuffer.resize(Tok.
getLength() + 1);
3775 if (Literal.hadError)
3778 if (Literal.hasUDSuffix()) {
3786 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_numeric_udl));
3789 if (Literal.isFloatingLiteral()) {
3814 !Literal.isImaginary)) {
3823 if (Literal.isFloatingLiteral()) {
3827 if (Literal.GetIntegerValue(ResultVal))
3840 unsigned Length = Literal.getUDSuffixOffset();
3847 false, StrTy, &TokLoc, 1);
3858 bool CharIsUnsigned =
Context.
CharTy->isUnsignedIntegerType();
3859 llvm::APSInt
Value(CharBits, CharIsUnsigned);
3860 for (
unsigned I = 0, N = Literal.getUDSuffixOffset(); I != N; ++I) {
3861 Value = TokSpelling[I];
3870 llvm_unreachable(
"unexpected literal operator lookup result");
3876 if (Literal.isFixedPointLiteral()) {
3879 if (Literal.isAccum) {
3880 if (Literal.isHalf) {
3882 }
else if (Literal.isLong) {
3887 }
else if (Literal.isFract) {
3888 if (Literal.isHalf) {
3890 }
else if (Literal.isLong) {
3899 bool isSigned = !Literal.isUnsigned;
3903 llvm::APInt Val(bit_width, 0, isSigned);
3904 bool Overflowed = Literal.GetFixedPointValue(Val, scale);
3905 bool ValIsZero = Val.isZero() && !Overflowed;
3908 if (Literal.isFract && Val == MaxVal + 1 && !ValIsZero)
3914 else if (Val.ugt(MaxVal) || Overflowed)
3919 }
else if (Literal.isFloatingLiteral()) {
3921 if (Literal.isHalf){
3928 }
else if (Literal.isFloat)
3930 else if (Literal.isLong)
3932 else if (Literal.isFloat16)
3934 else if (Literal.isFloat128)
3954 }
else if (!Literal.isIntegerLiteral()) {
3960 if (Literal.isSizeT)
3963 ? diag::warn_cxx20_compat_size_t_suffix
3964 : diag::ext_cxx23_size_t_suffix
3965 : diag::err_cxx23_size_t_suffix);
3973 ? diag::warn_c2x_compat_bitint_suffix
3974 : diag::ext_c2x_bitint_suffix);
3983 unsigned BitsNeeded =
3984 Literal.isBitInt ? llvm::APInt::getSufficientBitsNeeded(
3985 Literal.getLiteralDigits(), Literal.getRadix())
3987 llvm::APInt ResultVal(BitsNeeded, 0);
3989 if (Literal.GetIntegerValue(ResultVal)) {
3995 "long long is not intmax_t?");
4002 bool AllowUnsigned = Literal.isUnsigned || Literal.getRadix() != 10;
4008 if (Literal.MicrosoftInteger) {
4009 if (Literal.MicrosoftInteger == 8 && !Literal.isUnsigned) {
4013 Width = Literal.MicrosoftInteger;
4015 !Literal.isUnsigned);
4021 if (Literal.isBitInt) {
4024 Width = std::max(ResultVal.getActiveBits(), 1u) +
4025 (Literal.isUnsigned ? 0u : 1u);
4029 unsigned int MaxBitIntWidth =
4031 if (Width > MaxBitIntWidth) {
4033 << Literal.isUnsigned;
4034 Width = MaxBitIntWidth;
4041 ResultVal = ResultVal.zextOrTrunc(Width);
4046 if (Literal.isSizeT) {
4047 assert(!Literal.MicrosoftInteger &&
4048 "size_t literals can't be Microsoft literals");
4053 if (ResultVal.isIntN(SizeTSize)) {
4055 if (!Literal.isUnsigned && ResultVal[SizeTSize - 1] == 0)
4057 else if (AllowUnsigned)
4063 if (Ty.
isNull() && !Literal.isLong && !Literal.isLongLong &&
4069 if (ResultVal.isIntN(IntSize)) {
4071 if (!Literal.isUnsigned && ResultVal[IntSize-1] == 0)
4073 else if (AllowUnsigned)
4080 if (Ty.
isNull() && !Literal.isLongLong && !Literal.isSizeT) {
4084 if (ResultVal.isIntN(LongSize)) {
4086 if (!Literal.isUnsigned && ResultVal[LongSize-1] == 0)
4088 else if (AllowUnsigned)
4093 const unsigned LongLongSize =
4098 ? diag::warn_old_implicitly_unsigned_long_cxx
4100 ext_old_implicitly_unsigned_long_cxx
4101 : diag::warn_old_implicitly_unsigned_long)
4102 << (LongLongSize > LongSize ? 0
4111 if (Ty.
isNull() && !Literal.isSizeT) {
4115 if (ResultVal.isIntN(LongLongSize)) {
4119 if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 ||
4120 (
getLangOpts().MSVCCompat && Literal.isLongLong)))
4122 else if (AllowUnsigned)
4124 Width = LongLongSize;
4130 ? diag::warn_cxx98_compat_longlong
4131 : diag::ext_cxx11_longlong);
4141 if (Literal.isSizeT)
4143 << Literal.isUnsigned;
4146 diag::ext_integer_literal_too_large_for_signed);
4151 if (ResultVal.getBitWidth() != Width)
4152 ResultVal = ResultVal.trunc(Width);
4158 if (Literal.isImaginary) {
4168 assert(E &&
"ActOnParenExpr() missing expr");
4184 S.
Diag(Loc, diag::err_vecstep_non_scalar_vector_type)
4190 "Scalar types should always be complete");
4204 (TraitKind == UETT_SizeOf || TraitKind == UETT_AlignOf ||
4205 TraitKind == UETT_PreferredAlignOf)) {
4207 S.
Diag(Loc, diag::ext_sizeof_alignof_function_type)
4215 unsigned DiagID = S.
LangOpts.OpenCL ? diag::err_opencl_sizeof_alignof_type
4216 : diag::ext_sizeof_alignof_void_type;
4231 S.
Diag(Loc, diag::err_sizeof_nonfragile_interface)
4232 << T << (TraitKind == UETT_SizeOf)
4249 const auto *ICE = dyn_cast<ImplicitCastExpr>(E);
4250 if (!ICE || ICE->getCastKind() != CK_ArrayToPointerDecay)
4253 S.
Diag(Loc, diag::warn_sizeof_array_decay) << ICE->getSourceRange()
4255 << ICE->getSubExpr()->getType();
4270 bool IsUnevaluatedOperand =
4271 (ExprKind == UETT_SizeOf || ExprKind == UETT_AlignOf ||
4272 ExprKind == UETT_PreferredAlignOf || ExprKind == UETT_VecStep);
4273 if (IsUnevaluatedOperand) {
4289 Diag(E->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
4291 if (ExprKind == UETT_VecStep)
4304 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4307 diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4312 E, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4331 if (ExprKind == UETT_SizeOf) {
4332 if (
const auto *DeclRef = dyn_cast<DeclRefExpr>(E->
IgnoreParens())) {
4333 if (
const auto *PVD = dyn_cast<ParmVarDecl>(DeclRef->getFoundDecl())) {
4334 QualType OType = PVD->getOriginalType();
4339 Diag(PVD->getLocation(), diag::note_declared_at);
4347 if (
const auto *BO = dyn_cast<BinaryOperator>(E->
IgnoreParens())) {
4364 S.
Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield)
4371 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Inner)) {
4373 }
else if (
MemberExpr *ME = dyn_cast<MemberExpr>(Inner)) {
4374 D = ME->getMemberDecl();
4394 if (
FieldDecl *FD = dyn_cast_or_null<FieldDecl>(D)) {
4397 if (!FD->getParent()->isCompleteDefinition()) {
4398 S.
Diag(E->
getExprLoc(), diag::err_alignof_member_of_incomplete_type)
4407 if (!FD->getType()->isReferenceType())
4427 assert(CSI !=
nullptr);
4433#define TYPE(Class, Base)
4434#define ABSTRACT_TYPE(Class, Base)
4435#define NON_CANONICAL_TYPE(Class, Base)
4436#define DEPENDENT_TYPE(Class, Base) case Type::Class:
4437#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
4438#include "clang/AST/TypeNodes.inc"
4445 case Type::ExtVector:
4446 case Type::ConstantMatrix:
4449 case Type::TemplateSpecialization:
4450 case Type::ObjCObject:
4451 case Type::ObjCInterface:
4452 case Type::ObjCObjectPointer:
4453 case Type::ObjCTypeParam:
4456 llvm_unreachable(
"type class is never variably-modified!");
4457 case Type::Elaborated:
4458 T = cast<ElaboratedType>(Ty)->getNamedType();
4460 case Type::Adjusted:
4461 T = cast<AdjustedType>(Ty)->getOriginalType();
4469 case Type::BlockPointer:
4472 case Type::LValueReference:
4473 case Type::RValueReference:
4476 case Type::MemberPointer:
4479 case Type::ConstantArray:
4480 case Type::IncompleteArray:
4482 T = cast<ArrayType>(Ty)->getElementType();
4484 case Type::VariableArray: {
4492 (isa<CapturedRegionScopeInfo>(CSI) || isa<LambdaScopeInfo>(CSI)))
4498 case Type::FunctionProto:
4499 case Type::FunctionNoProto:
4500 T = cast<FunctionType>(Ty)->getReturnType();
4504 case Type::UnaryTransform:
4505 case Type::Attributed:
4506 case Type::BTFTagAttributed:
4507 case Type::SubstTemplateTypeParm:
4508 case Type::MacroQualified:
4513 T = cast<TypedefType>(Ty)->desugar();
4515 case Type::Decltype:
4516 T = cast<DecltypeType>(Ty)->desugar();
4519 T = cast<UsingType>(Ty)->desugar();
4522 case Type::DeducedTemplateSpecialization:
4523 T = cast<DeducedType>(Ty)->getDeducedType();
4525 case Type::TypeOfExpr:
4526 T = cast<TypeOfExprType>(Ty)->getUnderlyingExpr()->getType();
4529 T = cast<AtomicType>(Ty)->getValueType();
4570 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf ||
4571 ExprKind == UETT_OpenMPRequiredSimdAlign)
4574 if (ExprKind == UETT_VecStep)
4583 OpLoc, ExprType, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4588 Diag(OpLoc, diag::err_sizeof_alignof_function_type) << KWName << ExprRange;
4601 auto *CSI = dyn_cast<CapturingScopeInfo>(*I);
4605 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(CSI))
4606 DC = LSI->CallOperator;
4607 else if (
auto *CRSI = dyn_cast<CapturedRegionScopeInfo>(CSI))
4608 DC = CRSI->TheCapturedDecl;
4609 else if (
auto *BSI = dyn_cast<BlockScopeInfo>(CSI))
4664 }
else if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4666 }
else if (ExprKind == UETT_VecStep) {
4668 }
else if (ExprKind == UETT_OpenMPRequiredSimdAlign) {
4672 Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield) << 0;
4718 UETT_AlignOf, KWName);
4738 if (
V.get()->isTypeDependent())
4750 return CT->getElementType();
4753 if (
V.get()->getType()->isArithmeticType())
4754 return V.get()->getType();
4759 if (PR.
get() !=
V.get()) {
4765 S.
Diag(Loc, diag::err_realimag_invalid_type) <<
V.get()->getType()
4766 << (IsReal ?
"__real" :
"__imag");
4777 default: llvm_unreachable(
"Unknown unary op!");
4778 case tok::plusplus: Opc = UO_PostInc;
break;
4779 case tok::minusminus: Opc = UO_PostDec;
break;
4798 !S.
LangOpts.ObjCSubscriptingLegacyRuntime)
4801 S.
Diag(opLoc, diag::err_arithmetic_nonfragile_interface)
4808 auto *BaseNoParens =
Base->IgnoreParens();
4809 if (
auto *MSProp = dyn_cast<MSPropertyRefExpr>(BaseNoParens))
4810 return MSProp->getPropertyDecl()->getType()->isArrayType();
4811 return isa<MSPropertySubscriptExpr>(BaseNoParens);
4831 if (RTy->isIntegralOrUnscopedEnumerationType()) {
4833 Result = PT->getPointeeType();
4835 Result = AT->getElementType();
4838 Result = PT->getPointeeType();
4840 Result = AT->getElementType();
4860 if (isa<ParenListExpr>(base)) {
4864 base = result.
get();
4871 auto CheckAndReportCommaError = [
this, base, rbLoc](
Expr *E) {
4872 if (isa<BinaryOperator>(E) && cast<BinaryOperator>(E)->isCommaOp()) {
4873 Diag(E->getExprLoc(), diag::err_matrix_subscript_comma)
4882 !isa<MatrixSubscriptExpr>(base)) {
4883 Diag(base->
getExprLoc(), diag::err_matrix_separate_incomplete_index)
4889 auto *matSubscriptE = dyn_cast<MatrixSubscriptExpr>(base);
4890 if (matSubscriptE) {
4891 assert(ArgExprs.size() == 1);
4892 if (CheckAndReportCommaError(ArgExprs.front()))
4895 assert(matSubscriptE->isIncomplete() &&
4896 "base has to be an incomplete matrix subscript");
4898 matSubscriptE->getRowIdx(),
4899 ArgExprs.front(), rbLoc);
4907 bool IsMSPropertySubscript =
false;
4910 if (!IsMSPropertySubscript) {
4914 base = result.
get();
4920 assert(ArgExprs.size() == 1);
4921 if (CheckAndReportCommaError(ArgExprs.front()))