61#include "llvm/ADT/STLExtras.h"
62#include "llvm/ADT/STLForwardCompat.h"
63#include "llvm/ADT/StringExtras.h"
64#include "llvm/Support/ConvertUTF.h"
65#include "llvm/Support/SaveAndRestore.h"
66#include "llvm/Support/TimeProfiler.h"
67#include "llvm/Support/TypeSize.h"
91 if (TreatUnavailableAsInvalid &&
101 if (isa<UnresolvedUsingIfExistsDecl>(
D))
109 if (
const auto *A =
D->
getAttr<UnusedAttr>()) {
112 if (A->getSemanticSpelling() != UnusedAttr::CXX11_maybe_unused &&
113 A->getSemanticSpelling() != UnusedAttr::C23_maybe_unused) {
115 if (DC && !DC->
hasAttr<UnusedAttr>())
116 S.
Diag(
Loc, diag::warn_used_but_marked_unused) <<
D;
124 if (
Decl->isDefaulted()) {
135 auto *Ctor = dyn_cast<CXXConstructorDecl>(
Decl);
136 if (Ctor && Ctor->isInheritingConstructor())
147 if (I->getStorageClass() !=
SC_None)
174 if (!Current->isInlined())
176 if (!Current->isExternallyVisible())
192 if (!DowngradeWarning && UsedFn)
195 S.
Diag(
Loc, DowngradeWarning ? diag::ext_internal_in_extern_inline_quiet
196 : diag::ext_internal_in_extern_inline)
211 Diag(DeclBegin, diag::note_convert_inline_to_static)
218 bool ObjCPropertyAccess,
219 bool AvoidPartialAvailabilityChecks,
221 bool SkipTrailingRequiresClause) {
229 Diag(Suppressed.first, Suppressed.second);
240 if (cast<FunctionDecl>(
D)->isMain())
241 Diag(
Loc, diag::ext_main_used);
248 if (isa<BindingDecl>(
D)) {
249 Diag(
Loc, diag::err_binding_cannot_appear_in_own_initializer)
252 Diag(
Loc, diag::err_auto_variable_cannot_appear_in_own_initializer)
253 <<
D->getDeclName() << cast<VarDecl>(
D)->getType();
260 if (FD->isDeleted()) {
261 auto *Ctor = dyn_cast<CXXConstructorDecl>(FD);
262 if (Ctor && Ctor->isInheritingConstructor())
263 Diag(
Loc, diag::err_deleted_inherited_ctor_use)
265 << Ctor->getInheritedConstructor().getConstructor()->getParent();
268 Diag(
Loc, diag::err_deleted_function_use)
269 << (Msg !=
nullptr) << (Msg ? Msg->
getString() : StringRef());
283 if (!SkipTrailingRequiresClause && FD->getTrailingRequiresClause()) {
292 diag::err_reference_to_function_with_unsatisfied_constraints)
310 if (
auto *
Concept = dyn_cast<ConceptDecl>(
D);
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) &&
357 !
OpenMP().isOpenMPDeclareMapperVarDeclAllowed(cast<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 (
D->
hasAttr<AvailableOnlyInDefaultEvalMethodAttr>()) {
383 diag::err_type_available_only_in_default_eval_method)
387 if (
auto *VD = dyn_cast<ValueDecl>(
D))
393 if (
const auto *VD = dyn_cast<VarDecl>(
D))
395 targetDiag(*Locs.begin(), diag::err_thread_unsupported);
398 if (isa<ParmVarDecl>(
D) && isa<RequiresExprBodyDecl>(
D->
getDeclContext()) &&
403 Diag(
Loc, diag::err_requires_expr_parameter_referenced_in_evaluated_context)
419 unsigned NumFormalParams;
423 enum { CK_Function, CK_Method, CK_Block } CalleeKind;
425 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(
D)) {
426 NumFormalParams = MD->param_size();
427 CalleeKind = CK_Method;
428 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
429 NumFormalParams = FD->param_size();
430 CalleeKind = CK_Function;
431 }
else if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
438 CalleeKind = CK_Function;
441 CalleeKind = CK_Block;
446 if (
const auto *proto = dyn_cast<FunctionProtoType>(Fn))
447 NumFormalParams = proto->getNumParams();
458 unsigned NullPos =
Attr->getNullPos();
459 assert((NullPos == 0 || NullPos == 1) &&
"invalid null position on sentinel");
460 NumFormalParams = (NullPos > NumFormalParams ? 0 : NumFormalParams - NullPos);
463 unsigned NumArgsAfterSentinel =
Attr->getSentinel();
467 if (Args.size() < NumFormalParams + NumArgsAfterSentinel + 1) {
468 Diag(
Loc, diag::warn_not_enough_argument) <<
D->getDeclName();
474 const Expr *SentinelExpr = Args[Args.size() - NumArgsAfterSentinel - 1];
487 std::string NullValue;
491 NullValue =
"nullptr";
495 NullValue =
"(void*) 0";
498 Diag(
Loc, diag::warn_missing_sentinel) <<
int(CalleeKind);
500 Diag(MissingNilLoc, diag::warn_missing_sentinel)
525 assert(!Ty.
isNull() &&
"DefaultFunctionArrayConversion - missing type");
529 if (
auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl()))
534 CK_FunctionToPointerDecay).
get();
549 CK_ArrayToPointerDecay);
565 if (UO && UO->getOpcode() == UO_Deref &&
566 UO->getSubExpr()->getType()->isPointerType()) {
568 UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
571 UO->getSubExpr()->IgnoreParenCasts()->isNullPointerConstant(
573 !UO->getType().isVolatileQualified()) {
575 S.
PDiag(diag::warn_indirection_through_null)
576 << UO->getSubExpr()->getSourceRange());
578 S.
PDiag(diag::note_indirection_through_null));
610 if (ObjectSetClass) {
654 assert(!
T.isNull() &&
"r-value conversion on typeless expression?");
696 SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()),
")");
713 if (
T.hasQualifiers())
714 T =
T.getUnqualifiedType();
744 T =
Atomic->getValueType().getUnqualifiedType();
769 CK_FunctionToPointerDecay);
792 assert(!Ty.
isNull() &&
"UsualUnaryConversions - missing type");
799 switch (EvalMethod) {
801 llvm_unreachable(
"Unrecognized float evaluation method");
804 llvm_unreachable(
"Float evaluation method should be set by now");
812 CK_FloatingComplexCast)
821 CK_FloatingComplexCast)
869 assert(!Ty.
isNull() &&
"DefaultArgumentPromotion - missing type");
881 if (BTy && (BTy->
getKind() == BuiltinType::Half ||
882 BTy->
getKind() == BuiltinType::Float)) {
885 if (BTy->
getKind() == BuiltinType::Half) {
903 "Unexpected typesize for LongLongTy");
972 if (!
Record->hasNonTrivialCopyConstructor() &&
973 !
Record->hasNonTrivialMoveConstructor() &&
974 !
Record->hasNonTrivialDestructor())
1007 PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
1014 PDiag(diag::warn_pass_class_arg_to_vararg)
1022 PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
1029 diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
1033 PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
1037 << isa<InitListExpr>(
E) << Ty << CT;
1046 if (PlaceholderTy->getKind() == BuiltinType::ARCUnbridgedCast &&
1048 (FDecl && FDecl->
hasAttr<CFAuditedTransferAttr>()))) {
1087 if (
Call.isInvalid())
1092 if (Comma.isInvalid())
1099 diag::err_call_incomplete_argument))
1117 if (SkipCast)
return false;
1124 CK_IntegralComplexToFloatingComplex);
1142 bool PromotePrecision) {
1147 if (PromotePrecision) {
1152 if (LongerIsComplex)
1164 QualType RHSType,
bool IsCompAssign) {
1189 bool ConvertFloat,
bool ConvertInt) {
1194 CK_IntegralToFloating);
1205 CK_IntegralComplexToFloatingComplex);
1210 CK_FloatingRealToComplex);
1219 QualType RHSType,
bool IsCompAssign) {
1229 else if (!IsCompAssign)
1231 return LHSFloat ? LHSType : RHSType;
1236 if (LHSFloat && RHSFloat) {
1243 assert(order < 0 &&
"illegal float comparison");
1277 QualType LHSElem = LHSComplex ? LHSComplex->getElementType() : LHSType;
1283 if ((&LHSSem != &llvm::APFloat::PPCDoubleDouble() ||
1284 &RHSSem != &llvm::APFloat::IEEEquad()) &&
1285 (&LHSSem != &llvm::APFloat::IEEEquad() ||
1286 &RHSSem != &llvm::APFloat::PPCDoubleDouble()))
1303 CK_IntegralComplexCast);
1309template <PerformCastFn doLHSCast, PerformCastFn doRHSCast>
1312 QualType RHSType,
bool IsCompAssign) {
1317 if (LHSSigned == RHSSigned) {
1320 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1322 }
else if (!IsCompAssign)
1323 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1325 }
else if (order != (LHSSigned ? 1 : -1)) {
1329 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1331 }
else if (!IsCompAssign)
1332 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1339 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1341 }
else if (!IsCompAssign)
1342 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1351 RHS = (*doRHSCast)(S, RHS.
get(), result);
1353 LHS = (*doLHSCast)(S, LHS.
get(), result);
1363 bool IsCompAssign) {
1367 if (LHSComplexInt && RHSComplexInt) {
1371 handleIntegerConversion<doComplexIntegralCast, doComplexIntegralCast>
1372 (S, LHS, RHS, LHSEltType, RHSEltType, IsCompAssign);
1377 if (LHSComplexInt) {
1380 handleIntegerConversion<doComplexIntegralCast, doIntegralCast>
1381 (S, LHS, RHS, LHSEltType, RHSType, IsCompAssign);
1384 CK_IntegralRealToComplex);
1389 assert(RHSComplexInt);
1393 handleIntegerConversion<doIntegralCast, doComplexIntegralCast>
1394 (S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
1399 CK_IntegralRealToComplex);
1408 assert(BTy &&
"Expected a builtin type.");
1410 switch (BTy->getKind()) {
1411 case BuiltinType::ShortFract:
1412 case BuiltinType::UShortFract:
1413 case BuiltinType::SatShortFract:
1414 case BuiltinType::SatUShortFract:
1416 case BuiltinType::Fract:
1417 case BuiltinType::UFract:
1418 case BuiltinType::SatFract:
1419 case BuiltinType::SatUFract:
1421 case BuiltinType::LongFract:
1422 case BuiltinType::ULongFract:
1423 case BuiltinType::SatLongFract:
1424 case BuiltinType::SatULongFract:
1426 case BuiltinType::ShortAccum:
1427 case BuiltinType::UShortAccum:
1428 case BuiltinType::SatShortAccum:
1429 case BuiltinType::SatUShortAccum:
1431 case BuiltinType::Accum:
1432 case BuiltinType::UAccum:
1433 case BuiltinType::SatAccum:
1434 case BuiltinType::SatUAccum:
1436 case BuiltinType::LongAccum:
1437 case BuiltinType::ULongAccum:
1438 case BuiltinType::SatLongAccum:
1439 case BuiltinType::SatULongAccum:
1442 if (BTy->isInteger())
1444 llvm_unreachable(
"Unexpected fixed point or integer type");
1456 "Expected at least one of the operands to be a fixed point type");
1459 "Special fixed point arithmetic operation conversions are only "
1460 "applied to ints or other fixed point types");
1482 QualType ResultTy = LHSTyRank > RHSTyRank ? LHSTy : RHSTy;
1505 REnum = R->isUnscopedEnumerationType();
1507 if ((!IsCompAssign && LEnum && R->isFloatingType()) ||
1510 ? diag::err_arith_conv_enum_float_cxx26
1512 ? diag::warn_arith_conv_enum_float_cxx20
1513 : diag::warn_arith_conv_enum_float)
1516 }
else if (!IsCompAssign && LEnum && REnum &&
1522 DiagID = diag::err_conv_mixed_enum_types_cxx26;
1524 !R->castAs<
EnumType>()->getDecl()->hasNameForLinkage()) {
1529 ? diag::warn_arith_conv_mixed_anon_enum_types_cxx20
1530 : diag::warn_arith_conv_mixed_anon_enum_types;
1535 ? diag::warn_conditional_mixed_enum_types_cxx20
1536 : diag::warn_conditional_mixed_enum_types;
1541 ? diag::warn_comparison_mixed_enum_types_cxx20
1542 : diag::warn_comparison_mixed_enum_types;
1545 ? diag::warn_arith_conv_mixed_enum_types_cxx20
1546 : diag::warn_arith_conv_mixed_enum_types;
1549 << (
int)ACK << L << R;
1579 LHSType = AtomicLHS->getValueType();
1591 QualType LHSUnpromotedType = LHSType;
1595 if (!LHSBitfieldPromoteTy.
isNull())
1596 LHSType = LHSBitfieldPromoteTy;
1630 return handleIntegerConversion<doIntegralCast, doIntegralCast>
1641 bool PredicateIsExpr,
void *ControllingExprOrType,
1643 unsigned NumAssocs = ArgTypes.size();
1644 assert(NumAssocs == ArgExprs.size());
1647 for (
unsigned i = 0; i < NumAssocs; ++i) {
1656 if (!PredicateIsExpr) {
1660 assert(ControllingType &&
"couldn't get the type out of the parser");
1661 ControllingExprOrType = ControllingType;
1665 KeyLoc, DefaultLoc, RParenLoc, PredicateIsExpr, ControllingExprOrType,
1673 bool PredicateIsExpr,
void *ControllingExprOrType,
1675 unsigned NumAssocs = Types.size();
1676 assert(NumAssocs == Exprs.size());
1677 assert(ControllingExprOrType &&
1678 "Must have either a controlling expression or a controlling type");
1680 Expr *ControllingExpr =
nullptr;
1682 if (PredicateIsExpr) {
1689 reinterpret_cast<Expr *
>(ControllingExprOrType));
1692 ControllingExpr = R.
get();
1695 ControllingType =
reinterpret_cast<TypeSourceInfo *
>(ControllingExprOrType);
1696 if (!ControllingType)
1700 bool TypeErrorFound =
false,
1701 IsResultDependent = ControllingExpr
1704 ContainsUnexpandedParameterPack =
1714 diag::warn_side_effects_unevaluated_context);
1716 for (
unsigned i = 0; i < NumAssocs; ++i) {
1717 if (Exprs[i]->containsUnexpandedParameterPack())
1718 ContainsUnexpandedParameterPack =
true;
1721 if (Types[i]->getType()->containsUnexpandedParameterPack())
1722 ContainsUnexpandedParameterPack =
true;
1724 if (Types[i]->getType()->isDependentType()) {
1725 IsResultDependent =
true;
1738 if (ControllingExpr && Types[i]->getType()->isIncompleteType())
1739 D = diag::err_assoc_type_incomplete;
1740 else if (ControllingExpr && !Types[i]->getType()->isObjectType())
1741 D = diag::err_assoc_type_nonobject;
1742 else if (Types[i]->getType()->isVariablyModifiedType())
1743 D = diag::err_assoc_type_variably_modified;
1744 else if (ControllingExpr) {
1763 unsigned Reason = 0;
1772 Diag(Types[i]->getTypeLoc().getBeginLoc(),
1773 diag::warn_unreachable_association)
1774 << QT << (Reason - 1);
1778 Diag(Types[i]->getTypeLoc().getBeginLoc(),
D)
1779 << Types[i]->getTypeLoc().getSourceRange()
1780 << Types[i]->getType();
1781 TypeErrorFound =
true;
1786 for (
unsigned j = i+1; j < NumAssocs; ++j)
1787 if (Types[j] && !Types[j]->getType()->isDependentType() &&
1789 Types[j]->getType())) {
1790 Diag(Types[j]->getTypeLoc().getBeginLoc(),
1791 diag::err_assoc_compatible_types)
1792 << Types[j]->getTypeLoc().getSourceRange()
1793 << Types[j]->getType()
1794 << Types[i]->getType();
1795 Diag(Types[i]->getTypeLoc().getBeginLoc(),
1796 diag::note_compat_assoc)
1797 << Types[i]->getTypeLoc().getSourceRange()
1798 << Types[i]->getType();
1799 TypeErrorFound =
true;
1809 if (IsResultDependent) {
1810 if (ControllingExpr)
1812 Types, Exprs, DefaultLoc, RParenLoc,
1813 ContainsUnexpandedParameterPack);
1815 Exprs, DefaultLoc, RParenLoc,
1816 ContainsUnexpandedParameterPack);
1820 unsigned DefaultIndex = -1U;
1824 for (
unsigned i = 0; i < NumAssocs; ++i) {
1827 else if (ControllingExpr &&
1830 Types[i]->getType()))
1831 CompatIndices.push_back(i);
1832 else if (ControllingType &&
1835 Types[i]->getType()))
1836 CompatIndices.push_back(i);
1839 auto GetControllingRangeAndType = [](
Expr *ControllingExpr,
1843 if (ControllingExpr)
1852 return std::make_pair(SR, QT);
1858 if (CompatIndices.size() > 1) {
1859 auto P = GetControllingRangeAndType(ControllingExpr, ControllingType);
1862 << SR <<
P.second << (
unsigned)CompatIndices.size();
1863 for (
unsigned I : CompatIndices) {
1864 Diag(Types[I]->getTypeLoc().getBeginLoc(),
1865 diag::note_compat_assoc)
1866 << Types[I]->getTypeLoc().getSourceRange()
1867 << Types[I]->getType();
1875 if (DefaultIndex == -1U && CompatIndices.size() == 0) {
1876 auto P = GetControllingRangeAndType(ControllingExpr, ControllingType);
1878 Diag(SR.
getBegin(), diag::err_generic_sel_no_match) << SR <<
P.second;
1887 unsigned ResultIndex =
1888 CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
1890 if (ControllingExpr) {
1892 Context, KeyLoc, ControllingExpr, Types, Exprs, DefaultLoc, RParenLoc,
1893 ContainsUnexpandedParameterPack, ResultIndex);
1896 Context, KeyLoc, ControllingType, Types, Exprs, DefaultLoc, RParenLoc,
1897 ContainsUnexpandedParameterPack, ResultIndex);
1903 llvm_unreachable(
"unexpected TokenKind");
1904 case tok::kw___func__:
1906 case tok::kw___FUNCTION__:
1908 case tok::kw___FUNCDNAME__:
1910 case tok::kw___FUNCSIG__:
1912 case tok::kw_L__FUNCTION__:
1914 case tok::kw_L__FUNCSIG__:
1916 case tok::kw___PRETTY_FUNCTION__:
1925 while (DC && !isa<BlockDecl, CapturedDecl, FunctionDecl, ObjCMethodDecl>(DC))
1927 return cast_or_null<Decl>(DC);
1945 assert(Args.size() <= 2 &&
"too many arguments for literal operator");
1948 for (
unsigned ArgIdx = 0; ArgIdx != Args.size(); ++ArgIdx) {
1949 ArgTy[ArgIdx] = Args[ArgIdx]->getType();
1950 if (ArgTy[ArgIdx]->isArrayType())
1971 std::vector<Token> ExpandedToks;
1977 if (Literal.hadError)
1981 for (
const Token &Tok : StringToks)
1982 StringTokLocs.push_back(Tok.getLocation());
1986 &StringTokLocs[0], StringTokLocs.size());
1988 if (!Literal.getUDSuffix().empty()) {
1991 Literal.getUDSuffixOffset());
1992 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_string_udl));
2014 std::vector<Token> ExpandedToks;
2015 ExpandedToks.reserve(Toks.size());
2016 for (
const Token &Tok : Toks) {
2019 ExpandedToks.emplace_back(Tok);
2022 if (isa<TranslationUnitDecl>(CurrentDecl))
2023 Diag(Tok.getLocation(), diag::ext_predef_outside_function);
2025 Diag(Tok.getLocation(), diag::ext_string_literal_from_predefined)
2028 llvm::raw_svector_ostream
OS(Str);
2029 Token &Exp = ExpandedToks.emplace_back();
2031 if (Tok.getKind() == tok::kw_L__FUNCTION__ ||
2032 Tok.getKind() == tok::kw_L__FUNCSIG__) {
2034 Exp.
setKind(tok::wide_string_literal);
2036 Exp.
setKind(tok::string_literal);
2044 return ExpandedToks;
2049 assert(!StringToks.empty() &&
"Must have at least one string!");
2052 std::vector<Token> ExpandedToks;
2057 if (Literal.hadError)
2061 for (
const Token &Tok : StringToks)
2062 StringTokLocs.push_back(Tok.getLocation());
2066 if (Literal.isWide()) {
2069 }
else if (Literal.isUTF8()) {
2075 }
else if (Literal.isUTF16()) {
2078 }
else if (Literal.isUTF32()) {
2081 }
else if (Literal.isPascal()) {
2094 ? diag::warn_cxx20_compat_utf8_string
2095 : diag::warn_c23_compat_utf8_string);
2101 auto RemovalDiag =
PDiag(diag::note_cxx20_c23_compat_utf8_string_remove_u8);
2103 for (
const Token &Tok : StringToks) {
2104 if (Tok.getKind() == tok::utf8_string_literal) {
2106 RemovalDiagLoc = Tok.getLocation();
2113 Diag(RemovalDiagLoc, RemovalDiag);
2121 Kind, Literal.Pascal, StrTy,
2123 StringTokLocs.size());
2124 if (Literal.getUDSuffix().empty())
2131 Literal.getUDSuffixOffset());
2135 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_string_udl));
2160 Expr *Args[] = { Lit, LenArg };
2179 llvm::APSInt
Value(CharBits, CharIsUnsigned);
2185 for (
unsigned I = 0, N = Lit->
getLength(); I != N; ++I) {
2196 llvm_unreachable(
"unexpected literal operator lookup result");
2200 llvm_unreachable(
"unexpected literal operator lookup result");
2232 auto *DRE = dyn_cast<DeclRefExpr>(VD->
getInit());
2235 auto *Referee = dyn_cast<VarDecl>(DRE->getDecl());
2236 if (!Referee || !Referee->hasGlobalStorage() ||
2237 Referee->hasAttr<CUDADeviceAttr>())
2243 auto *MD = dyn_cast_or_null<CXXMethodDecl>(S.
CurContext);
2244 if (MD && MD->getParent()->isLambda() &&
2245 MD->getOverloadedOperator() == OO_Call && MD->hasAttr<CUDADeviceAttr>() &&
2267 if (
VarDecl *VD = dyn_cast<VarDecl>(
D)) {
2268 if (VD->getType()->isReferenceType() &&
2271 VD->isUsableInConstantExpressions(
Context))
2286 bool RefersToCapturedVariable = isa<VarDecl, BindingDecl>(
D) &&
2290 Context, NNS, TemplateKWLoc,
D, RefersToCapturedVariable, NameInfo, Ty,
2318 const auto *FD = dyn_cast<FieldDecl>(
D);
2319 if (
const auto *IFD = dyn_cast<IndirectFieldDecl>(
D))
2320 FD = IFD->getAnonField();
2324 if (FD->isBitField())
2330 if (
const auto *BD = dyn_cast<BindingDecl>(
D))
2331 if (
const auto *BE = BD->getBinding())
2347 Id.TemplateId->NumArgs);
2353 TemplateArgs = &Buffer;
2356 TemplateArgs =
nullptr;
2363 unsigned DiagnosticID,
unsigned DiagnosticSuggestID) {
2370 SemaRef.
Diag(TypoLoc, diag::err_no_member) << Typo << Ctx
2373 SemaRef.
Diag(TypoLoc, DiagnosticID) << Typo;
2378 bool DroppedSpecifier =
2381 ? diag::note_implicit_param_decl
2382 : diag::note_previous_decl;
2385 SemaRef.
PDiag(NoteID));
2388 << Typo << Ctx << DroppedSpecifier
2390 SemaRef.
PDiag(NoteID));
2397 bool isDefaultArgument =
2401 const auto *CurMethod = dyn_cast<CXXMethodDecl>(
CurContext);
2402 bool isInstance = CurMethod && CurMethod->isInstance() &&
2411 unsigned DiagID = diag::err_found_in_dependent_base;
2412 unsigned NoteID = diag::note_member_declared_at;
2414 DiagID =
getLangOpts().MSVCCompat ? diag::ext_found_later_in_class
2415 : diag::err_found_later_in_class;
2417 DiagID = diag::ext_found_in_dependent_base;
2418 NoteID = diag::note_dependent_member_use;
2443 if (isDefaultArgument && ((*R.
begin())->isCXXInstanceMember())) {
2459 unsigned diagnostic = diag::err_undeclared_var_use;
2460 unsigned diagnostic_suggest = diag::err_undeclared_var_use_suggest;
2464 diagnostic = diag::err_undeclared_use;
2465 diagnostic_suggest = diag::err_undeclared_use_suggest;
2475 if (isa<CXXRecordDecl>(DC)) {
2476 if (ExplicitTemplateArgs) {
2499 R.
addDecl(Best->FoundDecl.getDecl(), Best->FoundDecl.getAccess());
2516 assert(!ExplicitTemplateArgs &&
2517 "Diagnosing an empty lookup with explicit template args!");
2521 emitEmptyLookupTypoDiagnostic(TC, *this, SS, Name, TypoLoc, Args,
2522 diagnostic, diagnostic_suggest);
2527 }
else if (S && (Corrected =
2531 bool DroppedSpecifier =
2535 bool AcceptableWithRecovery =
false;
2536 bool AcceptableWithoutRecovery =
false;
2545 dyn_cast<FunctionTemplateDecl>(CD))
2549 else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(CD))
2550 if (!ExplicitTemplateArgs || ExplicitTemplateArgs->
size() == 0)
2556 ND = Best->FoundDecl;
2557 Corrected.setCorrectionDecl(ND);
2561 Corrected.setCorrectionDecl(ND);
2573 Record = cast<CXXRecordDecl>(
2579 AcceptableWithRecovery = isa<ValueDecl>(UnderlyingND) ||
2580 isa<FunctionTemplateDecl>(UnderlyingND);
2586 AcceptableWithoutRecovery = isa<TypeDecl>(UnderlyingND) ||
2588 isa<ObjCInterfaceDecl>(UnderlyingND);
2592 AcceptableWithoutRecovery =
true;
2595 if (AcceptableWithRecovery || AcceptableWithoutRecovery) {
2597 ? diag::note_implicit_param_decl
2598 : diag::note_previous_decl;
2601 PDiag(NoteID), AcceptableWithRecovery);
2605 << DroppedSpecifier << SS.
getRange(),
2606 PDiag(NoteID), AcceptableWithRecovery);
2609 return !AcceptableWithRecovery;
2645 else if (
auto *MD = dyn_cast<CXXMethodDecl>(S.
CurContext))
2653 auto DB = S.
Diag(
Loc, diag::ext_undeclared_unqual_id_with_dependent_base);
2654 DB << NameInfo.
getName() << RD;
2656 if (!ThisType.
isNull()) {
2659 Context,
nullptr, ThisType,
true,
2661 nullptr, NameInfo, TemplateArgs);
2678 bool HasTrailingLParen,
bool IsAddressOfOperand,
2680 bool IsInlineAsmIdentifier,
Token *KeywordReplacement) {
2681 assert(!(IsAddressOfOperand && HasTrailingLParen) &&
2682 "cannot be direct & operand and have a trailing lparen");
2711 if (
auto *VD = dyn_cast<ValueDecl>(R.
getFoundDecl())) {
2725 if (TemplateKWLoc.
isValid() || TemplateArgs) {
2733 false, TemplateKWLoc,
2739 IsAddressOfOperand, TemplateArgs);
2743 !IvarLookupFollowUp);
2749 IsAddressOfOperand, TemplateArgs);
2753 if (IvarLookupFollowUp) {
2768 if (R.
empty() && HasTrailingLParen && II &&
2778 if (R.
empty() && !ADL) {
2781 TemplateKWLoc, TemplateArgs))
2786 if (IsInlineAsmIdentifier)
2796 "Typo correction callback misconfigured");
2807 {},
nullptr, &TE)) {
2808 if (TE && KeywordReplacement) {
2810 auto BestTC = State.Consumer->getNextCorrection();
2811 if (BestTC.isKeyword()) {
2812 auto *II = BestTC.getCorrectionAsIdentifierInfo();
2813 if (State.DiagHandler)
2814 State.DiagHandler(BestTC);
2818 KeywordReplacement->
setLocation(BestTC.getCorrectionRange().getBegin());
2824 return (
Expr*)
nullptr;
2826 State.Consumer->resetCorrectionStream();
2831 assert(!R.
empty() &&
2832 "DiagnoseEmptyLookup returned false but added no results");
2842 if (!
E.isInvalid() && !
E.get())
2849 assert(!R.
empty() || ADL);
2879 if (TemplateArgs || TemplateKWLoc.
isValid()) {
2887 "There should only be one declaration found.");
2915 if (
const auto *CD = dyn_cast<CXXRecordDecl>(DC))
2916 if (CD->isInvalidDecl())
2927 unsigned DiagID = diag::err_typename_missing;
2929 DiagID = diag::ext_typename_missing;
2973 const auto *RD = dyn_cast<CXXRecordDecl>(
Member->getDeclContext());
2981 bool PointerConversions =
false;
2982 if (isa<FieldDecl>(
Member)) {
2986 DestRecordType, FromPtrType
2993 PointerConversions =
true;
2995 DestType = DestRecordType;
2996 FromRecordType = FromType;
2998 }
else if (
const auto *Method = dyn_cast<CXXMethodDecl>(
Member)) {
2999 if (!Method->isImplicitObjectMemberFunction())
3002 DestType = Method->getThisType().getNonReferenceType();
3003 DestRecordType = Method->getFunctionObjectParameterType();
3007 PointerConversions =
true;
3009 FromRecordType = FromType;
3010 DestType = DestRecordType;
3015 if (FromAS != DestAS) {
3020 if (PointerConversions)
3061 if (Qualifier && Qualifier->getAsType()) {
3063 assert(QType->
isRecordType() &&
"lookup done with non-record type");
3073 FromLoc, FromRange, &BasePath))
3076 if (PointerConversions)
3079 VK, &BasePath).
get();
3082 FromRecordType = QRecordType;
3093 FromLoc, FromRange, &BasePath,
3103 bool HasTrailingLParen) {
3105 if (!HasTrailingLParen)
3123 if (
D->isCXXClassMember())
3132 if (isa<UsingShadowDecl>(
D))
3133 D = cast<UsingShadowDecl>(
D)->getTargetDecl();
3141 if (
const auto *FDecl = dyn_cast<FunctionDecl>(
D)) {
3143 if (FDecl->getBuiltinID() && FDecl->isImplicit())
3145 }
else if (!isa<FunctionTemplateDecl>(
D))
3158 bool AcceptInvalid) {
3162 if (isa<TypedefNameDecl>(
D)) {
3163 S.
Diag(
Loc, diag::err_unexpected_typedef) <<
D->getDeclName();
3167 if (isa<ObjCInterfaceDecl>(
D)) {
3168 S.
Diag(
Loc, diag::err_unexpected_interface) <<
D->getDeclName();
3172 if (isa<NamespaceDecl>(
D)) {
3173 S.
Diag(
Loc, diag::err_unexpected_namespace) <<
D->getDeclName();
3184 const auto *FD = dyn_cast<FunctionDecl>(R.
getFoundDecl());
3186 (FD->isCPUDispatchMultiVersion() || FD->isCPUSpecificMultiVersion());
3191 bool AcceptInvalidDecl) {
3229 bool AcceptInvalidDecl) {
3230 assert(
D &&
"Cannot refer to a NULL declaration");
3231 assert(!isa<FunctionTemplateDecl>(
D) &&
3232 "Cannot refer unambiguously to a function template");
3250 if (!isa<ValueDecl, UnresolvedUsingIfExistsDecl>(
D)) {
3263 auto *VD = cast<ValueDecl>(
D);
3266 if (VD->isInvalidDecl() && !AcceptInvalidDecl)
3272 if (
auto *IndirectField = dyn_cast<IndirectFieldDecl>(VD);
3273 IndirectField && !IndirectField->isCXXClassMember())
3285 type =
type.getNonPackExpansionType();
3289#define ABSTRACT_DECL(kind)
3290#define VALUE(type, base)
3291#define DECL(type, base) case Decl::type:
3292#include "clang/AST/DeclNodes.inc"
3293 llvm_unreachable(
"invalid value decl kind");
3296 case Decl::ObjCAtDefsField:
3297 llvm_unreachable(
"forming non-member reference to ivar?");
3301 case Decl::EnumConstant:
3302 case Decl::UnresolvedUsingValue:
3303 case Decl::OMPDeclareReduction:
3304 case Decl::OMPDeclareMapper:
3313 case Decl::IndirectField:
3314 case Decl::ObjCIvar:
3316 "building reference to field in C?");
3326 case Decl::NonTypeTemplateParm: {
3328 type = reftype->getPointeeType();
3338 if (
type->isRecordType()) {
3339 type =
type.getUnqualifiedType().withConst();
3352 case Decl::VarTemplateSpecialization:
3353 case Decl::VarTemplatePartialSpecialization:
3354 case Decl::Decomposition:
3356 case Decl::OMPCapturedExpr:
3359 type->isVoidType()) {
3365 case Decl::ImplicitParam:
3366 case Decl::ParmVar: {
3376 if (!CapturedType.
isNull())
3377 type = CapturedType;
3382 case Decl::Function: {
3383 if (
unsigned BID = cast<FunctionDecl>(VD)->getBuiltinID()) {
3412 if (!cast<FunctionDecl>(VD)->hasPrototype() && isa<FunctionProtoType>(fty))
3421 case Decl::CXXDeductionGuide:
3422 llvm_unreachable(
"building reference to deduction guide");
3424 case Decl::MSProperty:
3426 case Decl::TemplateParamObject:
3432 case Decl::UnnamedGlobalConstant:
3436 case Decl::CXXMethod:
3441 dyn_cast<FunctionProtoType>(VD->getType()))
3449 if (cast<CXXMethodDecl>(VD)->isStatic()) {
3455 case Decl::CXXConversion:
3456 case Decl::CXXDestructor:
3457 case Decl::CXXConstructor:
3469 if (VD->isInvalidDecl() &&
E)
3476 Target.resize(CharByteWidth * (Source.size() + 1));
3477 char *ResultPtr = &
Target[0];
3478 const llvm::UTF8 *ErrorPtr;
3480 llvm::ConvertUTF8toWide(CharByteWidth, Source, ResultPtr, ErrorPtr);
3490 Diag(
Loc, diag::ext_predef_outside_function);
3496 if (cast<DeclContext>(currentDecl)->isDependentContext())
3501 bool ForceElaboratedPrinting =
3505 unsigned Length = Str.length();
3507 llvm::APInt LengthI(32, Length + 1);
3547 if (Literal.hadError())
3551 if (Literal.isWide())
3557 else if (Literal.isUTF16())
3559 else if (Literal.isUTF32())
3568 if (Literal.isWide())
3570 else if (Literal.isUTF16())
3572 else if (Literal.isUTF32())
3574 else if (Literal.isUTF8())
3580 if (Literal.getUDSuffix().empty())
3590 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_character_udl));
3601 llvm::APInt(IntSize, Val,
true),
3609 using llvm::APFloat;
3610 APFloat Val(Format);
3613 if (RM == llvm::RoundingMode::Dynamic)
3614 RM = llvm::RoundingMode::NearestTiesToEven;
3615 APFloat::opStatus result = Literal.GetFloatValue(Val, RM);
3619 if ((result & APFloat::opOverflow) ||
3620 ((result & APFloat::opUnderflow) && Val.isZero())) {
3621 unsigned diagnostic;
3623 if (result & APFloat::opOverflow) {
3624 diagnostic = diag::warn_float_overflow;
3625 APFloat::getLargest(Format).toString(buffer);
3627 diagnostic = diag::warn_float_underflow;
3628 APFloat::getSmallest(Format).toString(buffer);
3631 S.
Diag(
Loc, diagnostic) << Ty << buffer.str();
3634 bool isExact = (result == APFloat::opOK);
3639 assert(
E &&
"Invalid expression");
3646 Diag(
E->
getExprLoc(), diag::err_pragma_loop_invalid_argument_type) << QT;
3650 llvm::APSInt ValueAPS;
3661 bool ValueIsPositive =
3662 AllowZero ? ValueAPS.isNonNegative() : ValueAPS.isStrictlyPositive();
3663 if (!ValueIsPositive || ValueAPS.getActiveBits() > 31) {
3665 <<
toString(ValueAPS, 10) << ValueIsPositive;
3685 SpellingBuffer.resize(Tok.
getLength() + 1);
3696 if (Literal.hadError)
3699 if (Literal.hasUDSuffix()) {
3707 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_numeric_udl));
3710 if (Literal.isFloatingLiteral()) {
3735 !Literal.isImaginary)) {
3744 if (Literal.isFloatingLiteral()) {
3748 if (Literal.GetIntegerValue(ResultVal))
3761 unsigned Length = Literal.getUDSuffixOffset();
3768 false, StrTy, &TokLoc, 1);
3779 bool CharIsUnsigned =
Context.
CharTy->isUnsignedIntegerType();
3780 llvm::APSInt
Value(CharBits, CharIsUnsigned);
3781 for (
unsigned I = 0, N = Literal.getUDSuffixOffset(); I != N; ++I) {
3782 Value = TokSpelling[I];
3790 llvm_unreachable(
"unexpected literal operator lookup result");
3796 if (Literal.isFixedPointLiteral()) {
3799 if (Literal.isAccum) {
3800 if (Literal.isHalf) {
3802 }
else if (Literal.isLong) {
3807 }
else if (Literal.isFract) {
3808 if (Literal.isHalf) {
3810 }
else if (Literal.isLong) {
3819 bool isSigned = !Literal.isUnsigned;
3823 llvm::APInt Val(bit_width, 0, isSigned);
3824 bool Overflowed = Literal.GetFixedPointValue(Val, scale);
3825 bool ValIsZero = Val.isZero() && !Overflowed;
3828 if (Literal.isFract && Val == MaxVal + 1 && !ValIsZero)
3834 else if (Val.ugt(MaxVal) || Overflowed)
3839 }
else if (Literal.isFloatingLiteral()) {
3841 if (Literal.isHalf){
3849 }
else if (Literal.isFloat)
3851 else if (Literal.isLong)
3853 else if (Literal.isFloat16)
3855 else if (Literal.isFloat128)
3877 }
else if (!Literal.isIntegerLiteral()) {
3883 if (Literal.isSizeT)
3886 ? diag::warn_cxx20_compat_size_t_suffix
3887 : diag::ext_cxx23_size_t_suffix
3888 : diag::err_cxx23_size_t_suffix);
3895 if (Literal.isBitInt)
3899 : diag::ext_c23_bitint_suffix);
3908 unsigned BitsNeeded =
3909 Literal.isBitInt ? llvm::APInt::getSufficientBitsNeeded(
3910 Literal.getLiteralDigits(), Literal.getRadix())
3912 llvm::APInt ResultVal(BitsNeeded, 0);
3914 if (Literal.GetIntegerValue(ResultVal)) {
3920 "long long is not intmax_t?");
3927 bool AllowUnsigned = Literal.isUnsigned || Literal.getRadix() != 10;
3934 Literal.isLong =
true;
3935 Literal.isLongLong =
false;
3942 if (Literal.MicrosoftInteger) {
3943 if (Literal.MicrosoftInteger == 8 && !Literal.isUnsigned) {
3947 Width = Literal.MicrosoftInteger;
3949 !Literal.isUnsigned);
3955 if (Literal.isBitInt) {
3958 Width = std::max(ResultVal.getActiveBits(), 1u) +
3959 (Literal.isUnsigned ? 0u : 1u);
3963 unsigned int MaxBitIntWidth =
3965 if (Width > MaxBitIntWidth) {
3967 << Literal.isUnsigned;
3968 Width = MaxBitIntWidth;
3975 ResultVal = ResultVal.zextOrTrunc(Width);
3980 if (Literal.isSizeT) {
3981 assert(!Literal.MicrosoftInteger &&
3982 "size_t literals can't be Microsoft literals");
3987 if (ResultVal.isIntN(SizeTSize)) {
3989 if (!Literal.isUnsigned && ResultVal[SizeTSize - 1] == 0)
3991 else if (AllowUnsigned)
3997 if (Ty.
isNull() && !Literal.isLong && !Literal.isLongLong &&
4003 if (ResultVal.isIntN(IntSize)) {
4005 if (!Literal.isUnsigned && ResultVal[IntSize-1] == 0)
4007 else if (AllowUnsigned)
4014 if (Ty.
isNull() && !Literal.isLongLong && !Literal.isSizeT) {
4018 if (ResultVal.isIntN(LongSize)) {
4020 if (!Literal.isUnsigned && ResultVal[LongSize-1] == 0)
4022 else if (AllowUnsigned)
4027 const unsigned LongLongSize =
4032 ? diag::warn_old_implicitly_unsigned_long_cxx
4034 ext_old_implicitly_unsigned_long_cxx
4035 : diag::warn_old_implicitly_unsigned_long)
4036 << (LongLongSize > LongSize ? 0
4045 if (Ty.
isNull() && !Literal.isSizeT) {
4049 if (ResultVal.isIntN(LongLongSize)) {
4053 if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 ||
4054 (
getLangOpts().MSVCCompat && Literal.isLongLong)))
4056 else if (AllowUnsigned)
4058 Width = LongLongSize;
4064 ? diag::warn_cxx98_compat_longlong
4065 : diag::ext_cxx11_longlong);
4075 if (Literal.isSizeT)
4077 << Literal.isUnsigned;
4080 diag::ext_integer_literal_too_large_for_signed);
4085 if (ResultVal.getBitWidth() != Width)
4086 ResultVal = ResultVal.trunc(Width);
4092 if (Literal.isImaginary) {
4099 DiagId = diag::ext_gnu_imaginary_constant;
4101 DiagId = diag::warn_c23_compat_imaginary_constant;
4103 DiagId = diag::ext_c2y_imaginary_constant;
4110 assert(
E &&
"ActOnParenExpr() missing expr");
4126 S.
Diag(
Loc, diag::err_vecstep_non_scalar_vector_type)
4132 "Scalar types should always be complete");
4141 return S.
Diag(
Loc, diag::err_builtin_non_vector_type)
4143 <<
"__builtin_vectorelements" <<
T << ArgRange;
4156 S.
Diag(
Loc, diag::err_ptrauth_type_disc_undiscriminated) <<
T << ArgRange;
4173 (TraitKind == UETT_SizeOf || TraitKind == UETT_AlignOf ||
4174 TraitKind == UETT_PreferredAlignOf)) {
4176 S.
Diag(
Loc, diag::ext_sizeof_alignof_function_type)
4184 unsigned DiagID = S.
LangOpts.OpenCL ? diag::err_opencl_sizeof_alignof_type
4185 : diag::ext_sizeof_alignof_void_type;
4200 S.
Diag(
Loc, diag::err_sizeof_nonfragile_interface)
4201 <<
T << (TraitKind == UETT_SizeOf)
4218 const auto *ICE = dyn_cast<ImplicitCastExpr>(
E);
4219 if (!ICE || ICE->getCastKind() != CK_ArrayToPointerDecay)
4222 S.
Diag(
Loc, diag::warn_sizeof_array_decay) << ICE->getSourceRange()
4224 << ICE->getSubExpr()->getType();
4232 bool IsUnevaluatedOperand =
4233 (ExprKind == UETT_SizeOf || ExprKind == UETT_DataSizeOf ||
4234 ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf ||
4235 ExprKind == UETT_VecStep);
4236 if (IsUnevaluatedOperand) {
4254 if (ExprKind == UETT_VecStep)
4258 if (ExprKind == UETT_VectorElements)
4280 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4283 diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4288 E, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4307 if (ExprKind == UETT_SizeOf) {
4308 if (
const auto *DeclRef = dyn_cast<DeclRefExpr>(
E->
IgnoreParens())) {
4309 if (
const auto *PVD = dyn_cast<ParmVarDecl>(DeclRef->getFoundDecl())) {
4310 QualType OType = PVD->getOriginalType();
4315 Diag(PVD->getLocation(), diag::note_declared_at);
4323 if (
const auto *BO = dyn_cast<BinaryOperator>(
E->
IgnoreParens())) {
4347 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Inner)) {
4349 }
else if (
MemberExpr *ME = dyn_cast<MemberExpr>(Inner)) {
4350 D = ME->getMemberDecl();
4370 if (
FieldDecl *FD = dyn_cast_or_null<FieldDecl>(
D)) {
4373 if (!FD->getParent()->isCompleteDefinition()) {
4383 if (!FD->getType()->isReferenceType())
4403 assert(CSI !=
nullptr);
4407 const Type *Ty =
T.getTypePtr();
4409#define TYPE(Class, Base)
4410#define ABSTRACT_TYPE(Class, Base)
4411#define NON_CANONICAL_TYPE(Class, Base)
4412#define DEPENDENT_TYPE(Class, Base) case Type::Class:
4413#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
4414#include "clang/AST/TypeNodes.inc"
4421 case Type::ExtVector:
4422 case Type::ConstantMatrix:
4425 case Type::TemplateSpecialization:
4426 case Type::ObjCObject:
4427 case Type::ObjCInterface:
4428 case Type::ObjCObjectPointer:
4429 case Type::ObjCTypeParam:
4432 llvm_unreachable(
"type class is never variably-modified!");
4433 case Type::Elaborated:
4434 T = cast<ElaboratedType>(Ty)->getNamedType();
4436 case Type::Adjusted:
4437 T = cast<AdjustedType>(Ty)->getOriginalType();
4442 case Type::ArrayParameter:
4443 T = cast<ArrayParameterType>(Ty)->getElementType();
4448 case Type::BlockPointer:
4451 case Type::LValueReference:
4452 case Type::RValueReference:
4455 case Type::MemberPointer:
4458 case Type::ConstantArray:
4459 case Type::IncompleteArray:
4461 T = cast<ArrayType>(Ty)->getElementType();
4463 case Type::VariableArray: {
4471 (isa<CapturedRegionScopeInfo>(CSI) || isa<LambdaScopeInfo>(CSI)))
4477 case Type::FunctionProto:
4478 case Type::FunctionNoProto:
4483 case Type::UnaryTransform:
4484 case Type::Attributed:
4485 case Type::BTFTagAttributed:
4486 case Type::HLSLAttributedResource:
4487 case Type::SubstTemplateTypeParm:
4488 case Type::MacroQualified:
4489 case Type::CountAttributed:
4491 T =
T.getSingleStepDesugaredType(Context);
4494 T = cast<TypedefType>(Ty)->
desugar();
4496 case Type::Decltype:
4497 T = cast<DecltypeType>(Ty)->
desugar();
4499 case Type::PackIndexing:
4500 T = cast<PackIndexingType>(Ty)->
desugar();
4503 T = cast<UsingType>(Ty)->
desugar();
4506 case Type::DeducedTemplateSpecialization:
4507 T = cast<DeducedType>(Ty)->getDeducedType();
4509 case Type::TypeOfExpr:
4510 T = cast<TypeOfExprType>(Ty)->getUnderlyingExpr()->getType();
4513 T = cast<AtomicType>(Ty)->getValueType();
4539 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf ||
4540 ExprKind == UETT_OpenMPRequiredSimdAlign) {
4546 ? diag::warn_c2y_compat_alignof_incomplete_array
4547 : diag::ext_c2y_alignof_incomplete_array);
4551 if (ExprKind == UETT_VecStep)
4554 if (ExprKind == UETT_VectorElements)
4558 if (ExprKind == UETT_PtrAuthTypeDiscriminator)
4568 OpLoc, ExprType, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4573 Diag(OpLoc, diag::err_sizeof_alignof_function_type) << KWName << ExprRange;
4581 Diag(OpLoc, diag::err_wasm_table_invalid_uett_operand)
4595 auto *CSI = dyn_cast<CapturingScopeInfo>(*I);
4599 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(CSI))
4600 DC = LSI->CallOperator;
4601 else if (
auto *CRSI = dyn_cast<CapturedRegionScopeInfo>(CSI))
4602 DC = CRSI->TheCapturedDecl;
4603 else if (
auto *BSI = dyn_cast<BlockScopeInfo>(CSI))
4655 }
else if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4657 }
else if (ExprKind == UETT_VecStep) {
4659 }
else if (ExprKind == UETT_OpenMPRequiredSimdAlign) {
4665 }
else if (ExprKind == UETT_VectorElements) {