;
64 if(
D.getContext() != DeclaratorContext::BlockLiteral ||
65 D.getDeclSpec().hasTypeSpecifier())
68 if(
D.getNumTypeObjects() == 0)
71 if(
D.getNumTypeObjects() == 1 &&
83 booluseExpansionLoc =
true;
84 switch(
attr.getKind()) {
85 caseParsedAttr::AT_ObjCGC:
88 caseParsedAttr::AT_ObjCOwnership:
94useExpansionLoc =
false;
99StringRef name =
attr.getAttrName()->getName();
104 if(useExpansionLoc && loc.
isMacroID() && II) {
105 if(II->
isStr(
"strong")) {
107}
else if(II->
isStr(
"weak")) {
112S.
Diag(loc,
attr.isRegularKeywordAttribute()
113? diag::err_type_attribute_wrong_type
114: diag::warn_type_attribute_wrong_type)
115<< name << WhichType <<
type;
120#define OBJC_POINTER_TYPE_ATTRS_CASELIST \ 121 case ParsedAttr::AT_ObjCGC: \ 122 case ParsedAttr::AT_ObjCOwnership 125#define CALLING_CONV_ATTRS_CASELIST \ 126 case ParsedAttr::AT_CDecl: \ 127 case ParsedAttr::AT_FastCall: \ 128 case ParsedAttr::AT_StdCall: \ 129 case ParsedAttr::AT_ThisCall: \ 130 case ParsedAttr::AT_RegCall: \ 131 case ParsedAttr::AT_Pascal: \ 132 case ParsedAttr::AT_SwiftCall: \ 133 case ParsedAttr::AT_SwiftAsyncCall: \ 134 case ParsedAttr::AT_VectorCall: \ 135 case ParsedAttr::AT_AArch64VectorPcs: \ 136 case ParsedAttr::AT_AArch64SVEPcs: \ 137 case ParsedAttr::AT_AMDGPUKernelCall: \ 138 case ParsedAttr::AT_MSABI: \ 139 case ParsedAttr::AT_SysVABI: \ 140 case ParsedAttr::AT_Pcs: \ 141 case ParsedAttr::AT_IntelOclBicc: \ 142 case ParsedAttr::AT_PreserveMost: \ 143 case ParsedAttr::AT_PreserveAll: \ 144 case ParsedAttr::AT_M68kRTD: \ 145 case ParsedAttr::AT_PreserveNone: \ 146 case ParsedAttr::AT_RISCVVectorCC 149#define FUNCTION_TYPE_ATTRS_CASELIST \ 150 case ParsedAttr::AT_NSReturnsRetained: \ 151 case ParsedAttr::AT_NoReturn: \ 152 case ParsedAttr::AT_NonBlocking: \ 153 case ParsedAttr::AT_NonAllocating: \ 154 case ParsedAttr::AT_Blocking: \ 155 case ParsedAttr::AT_Allocating: \ 156 case ParsedAttr::AT_Regparm: \ 157 case ParsedAttr::AT_CmseNSCall: \ 158 case ParsedAttr::AT_ArmStreaming: \ 159 case ParsedAttr::AT_ArmStreamingCompatible: \ 160 case ParsedAttr::AT_ArmPreserves: \ 161 case ParsedAttr::AT_ArmIn: \ 162 case ParsedAttr::AT_ArmOut: \ 163 case ParsedAttr::AT_ArmInOut: \ 164 case ParsedAttr::AT_ArmAgnostic: \ 165 case ParsedAttr::AT_AnyX86NoCallerSavedRegisters: \ 166 case ParsedAttr::AT_AnyX86NoCfCheck: \ 167 CALLING_CONV_ATTRS_CASELIST 170#define MS_TYPE_ATTRS_CASELIST \ 171 case ParsedAttr::AT_Ptr32: \ 172 case ParsedAttr::AT_Ptr64: \ 173 case ParsedAttr::AT_SPtr: \ 174 case ParsedAttr::AT_UPtr 177#define NULLABILITY_TYPE_ATTRS_CASELIST \ 178 case ParsedAttr::AT_TypeNonNull: \ 179 case ParsedAttr::AT_TypeNullable: \ 180 case ParsedAttr::AT_TypeNullableResult: \ 181 case ParsedAttr::AT_TypeNullUnspecified 186 classTypeProcessingState {
210 usingTypeAttrPair = std::pair<const AttributedType*, const Attr*>;
212 boolAttrsForTypesSorted =
true;
216llvm::DenseMap<const MacroQualifiedType *, SourceLocation> LocsForMacros;
224 boolParsedHLSLParamMod;
228: sema(sema), declarator(declarator),
230ParsedHLSLParamMod(
false) {}
232 Sema&getSema()
const{
240 boolisProcessingDeclSpec()
const{
244 unsignedgetCurrentChunkIndex()
const{
248 voidsetCurrentChunkIndex(
unsignedidx) {
254 if(isProcessingDeclSpec())
255 returngetMutableDeclSpec().getAttributes();
260 voidsaveDeclSpecAttrs() {
262 if(!savedAttrs.empty())
265 DeclSpec&spec = getMutableDeclSpec();
266llvm::append_range(savedAttrs,
273ignoredTypeAttrs.push_back(&
attr);
279 for(
auto*
Attr: ignoredTypeAttrs)
289AttrsForTypes.push_back({cast<AttributedType>(
T.getTypePtr()), A});
290AttrsForTypesSorted =
false;
295 QualTypegetBTFTagAttributedType(
constBTFTypeTagAttr *BTFAttr,
307 auto*NewAttrTy = cast<AttributedType>(
T.getTypePtr());
308 for(TypeAttrPair &A : AttrsForTypes) {
309 if(A.first == AttrTy)
312AttrsForTypesSorted =
false;
319 if(!AttrsForTypesSorted) {
320llvm::stable_sort(AttrsForTypes, llvm::less_first());
321AttrsForTypesSorted =
true;
326 for(
autoIt = std::partition_point(
327AttrsForTypes.begin(), AttrsForTypes.end(),
328[=](
constTypeAttrPair &A) { return A.first < AT; });
329It != AttrsForTypes.end() && It->first == AT; ++It) {
331 const Attr*Result = It->second;
332It->second =
nullptr;
337llvm_unreachable(
"no Attr* for AttributedType*");
342 autoFoundLoc = LocsForMacros.find(MQT);
343assert(FoundLoc != LocsForMacros.end() &&
344 "Unable to find macro expansion location for MacroQualifedType");
345 returnFoundLoc->second;
350LocsForMacros[MQT] =
Loc;
353 voidsetParsedNoDeref(
boolparsed) { parsedNoDeref = parsed; }
355 booldidParseNoDeref()
const{
returnparsedNoDeref; }
357 voidsetParsedHLSLParamMod(
boolParsed) { ParsedHLSLParamMod = Parsed; }
359 booldidParseHLSLParamMod()
const{
returnParsedHLSLParamMod; }
361~TypeProcessingState() {
362 if(savedAttrs.empty())
365getMutableDeclSpec().getAttributes().clearListOnly();
367getMutableDeclSpec().getAttributes().addAtEnd(AL);
371 DeclSpec&getMutableDeclSpec()
const{
413 if(
attr.getKind() == ParsedAttr::AT_ObjCGC)
415assert(
attr.getKind() == ParsedAttr::AT_ObjCOwnership);
430 boolonlyBlockPointers) {
436 for(; i != 0; --i) {
438 switch(fnChunk.
Kind) {
454 for(--i; i != 0; --i) {
456 switch(ptrChunk.
Kind) {
466 if(onlyBlockPointers)
475llvm_unreachable(
"bad declarator chunk kind");
481llvm_unreachable(
"bad declarator chunk kind");
498 Declarator&declarator = state.getDeclarator();
501 for(
unsignedi = state.getCurrentChunkIndex(); i != 0; --i) {
503 switch(chunk.
Kind) {
509 if(state.isProcessingDeclSpec() &&
510 attr.getKind() == ParsedAttr::AT_ObjCOwnership)
513 if(!destChunk) destChunk = &chunk;
526 if(state.isProcessingDeclSpec() &&
527 attr.getKind() == ParsedAttr::AT_ObjCOwnership) {
554 Declarator&declarator = state.getDeclarator();
558 unsignedinnermost = -1U;
559 boolconsiderDeclSpec =
true;
562 switch(chunk.
Kind) {
576considerDeclSpec =
false;
584 if(considerDeclSpec) {
589state.saveDeclSpecAttrs();
598 if(innermost != -1U) {
606state.addIgnoredTypeAttr(
attr);
615 Declarator&declarator = state.getDeclarator();
619 for(
unsignedi = state.getCurrentChunkIndex(); i != 0; --i) {
621 switch(chunk.
Kind) {
648 Declarator&declarator = state.getDeclarator();
668state.saveDeclSpecAttrs();
672state,
attr, state.getCurrentAttributes(), declSpecType, CFT))
677state.addIgnoredTypeAttr(
attr);
688 Declarator&declarator = state.getDeclarator();
698state.addIgnoredTypeAttr(
attr);
723 if(
attr.isStandardAttributeSyntax() ||
attr.isRegularKeywordAttribute())
726 switch(
attr.getKind()) {
743 caseParsedAttr::AT_ObjCKindOf:
756 Declarator&declarator = state.getDeclarator();
802{}, loc, loc, declarator));
817 typedefstd::pair<DeclSpec::TQ, SourceLocation> QualLoc;
822 if(!(RemoveTQs & Qual.first))
826 if(TypeQuals & Qual.first)
827S.
Diag(Qual.second, DiagID)
832TypeQuals &= ~Qual.first;
846 if(AL.isInvalid() || !AL.isTypeAttr())
848S.
Diag(AL.getLoc(),
849diag::warn_block_literal_attributes_on_omitted_return_type)
851ToBeRemoved.push_back(&AL);
861diag::warn_block_literal_qualifiers_on_omitted_return_type);
867staticOpenCLAccessAttr::Spelling
870 if(AL.getKind() == ParsedAttr::AT_OpenCLAccess)
871 return static_cast<OpenCLAccessAttr::Spelling
>(AL.getSemanticSpelling());
872 returnOpenCLAccessAttr::Keyword_read_only;
878#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \ 880 return UnaryTransformType::Enum; 881#include "clang/Basic/TransformTypeTraits.def" 883llvm_unreachable(
"attempted to parse a non-unary transform builtin");
897 Sema&S = state.getSema();
898 Declarator&declarator = state.getDeclarator();
909Result = Context.
VoidTy;
913Result = Context.
CharTy;
918 "Unknown TSS value");
932 "Unknown TSS value");
941 "Unknown TSS value");
946 "Unknown TSS value");
951 "Unknown TSS value");
960declarator.
getContext() == DeclaratorContext::LambdaExpr) {
964}
else if(declarator.
getContext() == DeclaratorContext::LambdaExpr ||
979S.
Diag(DeclLoc, diag::warn_missing_type_specifier)
988S.
Diag(DeclLoc, diag::err_missing_type_specifier)
997S.
Diag(DeclLoc, diag::err_missing_actual_pipe_type)
1002 "implicit int is disabled?");
1003S.
Diag(DeclLoc, diag::ext_missing_type_specifier)
1013 caseTypeSpecifierWidth::Unspecified:
1014Result = Context.
IntTy;
1016 caseTypeSpecifierWidth::Short:
1019 caseTypeSpecifierWidth::Long:
1020Result = Context.
LongTy;
1022 caseTypeSpecifierWidth::LongLong:
1030diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1038 caseTypeSpecifierWidth::Unspecified:
1041 caseTypeSpecifierWidth::Short:
1044 caseTypeSpecifierWidth::Long:
1047 caseTypeSpecifierWidth::LongLong:
1055diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1070 if(Result.isNull()) {
1071Result = Context.
IntTy;
1078 caseTypeSpecifierWidth::Short:
1081 caseTypeSpecifierWidth::Unspecified:
1084 caseTypeSpecifierWidth::Long:
1087 caseTypeSpecifierWidth::LongLong:
1088llvm_unreachable(
"Unable to specify long long as _Accum width");
1101 caseTypeSpecifierWidth::Short:
1104 caseTypeSpecifierWidth::Unspecified:
1107 caseTypeSpecifierWidth::Long:
1110 caseTypeSpecifierWidth::LongLong:
1111llvm_unreachable(
"Unable to specify long long as _Fract width");
1162?
"cl_khr_fp64 and __opencl_c_fp64" 1184Result = Context.
BoolTy;
1190Result = Context.
IntTy;
1201Result = Context.
IntTy;
1212 "No qualifiers on tag names!");
1228 "Can't handle qualifiers on typedef names yet!");
1230 if(Result.isNull()) {
1241assert(!Result.isNull() &&
"Didn't get a type for typeof?");
1242 if(!Result->isDependentType())
1248? TypeOfKind::Unqualified
1249: TypeOfKind::Qualified);
1254assert(
E&&
"Didn't get an expression for typeof?");
1258? TypeOfKind::Unqualified
1259: TypeOfKind::Qualified);
1260 if(Result.isNull()) {
1261Result = Context.
IntTy;
1268assert(
E&&
"Didn't get an expression for decltype?");
1271 if(Result.isNull()) {
1272Result = Context.
IntTy;
1279assert(
E&&
"Didn't get an expression for pack indexing");
1283 if(Result.isNull()) {
1285Result = Context.
IntTy;
1290#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case DeclSpec::TST_##Trait: 1291#include "clang/Basic/TransformTypeTraits.def" 1293assert(!Result.isNull() &&
"Didn't get a type for the transformation?");
1297 if(Result.isNull()) {
1298Result = Context.
IntTy;
1306? AutoTypeKeyword::DecltypeAuto
1307: AutoTypeKeyword::Auto;
1313TypeConstraintConcept =
1314cast<ConceptDecl>(TemplateId->Template.get().getAsTemplateDecl());
1316TemplateArgsInfo.
setLAngleLoc(TemplateId->LAngleLoc);
1317TemplateArgsInfo.
setRAngleLoc(TemplateId->RAngleLoc);
1319TemplateId->NumArgs);
1321 for(
const auto&ArgLoc : TemplateArgsInfo.
arguments())
1322TemplateArgs.push_back(ArgLoc.getArgument());
1329TypeConstraintConcept, TemplateArgs);
1343assert(!Result.isNull() &&
"Didn't get a type for _Atomic?");
1345 if(Result.isNull()) {
1346Result = Context.
IntTy;
1351#define GENERIC_IMAGE_TYPE(ImgType, Id) \ 1352 case DeclSpec::TST_##ImgType##_t: \ 1353 switch (getImageAccess(DS.getAttributes())) { \ 1354 case OpenCLAccessAttr::Keyword_write_only: \ 1355 Result = Context.Id##WOTy; \ 1357 case OpenCLAccessAttr::Keyword_read_write: \ 1358 Result = Context.Id##RWTy; \ 1360 case OpenCLAccessAttr::Keyword_read_only: \ 1361 Result = Context.Id##ROTy; \ 1363 case OpenCLAccessAttr::SpellingNotCalculated: \ 1364 llvm_unreachable("Spelling not yet calculated"); \
1367#include "clang/Basic/OpenCLImageTypes.def" 1369#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 1370 case DeclSpec::TST_##Name: \ 1371 Result = Context.SingletonId; \ 1373#include "clang/Basic/HLSLIntangibleTypes.def" 1376Result = Context.
IntTy;
1384 if(Result->containsErrors())
1389 boolIsOpenCLC30Compatible =
1398 if((Result->isImageType() || Result->isSamplerT()) &&
1399(IsOpenCLC30Compatible &&
1402<< 0 << Result <<
"__opencl_c_images";
1404}
else if(Result->isOCLImage3dWOType() &&
1409<< (IsOpenCLC30Compatible
1410?
"cl_khr_3d_image_writes and __opencl_c_3d_image_writes" 1411:
"cl_khr_3d_image_writes");
1431 unsignedtypeSize =
static_cast<unsigned>(Context.
getTypeSize(Result));
1432assert(typeSize > 0 &&
"type size for vector must be greater than 0 bits");
1433 VectorKindVecKind = VectorKind::AltiVecVector;
1435VecKind = VectorKind::AltiVecPixel;
1437VecKind = VectorKind::AltiVecBool;
1438Result = Context.
getVectorType(Result, 128/typeSize, VecKind);
1449 if(declarator.
getContext() == DeclaratorContext::BlockLiteral)
1463 if(AL.slidesFromDeclToDeclSpecLegacyBehavior()) {
1474 if(AL.isStandardAttributeSyntax() && AL.isClangScope() &&
1475!(AL.getKind() == ParsedAttr::AT_MatrixType &&
1477S.
Diag(AL.getLoc(), diag::warn_type_attribute_deprecated_on_decl)
1505 if(Result->isFunctionType()) {
1506 unsignedDiagId = diag::warn_typecheck_function_qualifiers_ignored;
1508DiagId = diag::ext_typecheck_function_qualifiers_unspecified;
1524 if(TypeQuals && Result->isReferenceType()) {
1526S, DS, TypeQuals, Result,
1528diag::warn_typecheck_reference_qualifiers);
1535&& TypeQuals & Result.getCVRQualifiers()) {
1562assert(!Result.isNull() &&
"This function should not return a null type");
1570 return "type name";
1577 const auto*AT = dyn_cast<AutoType>(
T);
1578 returnAT && AT->isGNUAutoType();
1595 unsignedDiagID = 0;
1611DiagID = diag::err_typecheck_invalid_restrict_invalid_pointee;
1618DiagID = diag::err_typecheck_invalid_restrict_not_pointer;
1632 unsignedCVRAU,
const DeclSpec*DS) {
1666Split.Quals.addCVRQualifiers(CVR);
1684 if(!
type->isObjCLifetimeType() ||
1694 if(
type.isConstQualified()) {
1700}
else if(
type->isObjCARCImplicitlyUnretainedType()) {
1718diag::err_arc_indirect_no_ownership,
type, isReference));
1720S.
Diag(loc, diag::err_arc_indirect_no_ownership) <<
type<< isReference;
1724assert(implicitLifetime &&
"didn't infer any lifetime!");
1765enumQualifiedFunctionKind { QFK_BlockPointer, QFK_Pointer, QFK_Reference };
1771QualifiedFunctionKind QFK) {
1778S.
Diag(
Loc, diag::err_compound_qualified_function_type)
1779<< QFK << isa<FunctionType>(
T.IgnoreParens()) <<
T 1790 Diag(
Loc, diag::err_qualified_function_typeid)
1809 Diag(
Loc, diag::err_illegal_decl_pointer_to_reference)
1817 Diag(
Loc, diag::err_opencl_function_pointer) <<
0;
1822 Diag(
Loc, diag::err_hlsl_pointers_unsupported) << 0;
1841 if(
getASTContext().getTargetInfo().getTriple().isWasm()) {
1842 if(
T.isWebAssemblyReferenceType()) {
1843 Diag(
Loc, diag::err_wasm_reference_pr) << 0;
1849 Diag(
Loc, diag::err_wasm_table_pr) << 0;
1862 "Unresolved overloaded function type");
1890 Diag(
Loc, diag::err_reference_to_void);
1895 Diag(
Loc, diag::err_hlsl_pointers_unsupported) << 1;
1905 Diag(
Loc, diag::err_opencl_function_pointer) <<
1;
1917 if(
getASTContext().getTargetInfo().getTriple().isWasm() &&
1918 T.isWebAssemblyReferenceType()) {
1919 Diag(
Loc, diag::err_wasm_reference_pr) << 1;
1923 Diag(
Loc, diag::err_wasm_table_pr) << 1;
1946llvm::APSInt Bits(32);
1953 size_tNumBits = Bits.getZExtValue();
1954 if(!IsUnsigned && NumBits < 2) {
1955 Diag(
Loc, diag::err_bit_int_bad_size) << 0;
1959 if(IsUnsigned && NumBits < 1) {
1960 Diag(
Loc, diag::err_bit_int_bad_size) << 1;
1966 Diag(
Loc, diag::err_bit_int_max_size)
1980llvm::APSInt &SizeVal,
unsignedVLADiag,
2003 boolIsVLA =
false;
2005VLADiagnoser(
unsignedVLADiag,
boolVLAIsError)
2006: VLADiag(VLADiag), VLAIsError(VLAIsError) {}
2010 returnS.
Diag(
Loc, diag::err_array_size_non_int) <<
T;
2015IsVLA = !VLAIsError;
2016 returnS.
Diag(
Loc, VLADiag);
2021 returnS.
Diag(
Loc, diag::ext_vla_folded_to_constant);
2023} Diagnoser(VLADiag, VLAIsError);
2027 if(Diagnoser.IsVLA)
2041 if(Size.isMultipleOf(Alignment))
2044 Diag(
Loc, diag::err_array_element_alignment)
2045<< EltTy << Size.getQuantity() << Alignment.
getQuantity();
2050 Expr*ArraySize,
unsignedQuals,
2067 Diag(
Loc, diag::err_illegal_decl_array_of_references)
2073 Diag(
Loc, diag::err_array_incomplete_or_sizeless_type) << 0 <<
T;
2078diag::err_array_of_abstract_type))
2085 if(!MPTy->getClass()->isDependentType())
2091 if(!
T.isWebAssemblyReferenceType() &&
2093diag::err_array_incomplete_or_sizeless_type))
2099 const auto*ATy = dyn_cast<ArrayType>(
T);
2100 if(ATy && ATy->getElementType().isWebAssemblyReferenceType()) {
2101 Diag(
Loc, diag::err_wasm_reftype_multidimensional_array);
2107 Diag(
Loc, diag::err_array_incomplete_or_sizeless_type) << 1 <<
T;
2112 Diag(
Loc, diag::err_illegal_decl_array_of_functions)
2120 if(EltTy->getDecl()->hasFlexibleArrayMember())
2121 Diag(
Loc, diag::ext_flexible_array_in_array) <<
T;
2123 Diag(
Loc, diag::err_objc_array_of_interfaces) <<
T;
2134ArraySize =
Result.get();
2138 if(ArraySize && !ArraySize->
isPRValue()) {
2140 if(
Result.isInvalid())
2143ArraySize =
Result.get();
2166 if(
const auto*CondExpr = dyn_cast_if_present<ConditionalOperator>(
2168std::optional<llvm::APSInt> LHS =
2169CondExpr->getLHS()->getIntegerConstantExpr(
Context);
2170std::optional<llvm::APSInt> RHS =
2171CondExpr->getRHS()->getIntegerConstantExpr(
Context);
2172 returnLHS && RHS && LHS->isNegative() != RHS->isNegative();
2182VLADiag = diag::err_opencl_vla;
2185VLADiag = diag::warn_vla_used;
2186VLAIsError =
false;
2188VLADiag = diag::err_vla_in_sfinae;
2191VLADiag = diag::err_openmp_vla_in_task_untied;
2196? diag::ext_vla_cxx_in_gnu_mode_static_assert
2197: diag::ext_vla_cxx_static_assert;
2199VLADiag =
getLangOpts().GNUMode ? diag::ext_vla_cxx_in_gnu_mode
2200: diag::ext_vla_cxx;
2201VLAIsError =
false;
2203VLADiag = diag::ext_vla;
2204VLAIsError =
false;
2222 checkArraySize(*
this, ArraySize, ConstVal, VLADiag, VLAIsError);
2244 if(ConstVal.isSigned() && ConstVal.isNegative()) {
2251diag::err_typecheck_negative_array_size)
2255 if(ConstVal == 0 && !
T.isWebAssemblyReferenceType()) {
2260: diag::ext_typecheck_zero_array_size)
2265 unsignedActiveSizeBits =
2269: ConstVal.getActiveBits();
2285IsCUDADevice ? diag::err_cuda_vla : diag::err_vla_unsupported)
2286<< (IsCUDADevice ? llvm::to_underlying(
CUDA().CurrentTarget()) : 0);
2290FSI->setHasVLA(
Loc);
2298: diag::ext_c99_array_usage)
2299<< llvm::to_underlying(ASM);
2309 Diag(
Loc, diag::err_opencl_invalid_type_array) << ArrType;
2319 boolForMatrixType =
false) {
2322 if(!llvm::isPowerOf2_32(NumBits) || NumBits < 8)
2323 returnS.
Diag(AttrLoc, diag::err_attribute_invalid_bitint_vector_type)
2324<< ForMatrixType << (NumBits < 8);
2337 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << CurType;
2349std::optional<llvm::APSInt> VecSize =
2352 Diag(AttrLoc, diag::err_attribute_argument_type)
2363 if(!VecSize->isIntN(61)) {
2365 Diag(AttrLoc, diag::err_attribute_size_too_large)
2369uint64_t VectorSizeBits = VecSize->getZExtValue() * 8;
2372 if(VectorSizeBits == 0) {
2373 Diag(AttrLoc, diag::err_attribute_zero_size)
2378 if(!TypeSize || VectorSizeBits % TypeSize) {
2379 Diag(AttrLoc, diag::err_attribute_invalid_size)
2384 if(VectorSizeBits / TypeSize > std::numeric_limits<uint32_t>::max()) {
2385 Diag(AttrLoc, diag::err_attribute_size_too_large)
2409 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) <<
T;
2418std::optional<llvm::APSInt> vecSize =
2421 Diag(AttrLoc, diag::err_attribute_argument_type)
2427 if(!vecSize->isIntN(32)) {
2428 Diag(AttrLoc, diag::err_attribute_size_too_large)
2434 unsignedvectorSize =
static_cast<unsigned>(vecSize->getZExtValue());
2436 if(vectorSize == 0) {
2437 Diag(AttrLoc, diag::err_attribute_zero_size)
2451 "Should never build a matrix type when it is disabled");
2456 Diag(AttrLoc, diag::err_attribute_invalid_matrix_type) << ElementTy;
2470std::optional<llvm::APSInt> ValueRows =
2472std::optional<llvm::APSInt> ValueColumns =
2479 if(!ValueRows && !ValueColumns) {
2480 Diag(AttrLoc, diag::err_attribute_argument_type)
2488 Diag(AttrLoc, diag::err_attribute_argument_type)
2494 if(!ValueColumns) {
2495 Diag(AttrLoc, diag::err_attribute_argument_type)
2501 unsignedMatrixRows =
static_cast<unsigned>(ValueRows->getZExtValue());
2502 unsignedMatrixColumns =
static_cast<unsigned>(ValueColumns->getZExtValue());
2503 if(MatrixRows == 0 && MatrixColumns == 0) {
2504 Diag(AttrLoc, diag::err_attribute_zero_size)
2505<<
"matrix"<< RowRange << ColRange;
2508 if(MatrixRows == 0) {
2509 Diag(AttrLoc, diag::err_attribute_zero_size) <<
"matrix"<< RowRange;
2512 if(MatrixColumns == 0) {
2513 Diag(AttrLoc, diag::err_attribute_zero_size) <<
"matrix"<< ColRange;
2517 Diag(AttrLoc, diag::err_attribute_size_too_large)
2518<< RowRange <<
"matrix row";
2522 Diag(AttrLoc, diag::err_attribute_size_too_large)
2523<< ColRange <<
"matrix column";
2531 Diag(
Loc, diag::err_func_returning_array_function)
2539 Diag(
Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 1 <<
2547 Diag(
Loc, diag::err_object_cannot_be_passed_returned_by_value)
2552 if(
T.hasNonTrivialToPrimitiveDestructCUnion() ||
2553 T.hasNonTrivialToPrimitiveCopyCUnion())
2560 Diag(
Loc, diag::warn_deprecated_volatile_return) <<
T;
2575 boolemittedError =
false;
2577 enum classRequiredCC { OnlySwift, SwiftOrSwiftAsync };
2578 autocheckCompatible = [&](
unsignedparamIndex, RequiredCC required) {
2580(required == RequiredCC::OnlySwift)
2583 if(isCompatible || emittedError)
2585S.
Diag(getParamLoc(paramIndex), diag::err_swift_param_attr_not_swiftcall)
2587<< (required == RequiredCC::OnlySwift);
2588emittedError =
true;
2590 for(
size_tparamIndex = 0, numParams = paramTypes.size();
2591paramIndex != numParams; ++paramIndex) {
2602checkCompatible(paramIndex, RequiredCC::SwiftOrSwiftAsync);
2603 if(paramIndex != 0 &&
2606S.
Diag(getParamLoc(paramIndex),
2607diag::err_swift_indirect_result_not_first);
2612checkCompatible(paramIndex, RequiredCC::SwiftOrSwiftAsync);
2621checkCompatible(paramIndex, RequiredCC::OnlySwift);
2622 if(paramIndex == 0 ||
2625S.
Diag(getParamLoc(paramIndex),
2626diag::err_swift_error_result_not_after_swift_context);
2630llvm_unreachable(
"bad ABI kind");
2642 for(
unsignedIdx = 0, Cnt = ParamTypes.size(); Idx < Cnt; ++Idx) {
2646 Diag(
Loc, diag::err_param_with_void_type);
2651 Diag(
Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 0 <<
2655 Diag(
Loc, diag::err_wasm_table_as_function_parameter);
2662 Diag(
Loc, diag::warn_deprecated_volatile_param) << ParamType;
2664ParamTypes[Idx] = ParamType;
2669[=](
unsignedi) {
return Loc; });
2689 Diag(
Loc, diag::err_distant_exception_spec);
2696 Diag(
Loc, diag::err_illegal_decl_mempointer_to_reference)
2702 Diag(
Loc, diag::err_illegal_decl_mempointer_to_void)
2707 if(!
Class->isDependentType() && !
Class->isRecordType()) {
2708 Diag(
Loc, diag::err_mempointer_in_nonclass_type) <<
Class;
2715 Diag(
Loc, diag::err_opencl_function_pointer) <<
0;
2720 Diag(
Loc, diag::err_hlsl_pointers_unsupported) << 0;
2739 Diag(
Loc, diag::err_nonfunction_block_type);
2755 if(TInfo) *TInfo =
nullptr;
2760 if(
const LocInfoType*LIT = dyn_cast<LocInfoType>(QT)) {
2761QT = LIT->getType();
2762DI = LIT->getTypeSourceInfo();
2765 if(TInfo) *TInfo = DI;
2771 unsignedchunkIndex);
2778 Sema&S = state.getSema();
2779 Declarator&declarator = state.getDeclarator();
2785 unsignedoutermostPointerIndex = 0;
2787 unsignednumPointers = 0;
2789 unsignedchunkIndex = i;
2791 switch(chunk.
Kind) {
2801outermostPointerIndex = chunkIndex;
2809 if(numPointers != 1)
return;
2811outermostPointerIndex = chunkIndex;
2829 if(numPointers == 1) {
2847}
else if(numPointers == 2) {
2860 if(AL.getKind() == ParsedAttr::AT_ObjCOwnership)
2864outermostPointerIndex);
2886}
constQualKinds[5] = {
2895 unsignedNumQuals = 0;
2900 for(
auto&
E: QualKinds) {
2901 if(Quals &
E.Mask) {
2902 if(!QualStr.empty()) QualStr +=
' ';
2919<< QualStr << NumQuals << FixIts[0] << FixIts[1] << FixIts[2] << FixIts[3];
2925 unsignedFunctionChunkIndex) {
2927 D.getTypeObject(FunctionChunkIndex).Fun;
2935 for(
unsignedOuterChunkIndex = FunctionChunkIndex + 1,
2936End =
D.getNumTypeObjects();
2937OuterChunkIndex != End; ++OuterChunkIndex) {
2939 switch(OuterChunk.
Kind) {
2946diag::warn_qual_return_type,
2968 D.getIdentifierLoc());
2972llvm_unreachable(
"unknown declarator chunk kind");
2984 D.getDeclSpec().getTypeQualifiers(),
2985 D.getIdentifierLoc(),
2986 D.getDeclSpec().getConstSpecLoc(),
2987 D.getDeclSpec().getVolatileSpecLoc(),
2988 D.getDeclSpec().getRestrictSpecLoc(),
2989 D.getDeclSpec().getAtomicSpecLoc(),
2990 D.getDeclSpec().getUnalignedSpecLoc());
2993staticstd::pair<QualType, TypeSourceInfo *>
2997 Sema&S = state.getSema();
3001 const unsignedAutoParameterPosition = Info.
TemplateParams.size();
3002 const boolIsParameterPack =
D.hasEllipsis();
3013 D.getDeclSpec().getTypeSpecTypeLoc(),
3014 D.getIdentifierLoc(),
3015TemplateParameterDepth, AutoParameterPosition,
3017 D.getIdentifier(), AutoParameterPosition),
false,
3018IsParameterPack,
Auto->isConstrained());
3023 if(
Auto->isConstrained()) {
3030 for(
unsignedIdx = 0; Idx < AutoLoc.
getNumArgs(); ++Idx) {
3031 if(
D.getEllipsisLoc().isInvalid() && !
Invalid&&
3043InventedTemplateParam,
3045 D.getEllipsisLoc());
3059 if(
D.getEllipsisLoc().isInvalid()) {
3075 D.getDeclSpec().getTypeSpecScope().getWithLocInContext(S.
Context),
3080USD ? cast<NamedDecl>(USD) : CD,
3082InventedTemplateParam,
3084 D.getEllipsisLoc());
3094 QualTypeNewT = state.ReplaceAutoType(
T, Replacement);
3098 return{NewT, NewTSI};
3107 Sema&SemaRef = state.getSema();
3110ReturnTypeInfo =
nullptr;
3113 TagDecl*OwnedTagDecl =
nullptr;
3115 switch(
D.getName().
getKind()) {
3123 if(!
D.isInvalidType() &&
D.getDeclSpec().isTypeSpecOwned()) {
3124OwnedTagDecl = cast<TagDecl>(
D.getDeclSpec().getRepAsDecl());
3137 D.getMutableDeclSpec().getAttributes());
3164 boolDeducedIsTrailingReturnType =
false;
3165 if(Deduced && isa<AutoType>(Deduced) &&
D.hasTrailingReturnType()) {
3168DeducedIsTrailingReturnType =
true;
3178 boolIsCXXAutoType =
3180 boolIsDeducedReturnType =
false;
3182 switch(
D.getContext()) {
3221assert(Info &&
"No LambdaScopeInfo on the stack!");
3227 if(!DeducedIsTrailingReturnType)
3232 if(
D.isStaticMember() ||
D.isFunctionDeclarator())
3235 if(isa<ObjCContainerDecl>(SemaRef.
CurContext)) {
3238 switch(cast<TagDecl>(SemaRef.
CurContext)->getTagKind()) {
3240llvm_unreachable(
"unhandled tag kind");
3242Error = Cxx ? 1 : 2;
3245Error = Cxx ? 3 : 4;
3255 if(
D.getDeclSpec().isFriendSpecified())
3264 if(isa<DeducedTemplateSpecializationType>(Deduced) &&
3276 if(isa<DeducedTemplateSpecializationType>(Deduced) &&
3277!
D.getNumTypeObjects() &&
3290 if(!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
3292IsDeducedReturnType =
true;
3295 if(!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
3297IsDeducedReturnType =
true;
3300 if(isa<DeducedTemplateSpecializationType>(Deduced))
3302 if(SemaRef.
getLangOpts().CPlusPlus23 && IsCXXAutoType &&
3303!
Auto->isDecltypeAuto())
3322 if(!IsCXXAutoType && !isa<DeducedTemplateSpecializationType>(Deduced))
3335 if(
D.isFunctionDeclarator() &&
3336(!SemaRef.
getLangOpts().CPlusPlus11 || !IsCXXAutoType))
3339 SourceRangeAutoRange =
D.getDeclSpec().getTypeSpecTypeLoc();
3346 switch(
Auto->getKeyword()) {
3352assert(isa<DeducedTemplateSpecializationType>(Deduced) &&
3353 "unknown auto type");
3357 auto*DTST = dyn_cast<DeducedTemplateSpecializationType>(Deduced);
3360SemaRef.
Diag(AutoRange.
getBegin(), diag::err_auto_not_allowed)
3362<<
QualType(Deduced, 0) << AutoRange;
3367 D.setInvalidType(
true);
3373? diag::warn_cxx11_compat_generic_lambda
3374: IsDeducedReturnType
3375? diag::warn_cxx11_compat_deduced_return_type
3376: diag::warn_cxx98_compat_auto_type_specifier)
3385 unsignedDiagID = 0;
3386 switch(
D.getContext()) {
3391llvm_unreachable(
"parser should not have allowed this");
3407DiagID = diag::err_type_defined_in_alias_template;
3419DiagID = diag::err_type_defined_in_type_specifier;
3429DiagID = diag::err_type_defined_in_param_type;
3435DiagID = diag::err_type_defined_in_condition;
3442 D.setInvalidType(
true);
3446assert(!
T.isNull() &&
"This function should not return a null type");
3455assert(FTI.
isAmbiguous&&
"no direct-initializer / function ambiguity");
3471 if(!
D.isFunctionDeclarator() ||
3485FTI.
NumParams? diag::warn_parens_disambiguated_as_function_declaration
3486: diag::warn_empty_parens_are_function_decl)
3494 if(!
D.isFirstDeclarator() &&
D.getIdentifier()) {
3497 if(Comma.getFileID() != Name.getFileID() ||
3498Comma.getSpellingLineNumber() != Name.getSpellingLineNumber()) {
3502S.
Diag(
D.getCommaLoc(), diag::note_empty_parens_function_call)
3504<<
D.getIdentifier();
3505 Result.suppressDiagnostics();
3518S.
Diag(B, diag::note_additional_parens_for_variable_declaration)
3533S.
Diag(DeclType.
Loc, diag::note_empty_parens_default_ctor)
3540 if(!
Init.empty())
3541S.
Diag(DeclType.
Loc, diag::note_empty_parens_zero_initialize)
3552 "do not have redundant top-level parentheses");
3561 boolCouldBeTemporaryObject =
3562S.
getLangOpts().CPlusPlus &&
D.isExpressionContext() &&
3563!
D.isInvalidType() &&
D.getIdentifier() &&
3566 D.getDeclSpec().getTypeQualifiers() == 0 &&
D.isFirstDeclarator();
3568 boolStartsWithDeclaratorId =
true;
3569 for(
auto&
C:
D.type_objects()) {
3576StartsWithDeclaratorId =
false;
3580 if(!
C.Arr.NumElts)
3581CouldBeTemporaryObject =
false;
3589CouldBeTemporaryObject =
false;
3590StartsWithDeclaratorId =
false;
3600CouldBeTemporaryObject =
false;
3607CouldBeTemporaryObject =
false;
3608StartsWithDeclaratorId =
false;
3618 if(CouldBeTemporaryObject) {
3622CouldBeTemporaryObject =
false;
3623 Result.suppressDiagnostics();
3628 if(!CouldBeTemporaryObject) {
3633 if(StartsWithDeclaratorId &&
D.getCXXScopeSpec().isValid()) {
3635NNS = NNS->getPrefix()) {
3641S.
Diag(
Paren.Loc, diag::warn_redundant_parens_around_declarator)
3647S.
Diag(
Paren.Loc, diag::warn_parens_disambiguated_as_variable_declaration)
3648<< ParenRange <<
D.getIdentifier();
3650 if(!RD || !RD->hasDefinition() || RD->hasNonTrivialDestructor())
3651S.
Diag(
Paren.Loc, diag::note_raii_guard_add_name)
3653<<
D.getIdentifier();
3656S.
Diag(
D.
getBeginLoc(), diag::note_function_style_cast_add_parentheses)
3659S.
Diag(
Paren.Loc, diag::note_remove_parens_for_variable_declaration)
3675 switch(AL.getKind()) {
3694 boolIsCXXInstanceMethod =
false;
3700 unsignedI = ChunkIndex;
3701 boolFoundNonParen =
false;
3702 while(I && !FoundNonParen) {
3705FoundNonParen =
true;
3708 if(FoundNonParen) {
3711IsCXXInstanceMethod =
3716IsCXXInstanceMethod =
3720assert(
D.isFunctionDeclarator());
3724IsCXXInstanceMethod =
3725 D.isFirstDeclarationOfMember() &&
3727!
D.isStaticMember();
3732IsCXXInstanceMethod);
3739 for(
const ParsedAttr&AL :
D.getDeclSpec().getAttributes()) {
3740 if(AL.getKind() == ParsedAttr::AT_OpenCLKernel) {
3751 if(Triple.isSPIRV() && Triple.getVendor() != llvm::Triple::AMD) {
3752 for(
const ParsedAttr&AL :
D.getDeclSpec().getAttributes()) {
3753 if(AL.getKind() == ParsedAttr::AT_CUDAGlobal) {
3767 enum classSimplePointerKind {
3776 switch(nullability) {
3778 if(!Ident__Nonnull)
3780 returnIdent__Nonnull;
3783 if(!Ident__Nullable)
3785 returnIdent__Nullable;
3788 if(!Ident__Nullable_result)
3790 returnIdent__Nullable_result;
3793 if(!Ident__Null_unspecified)
3795 returnIdent__Null_unspecified;
3797llvm_unreachable(
"Unknown nullability kind.");
3804 if(AL.getKind() == ParsedAttr::AT_TypeNonNull ||
3805AL.getKind() == ParsedAttr::AT_TypeNullable ||
3806AL.getKind() == ParsedAttr::AT_TypeNullableResult ||
3807AL.getKind() == ParsedAttr::AT_TypeNullUnspecified)
3816 enum classPointerDeclaratorKind {
3824MaybePointerToCFRef,
3828NSErrorPointerPointer,
3834 enum classPointerWrappingDeclaratorKind {
3848staticPointerDeclaratorKind
3850PointerWrappingDeclaratorKind &wrappingKind) {
3851 unsignednumNormalPointers = 0;
3854 if(
type->isDependentType())
3855 returnPointerDeclaratorKind::NonPointer;
3860 switch(chunk.
Kind) {
3862 if(numNormalPointers == 0)
3863wrappingKind = PointerWrappingDeclaratorKind::Array;
3872 returnnumNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3873: PointerDeclaratorKind::SingleLevelPointer;
3879 if(numNormalPointers == 0)
3880wrappingKind = PointerWrappingDeclaratorKind::Reference;
3884++numNormalPointers;
3885 if(numNormalPointers > 2)
3886 returnPointerDeclaratorKind::MultiLevelPointer;
3892 unsignednumTypeSpecifierPointers = 0;
3896++numNormalPointers;
3898 if(numNormalPointers > 2)
3899 returnPointerDeclaratorKind::MultiLevelPointer;
3901 type= ptrType->getPointeeType();
3902++numTypeSpecifierPointers;
3908 returnnumNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3909: PointerDeclaratorKind::SingleLevelPointer;
3914 returnnumNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3915: PointerDeclaratorKind::SingleLevelPointer;
3920++numNormalPointers;
3921++numTypeSpecifierPointers;
3924 if(
autoobjcClassDecl = objcObjectPtr->getInterfaceDecl()) {
3926numNormalPointers == 2 && numTypeSpecifierPointers < 2) {
3927 returnPointerDeclaratorKind::NSErrorPointerPointer;
3936 if(objcClass->getInterface()->getIdentifier() ==
3938 if(numNormalPointers == 2 && numTypeSpecifierPointers < 2)
3939 returnPointerDeclaratorKind::NSErrorPointerPointer;
3946 if(numNormalPointers == 0)
3947 returnPointerDeclaratorKind::NonPointer;
3953 if(numNormalPointers == 2 && numTypeSpecifierPointers < 2 &&
3955 returnPointerDeclaratorKind::CFErrorRefPointer;
3963 switch(numNormalPointers) {
3965 returnPointerDeclaratorKind::NonPointer;
3968 returnPointerDeclaratorKind::SingleLevelPointer;
3971 returnPointerDeclaratorKind::MaybePointerToCFRef;
3974 returnPointerDeclaratorKind::MultiLevelPointer;
3983 if(ctx->isFunctionOrMethod())
3986 if(ctx->isFileContext())
3997 boolinvalid =
false;
3999 if(invalid || !sloc.
isFile())
4017template<
typenameDiagBuilderT>
4021assert(PointerLoc.
isValid());
4026 if(!FixItLoc.
isValid() || FixItLoc == PointerLoc)
4035InsertionTextBuf +=
" ";
4036StringRef InsertionText = InsertionTextBuf.str();
4039InsertionText = InsertionText.drop_back();
4040}
else if(NextChar[-1] ==
'[') {
4041 if(NextChar[0] ==
']')
4042InsertionText = InsertionText.drop_back().drop_front();
4044InsertionText = InsertionText.drop_front();
4047InsertionText = InsertionText.drop_back().drop_front();
4054SimplePointerKind PointerKind,
4057assert(PointerLoc.
isValid());
4059 if(PointerKind == SimplePointerKind::Array) {
4060S.
Diag(PointerLoc, diag::warn_nullability_missing_array);
4062S.
Diag(PointerLoc, diag::warn_nullability_missing)
4063<<
static_cast<unsigned>(PointerKind);
4066 autoFixItLoc = PointerEndLoc.
isValid() ? PointerEndLoc : PointerLoc;
4067 if(FixItLoc.isMacroID())
4071 auto Diag= S.
Diag(FixItLoc, diag::note_nullability_fix_it);
4072Diag << static_cast<unsigned>(Nullability);
4073Diag << static_cast<unsigned>(PointerKind);
4102 if(pointerKind == SimplePointerKind::Array)
4103diagKind = diag::warn_nullability_missing_array;
4105diagKind = diag::warn_nullability_missing;
4111fileNullability.
PointerKind=
static_cast<unsigned>(pointerKind);
4143 autokind =
static_cast<SimplePointerKind
>(fileNullability.
PointerKind);
4158 unsignedi = endIndex;
4163 switch(DC.
Kind) {
4186template<
typenameAttrT>
4189return ::new (Ctx) AttrT(Ctx, AL);
4196 returncreateSimpleAttr<TypeNonNullAttr>(Ctx,
Attr);
4199 returncreateSimpleAttr<TypeNullableAttr>(Ctx,
Attr);
4202 returncreateSimpleAttr<TypeNullableResultAttr>(Ctx,
Attr);
4205 returncreateSimpleAttr<TypeNullUnspecifiedAttr>(Ctx,
Attr);
4207llvm_unreachable(
"unknown NullabilityKind");
4218 if(ASOld != ASNew) {
4219S.
Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers);
4224diag::warn_attribute_address_multiple_identical_qualifiers);
4238!isa<RecordType, TemplateSpecializationType>(
4249 Sema&S = state.getSema();
4255 if(
D.getIdentifier())
4256Name =
D.getIdentifier();
4259 boolIsTypedefName =
4275 boolIsClassTemplateDeduction = isa<DeducedTemplateSpecializationType>(DT);
4276 if((AT && AT->
isDecltypeAuto()) || IsClassTemplateDeduction) {
4277 for(
unsignedI = 0,
E=
D.getNumTypeObjects(); I !=
E; ++I) {
4278 unsignedIndex =
E- I - 1;
4280 unsignedDiagId = IsClassTemplateDeduction
4281? diag::err_deduced_class_template_compound_type
4282: diag::err_decltype_auto_compound_type;
4283 unsignedDiagKind = 0;
4284 switch(DeclChunk.
Kind) {
4287 if(IsClassTemplateDeduction) {
4293 if(IsClassTemplateDeduction) {
4298 if(
D.isFunctionDeclarationContext() &&
4299 D.isFunctionDeclarator(FnIndex) && FnIndex == Index)
4301DiagId = diag::err_decltype_auto_function_declarator_not_declaration;
4319S.
Diag(DeclChunk.
Loc, DiagId) << DiagKind;
4320 D.setInvalidType(
true);
4327std::optional<NullabilityKind> inferNullability;
4328 boolinferNullabilityCS =
false;
4329 boolinferNullabilityInnerOnly =
false;
4330 boolinferNullabilityInnerOnlyComplete =
false;
4333 boolinAssumeNonNullRegion =
false;
4335 if(assumeNonNullLoc.
isValid()) {
4336inAssumeNonNullRegion =
true;
4350} complainAboutMissingNullability = CAMN_No;
4351 unsignedNumPointersRemaining = 0;
4352 autocomplainAboutInferringWithinChunk = PointerWrappingDeclaratorKind::None;
4354 if(IsTypedefName) {
4358complainAboutMissingNullability = CAMN_InnerPointers;
4362++NumPointersRemaining;
4365 for(
unsignedi = 0, n =
D.getNumTypeObjects(); i != n; ++i) {
4367 switch(chunk.
Kind) {
4375++NumPointersRemaining;
4383++NumPointersRemaining;
4388 boolisFunctionOrMethod =
false;
4389 switch(
autocontext = state.getDeclarator().getContext()) {
4395isFunctionOrMethod =
true;
4399 if(state.getDeclarator().isObjCIvar() && !isFunctionOrMethod) {
4400complainAboutMissingNullability = CAMN_No;
4405 if(state.getDeclarator().isObjCWeakProperty()) {
4408complainAboutMissingNullability = CAMN_No;
4409 if(inAssumeNonNullRegion) {
4419complainAboutMissingNullability = CAMN_Yes;
4422 autowrappingKind = PointerWrappingDeclaratorKind::None;
4424 casePointerDeclaratorKind::NonPointer:
4425 casePointerDeclaratorKind::MultiLevelPointer:
4429 casePointerDeclaratorKind::SingleLevelPointer:
4431 if(inAssumeNonNullRegion) {
4432complainAboutInferringWithinChunk = wrappingKind;
4439 casePointerDeclaratorKind::CFErrorRefPointer:
4440 casePointerDeclaratorKind::NSErrorPointerPointer:
4443 if(isFunctionOrMethod && inAssumeNonNullRegion)
4447 casePointerDeclaratorKind::MaybePointerToCFRef:
4448 if(isFunctionOrMethod) {
4452 autohasCFReturnsAttr =
4454 returnAttrList.hasAttribute(ParsedAttr::AT_CFReturnsRetained) ||
4455AttrList.hasAttribute(ParsedAttr::AT_CFReturnsNotRetained);
4457 if(
const auto*InnermostChunk =
D.getInnermostNonParenChunk()) {
4458 if(hasCFReturnsAttr(
D.getDeclarationAttributes()) ||
4459hasCFReturnsAttr(
D.getAttributes()) ||
4460hasCFReturnsAttr(InnermostChunk->getAttrs()) ||
4461hasCFReturnsAttr(
D.getDeclSpec().getAttributes())) {
4463inferNullabilityInnerOnly =
true;
4473complainAboutMissingNullability = CAMN_Yes;
4501 autoisVaList = [&S](
QualType T) ->
bool{
4507 if(typedefTy->getDecl() == vaListTypedef)
4509 if(
auto*name = typedefTy->getDecl()->getIdentifier())
4510 if(name->isStr(
"va_list"))
4512typedefTy = typedefTy->desugar()->getAs<
TypedefType>();
4513}
while(typedefTy);
4519 autoinferPointerNullability =
4524 if(NumPointersRemaining > 0)
4525--NumPointersRemaining;
4532 if(inferNullability && !inferNullabilityInnerOnlyComplete) {
4535? ParsedAttr::Form::ContextSensitiveKeyword()
4536: ParsedAttr::Form::Keyword(
false,
4542attrs.addAtEnd(nullabilityAttr);
4544 if(inferNullabilityCS) {
4545state.getDeclarator().getMutableDeclSpec().getObjCQualifiers()
4549 if(pointerLoc.isValid() &&
4550complainAboutInferringWithinChunk !=
4551PointerWrappingDeclaratorKind::None) {
4553S.
Diag(pointerLoc, diag::warn_nullability_inferred_on_nested_type);
4554Diag << static_cast<int>(complainAboutInferringWithinChunk);
4558 if(inferNullabilityInnerOnly)
4559inferNullabilityInnerOnlyComplete =
true;
4560 returnnullabilityAttr;
4565 switch(complainAboutMissingNullability) {
4569 caseCAMN_InnerPointers:
4570 if(NumPointersRemaining == 0)
4584 if(isVaList(
T)) {
4586 if(NumPointersRemaining > 0)
4587--NumPointersRemaining;
4589SimplePointerKind pointerKind = SimplePointerKind::Pointer;
4591pointerKind = SimplePointerKind::BlockPointer;
4593pointerKind = SimplePointerKind::MemberPointer;
4595 if(
auto*
attr= inferPointerNullability(
4596pointerKind,
D.getDeclSpec().getTypeSpecTypeLoc(),
4598 D.getMutableDeclSpec().getAttributes(),
4599 D.getMutableDeclSpec().getAttributePool())) {
4600 T= state.getAttributedType(
4606 if(complainAboutMissingNullability == CAMN_Yes &&
T->
isArrayType() &&
4610 D.getDeclSpec().getTypeSpecTypeLoc());
4614 boolExpectNoDerefChunk =
4615state.getCurrentAttributes().hasAttribute(ParsedAttr::AT_NoDeref);
4625 boolAreDeclaratorChunksValid =
true;
4626 for(
unsignedi = 0, e =
D.getNumTypeObjects(); i != e; ++i) {
4627 unsignedchunkIndex = e - i - 1;
4628state.setCurrentChunkIndex(chunkIndex);
4631 switch(DeclType.
Kind) {
4639 if(!LangOpts.Blocks)
4640S.
Diag(DeclType.
Loc, diag::err_blocks_disable) << LangOpts.OpenCL;
4643inferPointerNullability(SimplePointerKind::BlockPointer, DeclType.
Loc,
4645state.getDeclarator().getAttributePool());
4651 if(LangOpts.OpenCL)
4660S.
Diag(
D.getIdentifierLoc(), diag::err_distant_exception_spec);
4661 D.setInvalidType(
true);
4666inferPointerNullability(SimplePointerKind::Pointer, DeclType.
Loc,
4668state.getDeclarator().getAttributePool());
4680 if(LangOpts.OpenCL) {
4683S.
Diag(
D.getIdentifierLoc(), diag::err_opencl_pointer_to_type) <<
T;
4684 D.setInvalidType(
true);
4696S.
Diag(
D.getIdentifierLoc(), diag::err_distant_exception_spec);
4697 D.setInvalidType(
true);
4710S.
Diag(
D.getIdentifierLoc(), diag::err_distant_exception_spec);
4711 D.setInvalidType(
true);
4721 if(chunkIndex != 0 && !ArraySize &&
4722 D.getDeclSpec().getAttributes().hasMSPropertyAttr()) {
4740S.
Diag(DeclType.
Loc, diag::err_array_star_outside_prototype);
4742 D.setInvalidType(
true);
4749 if(!(
D.isPrototypeContext() ||
4751S.
Diag(DeclType.
Loc, diag::err_array_static_outside_prototype)
4753:
"type qualifier");
4758 D.setInvalidType(
true);
4764S.
Diag(DeclType.
Loc, diag::err_array_static_not_outermost)
4766:
"type qualifier");
4770 D.setInvalidType(
true);
4776 if(complainAboutMissingNullability == CAMN_Yes &&
4792IsQualifiedFunction =
4797 if(!
D.isInvalidType()) {
4801 returnSS.isInvalid() ||
4823? dyn_cast_if_present<ParmVarDecl>(FTI.
Params[0].
Param)
4826 boolIsFunctionDecl =
D.getInnermostNonParenChunk() == &DeclType;
4827 if(
First&&
First->isExplicitObjectParameter() &&
4838!IsClassType(
D.getCXXScopeSpec())) {
4841diag::err_explicit_object_parameter_nonmember)
4843<<
First->getSourceRange();
4846diag::err_explicit_object_parameter_invalid)
4847<<
First->getSourceRange();
4849 D.setInvalidType();
4850AreDeclaratorChunksValid =
false;
4855 if(
D.getDeclSpec().hasAutoTypeSpec() &&
4858S.
Diag(
D.getDeclSpec().getTypeSpecTypeLoc(),
4860? diag::err_auto_missing_trailing_return
4861: diag::err_deduced_return_type);
4863 D.setInvalidType(
true);
4864AreDeclaratorChunksValid =
false;
4866S.
Diag(
D.getDeclSpec().getTypeSpecTypeLoc(),
4867diag::warn_cxx11_compat_deduced_return_type);
4871 if(isa<ParenType>(
T)) {
4874 D.setInvalidType(
true);
4876AreDeclaratorChunksValid =
false;
4877}
else if(
D.getName().
getKind() ==
4881diag::err_deduction_guide_with_complex_decl)
4883 D.setInvalidType(
true);
4885AreDeclaratorChunksValid =
false;
4888(
T.hasQualifiers() || !isa<AutoType>(
T) ||
4889cast<AutoType>(
T)->getKeyword() !=
4891cast<AutoType>(
T)->isConstrained())) {
4902S.
Diag(
Loc, diag::err_trailing_return_without_auto) <<
T<< SR;
4903 D.setInvalidType(
true);
4905AreDeclaratorChunksValid =
false;
4911 D.setInvalidType(
true);
4921 if(InventedParamInfo) {
4923state,
T, TInfo,
Auto, *InventedParamInfo);
4937 unsigneddiagID = diag::err_func_returning_array_function;
4940 if(chunkIndex == 0 &&
4942diagID = diag::err_block_returning_array_function;
4945 D.setInvalidType(
true);
4946AreDeclaratorChunksValid =
false;
4955S.
Diag(
D.getIdentifierLoc(), diag::err_opencl_invalid_return)
4957 D.setInvalidType(
true);
4959}
else if(!S.
getLangOpts().NativeHalfArgsAndReturns &&
4961S.
Diag(
D.getIdentifierLoc(),
4962diag::err_parameters_retval_cannot_have_fp16_type) << 1;
4963 D.setInvalidType(
true);
4967 if(LangOpts.OpenCL) {
4972S.
Diag(
D.getIdentifierLoc(), diag::err_opencl_invalid_return)
4974 D.setInvalidType(
true);
4981 "__cl_clang_variadic_functions", S.
getLangOpts()) &&
4982!(
D.getIdentifier() &&
4983((
D.getIdentifier()->getName() ==
"printf"&&
4985 D.getIdentifier()->getName().starts_with(
"__")))) {
4986S.
Diag(
D.getIdentifierLoc(), diag::err_opencl_variadic_function);
4987 D.setInvalidType(
true);
4999DiagLoc =
D.getDeclSpec().getTypeSpecTypeLoc();
5002S.
Diag(DiagLoc, diag::err_object_cannot_be_passed_returned_by_value)
5014AreDeclaratorChunksValid =
false;
5017 D.setInvalidType(
true);
5026 D.getFunctionDefinitionKind() ==
5031S.
Diag(DeclType.
Loc, diag::err_func_returning_qualified_void) <<
T;
5037 if(
T.isVolatileQualified() && S.
getLangOpts().CPlusPlus20)
5038S.
Diag(DeclType.
Loc, diag::warn_deprecated_volatile_return) <<
T;
5044 if(
T.getQualifiers().hasObjCLifetime()) {
5046 if(chunkIndex + 1 <
D.getNumTypeObjects()) {
5049 if(AL.getKind() == ParsedAttr::AT_ObjCOwnership) {
5050AttrLoc = AL.getLoc();
5056 for(
const ParsedAttr&AL :
D.getDeclSpec().getAttributes()) {
5057 if(AL.getKind() == ParsedAttr::AT_ObjCOwnership) {
5058AttrLoc = AL.getLoc();
5072S.
Diag(AttrLoc, diag::warn_arc_lifetime_result_type)
5073<<
T.getQualifiers().getObjCLifetime();
5077 if(LangOpts.CPlusPlus &&
D.getDeclSpec().hasTagDefinition()) {
5080 TagDecl*Tag = cast<TagDecl>(
D.getDeclSpec().getRepAsDecl());
5081S.
Diag(Tag->getLocation(), diag::err_type_defined_in_result_type)
5089diag::err_exception_spec_in_typedef)
5115diag::warn_c17_compat_ellipsis_only_parameter);
5116 else if(!
D.getDeclarationAttributes().hasAttribute(
5117ParsedAttr::AT_Overloadable) &&
5118!
D.getAttributes().hasAttribute(
5119ParsedAttr::AT_Overloadable) &&
5120!
D.getDeclSpec().getAttributes().hasAttribute(
5121ParsedAttr::AT_Overloadable))
5129diag::err_ident_list_in_fn_declaration);
5130 D.setInvalidType(
true);
5135AreDeclaratorChunksValid =
false;
5158 boolHasAnyInterestingExtParameterInfos =
false;
5160 for(
unsignedi = 0, e = FTI.
NumParams; i != e; ++i) {
5163assert(!ParamTy.
isNull() &&
"Couldn't parse type?");
5174ParamTy = Context.
IntTy;
5179ParamTy = Context.
IntTy;
5184S.
Diag(DeclType.
Loc, diag::err_void_param_qualified);
5190diag::err_void_explicit_object_param);
5205 D.setInvalidType();
5208}
else if(!S.
getLangOpts().NativeHalfArgsAndReturns &&
5211diag::err_parameters_retval_cannot_have_fp16_type) << 0;
5212 D.setInvalidType();
5219 if(BTy->getKind() == BuiltinType::Float) {
5228 D.setInvalidType();
5231 if(LangOpts.ObjCAutoRefCount && Param->
hasAttr<NSConsumedAttr>()) {
5232ExtParameterInfos[i] = ExtParameterInfos[i].withIsConsumed(
true);
5233HasAnyInterestingExtParameterInfos =
true;
5237ExtParameterInfos[i] =
5238ExtParameterInfos[i].withABI(
attr->getABI());
5239HasAnyInterestingExtParameterInfos =
true;
5242 if(Param->
hasAttr<PassObjectSizeAttr>()) {
5243ExtParameterInfos[i] = ExtParameterInfos[i].withHasPassObjectSize();
5244HasAnyInterestingExtParameterInfos =
true;
5247 if(Param->
hasAttr<NoEscapeAttr>()) {
5248ExtParameterInfos[i] = ExtParameterInfos[i].withIsNoEscape(
true);
5249HasAnyInterestingExtParameterInfos =
true;
5252ParamTys.push_back(ParamTy);
5255 if(HasAnyInterestingExtParameterInfos) {
5264 Expr*NoexceptExpr =
nullptr;
5270DynamicExceptions.reserve(N);
5271DynamicExceptionRanges.reserve(N);
5272 for(
unsignedI = 0; I != N; ++I) {
5283DynamicExceptionRanges,
5290 autoIsClassMember = [&]() {
5291 return(!state.getDeclarator().getCXXScopeSpec().isEmpty() &&
5292state.getDeclarator()
5296state.getDeclarator().getContext() ==
5298state.getDeclarator().getContext() ==
5302 if(state.getSema().getLangOpts().OpenCLCPlusPlus && IsClassMember()) {
5311 D.setInvalidType(
true);
5332inferPointerNullability(SimplePointerKind::MemberPointer, DeclType.
Loc,
5334state.getDeclarator().getAttributePool());
5338 D.setInvalidType(
true);
5353llvm_unreachable(
"Nested-name-specifier must name a type");
5365 if(isa<DependentTemplateSpecializationType>(NNSType)) {
5368}
else if(isa<TemplateSpecializationType, RecordType>(NNSType)) {
5372NNSPrefix, ClsType);
5378diag::err_illegal_decl_mempointer_in_nonclass)
5379<< (
D.getIdentifier() ?
D.getIdentifier()->getName() :
"type name")
5381 D.setInvalidType(
true);
5386 D.getIdentifier());
5388AreDeclaratorChunksValid =
false;
5392 D.setInvalidType(
true);
5393AreDeclaratorChunksValid =
false;
5403 D.getMutableDeclSpec().getAttributes());
5409 D.setInvalidType(
true);
5411AreDeclaratorChunksValid =
false;
5420S.
Diag(DeclType.
Loc, diag::warn_noderef_on_non_pointer_or_array);
5422ExpectNoDerefChunk = state.didParseNoDeref();
5426 if(ExpectNoDerefChunk)
5427S.
Diag(state.getDeclarator().getBeginLoc(),
5428diag::warn_noderef_on_non_pointer_or_array);
5441 boolIsBlock =
false;
5443 switch(DeclType.Kind) {
5455S.
Diag(DeclType.Loc, diag::warn_strict_prototypes)
5467assert(!
T.isNull() &&
"T must not be null after this point");
5471assert(FnTy &&
"Why oh why is there not a FunctionProtoType here?");
5484ExplicitObjectMember,
5488Kind = DeductionGuide;
5489 else if(!
D.getCXXScopeSpec().isSet()) {
5492!
D.getDeclSpec().isFriendSpecified())
5502 if(
D.isFunctionDeclarator(I)) {
5505 auto*
P= dyn_cast_or_null<ParmVarDecl>(Chunk.
Fun.
Params->
Param);
5506 if(
P&&
P->isExplicitObjectParameter())
5507Kind = ExplicitObjectMember;
5533 if(IsQualifiedFunction &&
5536(Kind !=
Member||
D.isExplicitObjectMemberFunction() ||
5539 D.isStaticMember())) &&
5545 if(
D.isFunctionDeclarator(I)) {
5558 if(!RemovalLocs.empty()) {
5559llvm::sort(RemovalLocs,
5561RemovalRange =
SourceRange(RemovalLocs.front(), RemovalLocs.back());
5562 Loc= RemovalLocs.front();
5566S.
Diag(
Loc, diag::err_invalid_qualified_function_type)
5567<< Kind <<
D.isFunctionDeclarator() <<
T 5579 for(
unsignedi = 0, e =
D.getNumTypeObjects(); i != e; ++i) {
5589 for(
ParsedAttr&AL :
D.getDeclarationAttributes()) {
5590 if(!AL.slidesFromDeclToDeclSpecLegacyBehavior()) {
5598state.diagnoseIgnoredTypeAttrs(
T);
5609 if(
T.isVolatileQualified() && S.
getLangOpts().CPlusPlus20 &&
5612S.
Diag(
D.getIdentifierLoc(), diag::warn_deprecated_volatile_param) <<
T;
5616 if(
D.hasEllipsis()) {
5621 switch(
D.getContext()) {
5636S.
Diag(
D.getEllipsisLoc(),
5637diag::err_function_parameter_pack_without_parameter_packs)
5657S.
Diag(
D.getEllipsisLoc(),
5658LangOpts.CPlusPlus11
5659? diag::warn_cxx98_compat_variadic_templates
5660: diag::ext_variadic_templates);
5689S.
Diag(
D.getEllipsisLoc(),
5690diag::err_ellipsis_in_declarator_not_parameter);
5696assert(!
T.isNull() &&
"T must not be null at the end of this function");
5697 if(!AreDeclaratorChunksValid)
5709TypeProcessingState state(*
this,
D);
5713 if(
D.isPrototypeContext() &&
getLangOpts().ObjCAutoRefCount)
5732 unsignedchunkIndex) {
5733 Sema&S = state.getSema();
5741 const char*attrStr =
nullptr;
5742 switch(ownership) {
5761&Args, 1, ParsedAttr::Form::GNU());
5770 Sema&S = state.getSema();
5774 boolhasIndirection =
false;
5775 for(
unsignedi = 0, e =
D.getNumTypeObjects(); i != e; ++i) {
5777 switch(chunk.
Kind) {
5786hasIndirection =
true;
5819TypeProcessingState state(*
this,
D);
5834TypeProcessingState &State) {
5839TypeProcessingState &State) {
5841State.getSema().HLSL().TakeLocForHLSLAttribute(TL.
getTypePtr());
5849 if(AL.getKind() == ParsedAttr::AT_MatrixType) {
5858llvm_unreachable(
"no matrix_type attribute found at the expected location!");
5863 switch(Chunk.
Kind) {
5868llvm_unreachable(
"cannot be _Atomic qualified");
5886 classTypeSpecLocFiller :
public TypeLocVisitor<TypeSpecLocFiller> {
5889TypeProcessingState &State;
5893TypeSpecLocFiller(
Sema&S,
ASTContext&Context, TypeProcessingState &State,
5895: SemaRef(S), Context(Context), State(State), DS(DS) {}
5911State.getExpansionLocForMacroQualifiedType(TL.
getTypePtr()));
6034 voidVisitDependentTemplateSpecializationTypeLoc(
6063 if(TemplateId->
NumArgs> 0) {
6075FoundDecl = cast<NamedDecl>(USD);
6077FoundDecl = cast_if_present<NamedDecl>(TN.getAsTemplateDecl());
6123 voidVisitTypeLoc(
TypeLocTL) {
6129 classDeclaratorLocFiller :
public TypeLocVisitor<DeclaratorLocFiller> {
6131TypeProcessingState &State;
6135DeclaratorLocFiller(
ASTContext&Context, TypeProcessingState &State,
6137: Context(Context), State(State), Chunk(Chunk) {}
6140llvm_unreachable(
"qualified type locs not expected here!");
6143llvm_unreachable(
"decayed type locs not expected here!");
6146llvm_unreachable(
"array parameter type locs not expected here!");
6185assert(isa<DependentNameType>(ClsTy) &&
"Unexpected TypeLoc");
6196 if(isa<ElaboratedType>(ClsTy)) {
6211llvm_unreachable(
"Nested-name-specifier must name a type");
6243 for(
unsignedi = 0, e = TL.
getNumParams(), tpi = 0; i != e; ++i) {
6282 voidVisitTypeLoc(
TypeLocTL) {
6283llvm_unreachable(
"unsupported TypeLoc kind in declarator!");
6292 if(AL.getKind() == ParsedAttr::AT_AddressSpace) {
6301 "no address_space attribute found at the expected location!");
6315 Sema&S = State.getSema();
6322 if(isa<PackExpansionType>(
T)) {
6327 for(
unsignedi = 0, e =
D.getNumTypeObjects(); i != e; ++i) {
6330 if(CurrTL.
getTypeLocClass() == TypeLoc::IncompleteArray && e != 1 &&
6331 D.getDeclSpec().getAttributes().hasMSPropertyAttr())
6341 boolHasDesugaredTypeLoc =
true;
6342 while(HasDesugaredTypeLoc) {
6344 caseTypeLoc::MacroQualified: {
6347State.getExpansionLocForMacroQualifiedType(TL.
getTypePtr()));
6352 caseTypeLoc::Attributed: {
6359 caseTypeLoc::Adjusted:
6360 caseTypeLoc::BTFTagAttributed: {
6365 caseTypeLoc::DependentAddressSpace: {
6373HasDesugaredTypeLoc =
false;
6378DeclaratorLocFiller(S.
Context, State,
D.getTypeObject(i)).Visit(CurrTL);
6384 if(ReturnTypeInfo) {
6389TypeSpecLocFiller(S, S.
Context, State,
D.getDeclSpec()).Visit(CurrTL);
6404 "LocInfoType's TypeClass conflicts with an existing Type class");
6410llvm_unreachable(
"LocInfoType leaked into the type system; an opaque TypeTy*" 6411 " was used directly instead of getting the QualType through" 6412 " GetTypeFromParser");
6418assert(
D.getIdentifier() ==
nullptr&&
6419 "Type name should have no identifier!");
6423 if(
D.isInvalidType())
6456 const Expr*AddrSpace,
6459std::optional<llvm::APSInt> OptAddrSpace =
6461 if(!OptAddrSpace) {
6462S.
Diag(AttrLoc, diag::err_attribute_argument_type)
6467llvm::APSInt &addrSpace = *OptAddrSpace;
6470 if(addrSpace.isSigned()) {
6471 if(addrSpace.isNegative()) {
6472S.
Diag(AttrLoc, diag::err_attribute_address_space_negative)
6476addrSpace.setIsSigned(
false);
6479llvm::APSInt
max(addrSpace.getBitWidth());
6483 if(addrSpace >
max) {
6484S.
Diag(AttrLoc, diag::err_attribute_address_space_too_high)
6515 Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers);
6531TypeProcessingState &State) {
6532 Sema&S = State.getSema();
6538 if(!
Attr.diagnoseLangOpts(S)) {
6544 if(
Attr.getNumArgs() != 1) {
6545S.
Diag(
Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
6552 auto*StrLiteral = dyn_cast<StringLiteral>(
Attr.getArgAsExpr(0));
6561StringRef BTFTypeTag = StrLiteral->getString();
6562 Type= State.getBTFTagAttributedType(
6563::new (Ctx) BTFTypeTagAttr(Ctx,
Attr, BTFTypeTag),
Type);
6571TypeProcessingState &State) {
6572 Sema&S = State.getSema();
6577S.
Diag(
Attr.
getLoc(), diag::err_attribute_address_function_type);
6583 if(
Attr.
getKind() == ParsedAttr::AT_AddressSpace) {
6586 if(
Attr.getNumArgs() != 1) {
6593 Expr*ASArgExpr =
static_cast<Expr*
>(
Attr.getArgAsExpr(0));
6602::new (Ctx) AddressSpaceAttr(Ctx,
Attr,
static_cast<unsigned>(ASIdx));
6614 if(EquivType.
isNull()) {
6618 T= State.getAttributedType(ASAttr,
Type, EquivType);
6620 T= State.getAttributedType(ASAttr,
Type,
Type);
6631:
Attr.asOpenCLLangAS();
6633ASIdx =
Attr.asHLSLLangAS();
6636llvm_unreachable(
"Invalid address space");
6654 boolNonObjCPointer =
false;
6656 if(!
type->isDependentType() && !
type->isUndeducedType()) {
6664NonObjCPointer =
true;
6665}
else if(!
type->isObjCRetainableType()) {
6671 if(state.isProcessingDeclSpec()) {
6679 Sema&S = state.getSema();
6685 if(!
attr.isArgIdent(0)) {
6686S.
Diag(AttrLoc, diag::err_attribute_argument_type) <<
attr 6694 if(II->
isStr(
"none"))
6696 else if(II->
isStr(
"strong"))
6698 else if(II->
isStr(
"weak"))
6700 else if(II->
isStr(
"autoreleasing"))
6703S.
Diag(AttrLoc, diag::warn_attribute_type_not_supported) <<
attr<< II;
6720=
type.getQualifiers().getObjCLifetime()) {
6723S.
Diag(AttrLoc, diag::err_attr_objc_ownership_redundant)
6730 if(previousLifetime != lifetime) {
6733 const Type*prevTy =
nullptr;
6734 while(!prevTy || prevTy != underlyingType.
Ty) {
6735prevTy = underlyingType.
Ty;
6744 if(NonObjCPointer) {
6745StringRef name =
attr.getAttrName()->getName();
6754S.
Diag(AttrLoc, diag::warn_type_attribute_wrong_type) << name
6771 type= state.getAttributedType(
6772createSimpleAttr<ObjCInertUnsafeUnretainedAttr>(S.
Context,
attr),
6778 if(!NonObjCPointer)
6784 type= state.getAttributedType(::new (S.
Context)
6795diagnostic,
type,
0));
6797S.
Diag(loc, diagnostic);
6806 unsigneddiagnostic =
6807(S.
getLangOpts().ObjCWeakRuntime ? diag::err_arc_weak_disabled
6808: diag::err_arc_weak_no_runtime);
6811diagnoseOrDelay(S, AttrLoc, diagnostic,
type);
6823 if(
Class->isArcWeakrefUnavailable()) {
6824S.
Diag(AttrLoc, diag::err_arc_unsupported_weak_class);
6825S.
Diag(ObjT->getInterfaceDecl()->getLocation(),
6826diag::note_class_declared);
6841 Sema&S = state.getSema();
6844 if(!
type->isPointerType() &&
6845!
type->isObjCObjectPointerType() &&
6846!
type->isBlockPointerType())
6850S.
Diag(
attr.getLoc(), diag::err_attribute_multiple_objc_gc);
6856 if(!
attr.isArgIdent(0)) {
6857S.
Diag(
attr.getLoc(), diag::err_attribute_argument_type)
6863 if(
attr.getNumArgs() > 1) {
6864S.
Diag(
attr.getLoc(), diag::err_attribute_wrong_number_arguments) <<
attr 6871 if(II->
isStr(
"weak"))
6873 else if(II->
isStr(
"strong"))
6876S.
Diag(
attr.getLoc(), diag::warn_attribute_type_not_supported)
6886 if(
attr.getLoc().isValid())
6887 type= state.getAttributedType(
6904 structFunctionTypeUnwrapper {
6923 const Type*Ty =
T.getTypePtr();
6924 if(isa<FunctionType>(Ty)) {
6925 Fn= cast<FunctionType>(Ty);
6927}
else if(isa<ParenType>(Ty)) {
6928 T= cast<ParenType>(Ty)->getInnerType();
6929Stack.push_back(
Parens);
6930}
else if(isa<ConstantArrayType>(Ty) || isa<VariableArrayType>(Ty) ||
6931isa<IncompleteArrayType>(Ty)) {
6932 T= cast<ArrayType>(Ty)->getElementType();
6933Stack.push_back(Array);
6934}
else if(isa<PointerType>(Ty)) {
6937}
else if(isa<BlockPointerType>(Ty)) {
6939Stack.push_back(BlockPointer);
6940}
else if(isa<MemberPointerType>(Ty)) {
6942Stack.push_back(MemberPointer);
6943}
else if(isa<ReferenceType>(Ty)) {
6946}
else if(isa<AttributedType>(Ty)) {
6947 T= cast<AttributedType>(Ty)->getEquivalentType();
6948Stack.push_back(Attributed);
6949}
else if(isa<MacroQualifiedType>(Ty)) {
6950 T= cast<MacroQualifiedType>(Ty)->getUnderlyingType();
6951Stack.push_back(MacroQualified);
6960Stack.push_back(Desugar);
6965 boolisFunctionType()
const{
return(Fn !=
nullptr); }
6970 if(New == get())
returnOriginal;
6973 returnwrap(S.
Context, Original, 0);
6978 if(I == Stack.size())
6987 returnwrap(
C, SplitOld.
Ty, I);
6988 return C.getQualifiedType(wrap(
C, SplitOld.
Ty, I), SplitOld.
Quals);
6992 if(I == Stack.size())
return QualType(Fn, 0);
6994 switch(
static_cast<WrapKind
>(Stack[I++])) {
7001 returnwrap(
C, cast<AttributedType>(Old)->getEquivalentType(), I);
7004 QualTypeNew = wrap(
C, cast<ParenType>(Old)->getInnerType(), I);
7005 return C.getParenType(New);
7008 caseMacroQualified:
7012 if(
const auto*CAT = dyn_cast<ConstantArrayType>(Old)) {
7013 QualTypeNew = wrap(
C, CAT->getElementType(), I);
7014 return C.getConstantArrayType(New, CAT->getSize(), CAT->getSizeExpr(),
7015CAT->getSizeModifier(),
7016CAT->getIndexTypeCVRQualifiers());
7019 if(
const auto*VAT = dyn_cast<VariableArrayType>(Old)) {
7020 QualTypeNew = wrap(
C, VAT->getElementType(), I);
7021 return C.getVariableArrayType(
7022New, VAT->getSizeExpr(), VAT->getSizeModifier(),
7023VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange());
7026 const auto*IAT = cast<IncompleteArrayType>(Old);
7027 QualTypeNew = wrap(
C, IAT->getElementType(), I);
7028 return C.getIncompleteArrayType(New, IAT->getSizeModifier(),
7029IAT->getIndexTypeCVRQualifiers());
7034 return C.getPointerType(New);
7037 caseBlockPointer: {
7039 return C.getBlockPointerType(New);
7042 caseMemberPointer: {
7045 return C.getMemberPointerType(New, OldMPT->
getClass());
7051 if(isa<LValueReferenceType>(OldRef))
7054 return C.getRValueReferenceType(New);
7058llvm_unreachable(
"unknown wrapping kind");
7065 Sema&S = State.getSema();
7069 default: llvm_unreachable(
"Unknown attribute kind");
7070 caseParsedAttr::AT_Ptr32:
7071A = createSimpleAttr<Ptr32Attr>(S.
Context, PAttr);
7073 caseParsedAttr::AT_Ptr64:
7074A = createSimpleAttr<Ptr64Attr>(S.
Context, PAttr);
7076 caseParsedAttr::AT_SPtr:
7077A = createSimpleAttr<SPtrAttr>(S.
Context, PAttr);
7079 caseParsedAttr::AT_UPtr:
7080A = createSimpleAttr<UPtrAttr>(S.
Context, PAttr);
7084std::bitset<attr::LastAttr> Attrs;
7087 if(
const TypedefType*TT = dyn_cast<TypedefType>(Desugared)) {
7088Desugared = TT->desugar();
7090}
else if(
const ElaboratedType*ET = dyn_cast<ElaboratedType>(Desugared)) {
7091Desugared = ET->desugar();
7104 if(Attrs[NewAttrKind]) {
7105S.
Diag(PAttr.
getLoc(), diag::warn_duplicate_attribute_exact) << PAttr;
7108Attrs[NewAttrKind] =
true;
7112 if(Attrs[attr::Ptr32] && Attrs[attr::Ptr64]) {
7113S.
Diag(PAttr.
getLoc(), diag::err_attributes_are_not_compatible)
7115<<
"'__ptr64'"<<
0;
7117}
else if(Attrs[attr::SPtr] && Attrs[attr::UPtr]) {
7118S.
Diag(PAttr.
getLoc(), diag::err_attributes_are_not_compatible)
7126 if(!isa<PointerType>(Desugared)) {
7130S.
Diag(PAttr.
getLoc(), diag::err_attribute_no_member_pointers) << PAttr;
7132S.
Diag(PAttr.
getLoc(), diag::err_attribute_pointers_only) << PAttr << 0;
7140 if(PtrWidth == 32) {
7141 if(Attrs[attr::Ptr64])
7143 else if(Attrs[attr::UPtr])
7145}
else if(PtrWidth == 64 && Attrs[attr::Ptr32]) {
7162assert(PAttr.
getKind() == ParsedAttr::AT_WebAssemblyFuncref);
7164 Sema&S = State.getSema();
7165 Attr*A = createSimpleAttr<WebAssemblyFuncrefAttr>(S.
Context, PAttr);
7167std::bitset<attr::LastAttr> Attrs;
7169 const auto*AT = dyn_cast<AttributedType>(QT);
7171Attrs[AT->getAttrKind()] =
true;
7172AT = dyn_cast<AttributedType>(AT->getModifiedType());
7177 if(Attrs[NewAttrKind]) {
7178S.
Diag(PAttr.
getLoc(), diag::warn_duplicate_attribute_exact) << PAttr;
7196 Sema&S = State.getSema();
7197 auto&
D= State.getDeclarator();
7203 if(State.isProcessingDeclSpec()) {
7204 if(!(
D.isPrototypeContext() ||
7208 if(
auto*chunk =
D.getInnermostNonParenChunk()) {
7231 autochunkIdx = State.getCurrentChunkIndex();
7232 if(chunkIdx >= 1 &&
7235 D.getTypeObject(chunkIdx - 1).
getAttrs());
7240 auto*A = ::new (S.
Context) SwiftAttrAttr(S.
Context, PAttr, Str);
7241QT = State.getAttributedType(A, QT, QT);
7248 autoAttributed = dyn_cast<AttributedType>(
Type.getTypePtr());
7253 if(Attributed->getImmediateNullability())
7254 returnAttributed->getModifiedType();
7258Ctx, Attributed->getModifiedType());
7259assert(Modified.
getTypePtr() != Attributed->getModifiedType().getTypePtr());
7261Attributed->getEquivalentType(),
7262Attributed->getAttr());
7268 caseParsedAttr::AT_TypeNonNull:
7271 caseParsedAttr::AT_TypeNullable:
7274 caseParsedAttr::AT_TypeNullableResult:
7277 caseParsedAttr::AT_TypeNullUnspecified:
7281llvm_unreachable(
"not a nullability attribute kind");
7288 boolIsContextSensitive,
boolAllowOnArrayType,
boolOverrideExisting) {
7289 bool Implicit= (State ==
nullptr);
7295 while(
auto*Attributed = dyn_cast<AttributedType>(Desugared.
getTypePtr())) {
7297 if(
autoExistingNullability = Attributed->getImmediateNullability()) {
7299 if(Nullability == *ExistingNullability) {
7303S.
Diag(NullabilityLoc, diag::warn_nullability_duplicate)
7310 if(!OverrideExisting) {
7312S.
Diag(NullabilityLoc, diag::err_nullability_conflicting)
7322Desugared = Attributed->getModifiedType();
7330 if(Nullability != *ExistingNullability && !
Implicit) {
7331S.
Diag(NullabilityLoc, diag::err_nullability_conflicting)
7339 if(
autotypedefNullability =
7341 if(*typedefNullability == *ExistingNullability) {
7354!(AllowOnArrayType && Desugared->
isArrayType())) {
7356S.
Diag(NullabilityLoc, diag::err_nullability_nonpointer)
7364 if(IsContextSensitive) {
7366 const Type*pointeeType =
nullptr;
7375S.
Diag(NullabilityLoc, diag::err_nullability_cs_multilevel)
7377S.
Diag(NullabilityLoc, diag::note_nullability_type_specifier)
7389QT = State->getAttributedType(A, QT, QT);
7398 boolAllowOnArrayType) {
7404Nullability, NullabilityLoc,
7405IsContextSensitive, AllowOnArrayType,
7412 boolAllowArrayTypes,
7413 boolOverrideExisting) {
7415*
this,
nullptr,
nullptr,
Type, Nullability, DiagLoc,
7416 false, AllowArrayTypes, OverrideExisting);
7423 Sema&S = state.getSema();
7425 if(isa<ObjCTypeParamType>(
type)) {
7427 type= state.getAttributedType(
7440S.
Diag(
attr.getLoc(), diag::err_objc_kindof_nonobject)
7449objType->getBaseType(), objType->getTypeArgsAsWritten(),
7450objType->getProtocols(),
7451objType->isObjCUnqualifiedId() ?
false:
true);
7456 if(
autonullability =
type->getNullability()) {
7459assert(
attr.getAttributeSpellingListIndex() == 0 &&
7460 "multiple spellings for __kindof?");
7463equivType = state.getAttributedType(A, equivType, equivType);
7468 type= state.getAttributedType(
7469createSimpleAttr<ObjCKindOfAttr>(S.
Context,
attr),
type, equivType);
7481 Declarator&declarator = state.getDeclarator();
7484 automoveToChunk = [&](
DeclaratorChunk&chunk,
boolinFunction) ->
bool{
7497PK_MemberFunctionPointer,
7502: inFunction? PK_MemberFunctionPointer : PK_MemberPointer;
7504 autodiag = state.getSema().Diag(
attr.getLoc(),
7505diag::warn_nullability_declspec)
7507 attr.isContextSensitiveKeywordAttribute())
7509<<
static_cast<unsigned>(pointerKind);
7515state.getSema().getPreprocessor().getLocForEndOfToken(
7517 " "+
attr.getAttrName()->getName().str() +
" ");
7527 for(
unsignedi = state.getCurrentChunkIndex(); i != 0; --i) {
7529 switch(chunk.
Kind) {
7533 returnmoveToChunk(chunk,
false);
7545 returnmoveToChunk(*dest,
true);
7561assert(!
Attr.isInvalid());
7564llvm_unreachable(
"not a calling convention attribute");
7565 caseParsedAttr::AT_CDecl:
7566 returncreateSimpleAttr<CDeclAttr>(Ctx,
Attr);
7567 caseParsedAttr::AT_FastCall:
7568 returncreateSimpleAttr<FastCallAttr>(Ctx,
Attr);
7569 caseParsedAttr::AT_StdCall:
7570 returncreateSimpleAttr<StdCallAttr>(Ctx,
Attr);
7571 caseParsedAttr::AT_ThisCall:
7572 returncreateSimpleAttr<ThisCallAttr>(Ctx,
Attr);
7573 caseParsedAttr::AT_RegCall:
7574 returncreateSimpleAttr<RegCallAttr>(Ctx,
Attr);
7575 caseParsedAttr::AT_Pascal:
7576 returncreateSimpleAttr<PascalAttr>(Ctx,
Attr);
7577 caseParsedAttr::AT_SwiftCall:
7578 returncreateSimpleAttr<SwiftCallAttr>(Ctx,
Attr);
7579 caseParsedAttr::AT_SwiftAsyncCall:
7580 returncreateSimpleAttr<SwiftAsyncCallAttr>(Ctx,
Attr);
7581 caseParsedAttr::AT_VectorCall:
7582 returncreateSimpleAttr<VectorCallAttr>(Ctx,
Attr);
7583 caseParsedAttr::AT_AArch64VectorPcs:
7584 returncreateSimpleAttr<AArch64VectorPcsAttr>(Ctx,
Attr);
7585 caseParsedAttr::AT_AArch64SVEPcs:
7586 returncreateSimpleAttr<AArch64SVEPcsAttr>(Ctx,
Attr);
7587 caseParsedAttr::AT_ArmStreaming:
7588 returncreateSimpleAttr<ArmStreamingAttr>(Ctx,
Attr);
7589 caseParsedAttr::AT_AMDGPUKernelCall:
7590 returncreateSimpleAttr<AMDGPUKernelCallAttr>(Ctx,
Attr);
7591 caseParsedAttr::AT_Pcs: {
7596 if(
Attr.isArgExpr(0))
7597Str = cast<StringLiteral>(
Attr.getArgAsExpr(0))->getString();
7599Str =
Attr.getArgAsIdent(0)->Ident->getName();
7600PcsAttr::PCSType
Type;
7601 if(!PcsAttr::ConvertStrToPCSType(Str,
Type))
7602llvm_unreachable(
"already validated the attribute");
7603return ::new (Ctx) PcsAttr(Ctx,
Attr,
Type);
7605 caseParsedAttr::AT_IntelOclBicc:
7606 returncreateSimpleAttr<IntelOclBiccAttr>(Ctx,
Attr);
7607 caseParsedAttr::AT_MSABI:
7608 returncreateSimpleAttr<MSABIAttr>(Ctx,
Attr);
7609 caseParsedAttr::AT_SysVABI:
7610 returncreateSimpleAttr<SysVABIAttr>(Ctx,
Attr);
7611 caseParsedAttr::AT_PreserveMost:
7612 returncreateSimpleAttr<PreserveMostAttr>(Ctx,
Attr);
7613 caseParsedAttr::AT_PreserveAll:
7614 returncreateSimpleAttr<PreserveAllAttr>(Ctx,
Attr);
7615 caseParsedAttr::AT_M68kRTD:
7616 returncreateSimpleAttr<M68kRTDAttr>(Ctx,
Attr);
7617 caseParsedAttr::AT_PreserveNone:
7618 returncreateSimpleAttr<PreserveNoneAttr>(Ctx,
Attr);
7619 caseParsedAttr::AT_RISCVVectorCC:
7620 returncreateSimpleAttr<RISCVVectorCCAttr>(Ctx,
Attr);
7622llvm_unreachable(
"unexpected attribute kind!");
7625std::optional<FunctionEffectMode>
7630std::optional<llvm::APSInt> ConditionValue =
7632 if(!ConditionValue) {
7635 Diag(CondExpr->
getExprLoc(), diag::err_attribute_argument_type)
7638 returnstd::nullopt;
7647FunctionTypeUnwrapper &Unwrapped) {
7649 if(!Unwrapped.isFunctionType())
7652 Sema&S = TPState.getSema();
7656 if(FPT ==
nullptr) {
7657S.
Diag(PAttr.
getLoc(), diag::err_func_with_effects_no_prototype)
7664 boolIsNonBlocking = PAttr.
getKind() == ParsedAttr::AT_NonBlocking ||
7665PAttr.
getKind() == ParsedAttr::AT_Blocking;
7668 Expr*CondExpr =
nullptr;
7670 if(PAttr.
getKind() == ParsedAttr::AT_NonBlocking ||
7671PAttr.
getKind() == ParsedAttr::AT_NonAllocating) {
7680std::optional<FunctionEffectMode> MaybeMode =
7686NewMode = *MaybeMode;
7688CondExpr =
nullptr;
7721assert(
Success&&
"effect conflicts should have been diagnosed above");
7725FPT->getParamTypes(), EPI);
7734 autoOtherAttr = std::find_if(
7735state.getCurrentAttributes().begin(), state.getCurrentAttributes().end(),
7736[OtherKind](
const ParsedAttr&A) { return A.getKind() == OtherKind; });
7737 if(OtherAttr == state.getCurrentAttributes().end() || OtherAttr->isInvalid())
7740 Sema&S = state.getSema();
7741S.
Diag(
Attr.
getLoc(), diag::err_attributes_are_not_compatible)
7742<< *OtherAttr <<
Attr 7743<< (OtherAttr->isRegularKeywordAttribute() ||
7745S.
Diag(OtherAttr->getLoc(), diag::note_conflicting_attribute);
7753 if(!
Attr.getNumArgs()) {
7759 for(
unsignedI = 0; I <
Attr.getNumArgs(); ++I) {
7760StringRef StateName;
7765 if(StateName !=
"sme_za_state") {
7766S.
Diag(LiteralLoc, diag::err_unknown_arm_state) << StateName;
7773S.
Diag(
Attr.
getLoc(), diag::err_conflicting_attributes_arm_agnostic);
7788 if(!
Attr.getNumArgs()) {
7794 for(
unsignedI = 0; I <
Attr.getNumArgs(); ++I) {
7795StringRef StateName;
7802 if(StateName ==
"za") {
7805}
else if(StateName ==
"zt0") {
7809S.
Diag(LiteralLoc, diag::err_unknown_arm_state) << StateName;
7815S.
Diag(LiteralLoc, diag::err_conflicting_attributes_arm_agnostic);
7824S.
Diag(LiteralLoc, diag::err_conflicting_attributes_arm_state)
7840 Sema&S = state.getSema();
7842FunctionTypeUnwrapper unwrapped(S,
type);
7844 if(
attr.getKind() == ParsedAttr::AT_NoReturn) {
7849 if(!unwrapped.isFunctionType())
7858 if(
attr.getKind() == ParsedAttr::AT_CmseNSCall) {
7860 if(!unwrapped.isFunctionType())
7865S.
Diag(
attr.getLoc(), diag::warn_attribute_ignored) <<
attr;
7879 if(
attr.getKind() == ParsedAttr::AT_NSReturnsRetained) {
7880 if(
attr.getNumArgs())
return true;
7883 if(!unwrapped.isFunctionType())
7888 attr.getLoc(), unwrapped.get()->getReturnType()))
7893 if(state.getSema().getLangOpts().ObjCAutoRefCount) {
7898 type= state.getAttributedType(
7899createSimpleAttr<NSReturnsRetainedAttr>(S.
Context,
attr),
7904 if(
attr.getKind() == ParsedAttr::AT_AnyX86NoCallerSavedRegisters) {
7909 if(!unwrapped.isFunctionType())
7918 if(
attr.getKind() == ParsedAttr::AT_AnyX86NoCfCheck) {
7920S.
Diag(
attr.getLoc(), diag::warn_nocf_check_attribute_ignored);
7930 if(!unwrapped.isFunctionType())
7939 if(
attr.getKind() == ParsedAttr::AT_Regparm) {
7945 if(!unwrapped.isFunctionType())
7952S.
Diag(
attr.getLoc(), diag::err_attributes_are_not_compatible)
7954<<
attr.isRegularKeywordAttribute();
7960unwrapped.get()->getExtInfo().
withRegParm(value);
7965 if(
attr.getKind() == ParsedAttr::AT_ArmStreaming ||
7966 attr.getKind() == ParsedAttr::AT_ArmStreamingCompatible ||
7967 attr.getKind() == ParsedAttr::AT_ArmPreserves ||
7968 attr.getKind() == ParsedAttr::AT_ArmIn ||
7969 attr.getKind() == ParsedAttr::AT_ArmOut ||
7970 attr.getKind() == ParsedAttr::AT_ArmInOut ||
7971 attr.getKind() == ParsedAttr::AT_ArmAgnostic) {
7975 if(
attr.getKind() == ParsedAttr::AT_ArmStreaming ||
7976 attr.getKind() == ParsedAttr::AT_ArmStreamingCompatible)
7980 if(!unwrapped.isFunctionType())
7987S.
Diag(
attr.getLoc(), diag::warn_attribute_wrong_decl_type)
7988<<
attr<<
attr.isRegularKeywordAttribute()
7995 switch(
attr.getKind()) {
7996 caseParsedAttr::AT_ArmStreaming:
7998ParsedAttr::AT_ArmStreamingCompatible))
8002 caseParsedAttr::AT_ArmStreamingCompatible:
8007 caseParsedAttr::AT_ArmPreserves:
8011 caseParsedAttr::AT_ArmIn:
8015 caseParsedAttr::AT_ArmOut:
8019 caseParsedAttr::AT_ArmInOut:
8023 caseParsedAttr::AT_ArmAgnostic:
8028llvm_unreachable(
"Unsupported attribute");
8032FnTy->getParamTypes(), EPI);
8037 if(
attr.getKind() == ParsedAttr::AT_NoThrow) {
8039 if(!unwrapped.isFunctionType())
8052 if(Proto->hasExceptionSpec()) {
8053 switch(Proto->getExceptionSpecType()) {
8055llvm_unreachable(
"This doesn't have an exception spec!");
8073S.
Diag(
attr.getLoc(), diag::warn_nothrow_attribute_ignored);
8079 type= unwrapped.wrap(
8088 if(
attr.getKind() == ParsedAttr::AT_NonBlocking ||
8089 attr.getKind() == ParsedAttr::AT_NonAllocating ||
8090 attr.getKind() == ParsedAttr::AT_Blocking ||
8091 attr.getKind() == ParsedAttr::AT_Allocating) {
8096 if(!unwrapped.isFunctionType())
return false;
8111S.
Diag(
attr.getLoc(), diag::err_attributes_are_not_compatible)
8114<<
attr.isRegularKeywordAttribute();
8133 returnS.
Diag(
attr.getLoc(), diag::warn_cconv_unsupported)
8138 returnS.
Diag(
attr.getLoc(), diag::err_cconv_varargs)
8145S.
Diag(
attr.getLoc(), diag::err_attributes_are_not_compatible)
8147<<
attr.isRegularKeywordAttribute();
8159 autoEI = unwrapped.get()->getExtInfo().withCallingConv(CC);
8183FunctionTypeUnwrapper Unwrapped(*
this,
T);
8185 boolIsVariadic = (isa<FunctionProtoType>(FT) &&
8186cast<FunctionProtoType>(FT)->isVariadic());
8200 Diag(
Loc, diag::warn_cconv_unsupported)
8211 if(CurCC != DefaultCC)
8219 QualTypeWrapped = Unwrapped.wrap(*
this, FT);
8233 if(
Attr.getNumArgs() != 1) {
8240 Expr*SizeExpr =
Attr.getArgAsExpr(0);
8253 if(
Attr.getNumArgs() != 1) {
8259 Expr*SizeExpr =
Attr.getArgAsExpr(0);
8274 boolIsPolyUnsigned = Triple.getArch() == llvm::Triple::aarch64 ||
8275Triple.getArch() == llvm::Triple::aarch64_32 ||
8276Triple.getArch() == llvm::Triple::aarch64_be;
8278 if(IsPolyUnsigned) {
8280 returnBTy->
getKind() == BuiltinType::UChar ||
8281BTy->
getKind() == BuiltinType::UShort ||
8282BTy->
getKind() == BuiltinType::ULong ||
8283BTy->
getKind() == BuiltinType::ULongLong;
8286 returnBTy->
getKind() == BuiltinType::SChar ||
8287BTy->
getKind() == BuiltinType::Short ||
8288BTy->
getKind() == BuiltinType::LongLong;
8294 if((Triple.isArch64Bit() || Triple.getArch() == llvm::Triple::aarch64_32) &&
8295BTy->
getKind() == BuiltinType::Double)
8298 returnBTy->
getKind() == BuiltinType::SChar ||
8299BTy->
getKind() == BuiltinType::UChar ||
8300BTy->
getKind() == BuiltinType::Short ||
8301BTy->
getKind() == BuiltinType::UShort ||
8302BTy->
getKind() == BuiltinType::Int ||
8303BTy->
getKind() == BuiltinType::UInt ||
8304BTy->
getKind() == BuiltinType::Long ||
8305BTy->
getKind() == BuiltinType::ULong ||
8306BTy->
getKind() == BuiltinType::LongLong ||
8307BTy->
getKind() == BuiltinType::ULongLong ||
8308BTy->
getKind() == BuiltinType::Float ||
8309BTy->
getKind() == BuiltinType::Half ||
8310BTy->
getKind() == BuiltinType::BFloat16 ||
8311BTy->
getKind() == BuiltinType::MFloat8;
8315llvm::APSInt &
Result) {
8316 const auto*AttrExpr =
Attr.getArgAsExpr(0);
8317 if(!AttrExpr->isTypeDependent()) {
8318 if(std::optional<llvm::APSInt> Res =
8319AttrExpr->getIntegerConstantExpr(S.
Context)) {
8339 boolIsTargetCUDAAndHostARM =
false;
8342IsTargetCUDAAndHostARM =
8351S.
Diag(
Attr.
getLoc(), diag::err_attribute_unsupported_m_profile)
8352<<
Attr<<
"'mve'";
8359S.
Diag(
Attr.
getLoc(), diag::err_attribute_unsupported_m_profile)
8360<<
Attr<<
"'mve'";
8366 if(
Attr.getNumArgs() != 1) {
8367S.
Diag(
Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
8373llvm::APSInt numEltsInt(32);
8379!IsTargetCUDAAndHostARM) {
8380S.
Diag(
Attr.
getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
8387 unsignednumElts =
static_cast<unsigned>(numEltsInt.getZExtValue());
8388 unsignedvecSize = typeSize * numElts;
8389 if(vecSize != 64 && vecSize != 128) {
8390S.
Diag(
Attr.
getLoc(), diag::err_attribute_bad_neon_vector_size) << CurType;
8414S.
Diag(
Attr.
getLoc(), diag::err_attribute_arm_feature_sve_bits_unsupported)
8421 if(
Attr.getNumArgs() != 1) {
8422S.
Diag(
Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
8429llvm::APSInt SveVectorSizeInBits(32);
8433 unsignedVecSize =
static_cast<unsigned>(SveVectorSizeInBits.getZExtValue());
8436 if(VecSize != S.
getLangOpts().VScaleMin * 128) {
8437S.
Diag(
Attr.
getLoc(), diag::err_attribute_bad_sve_vector_size)
8445S.
Diag(
Attr.
getLoc(), diag::err_attribute_invalid_sve_type)
8456 if(BT->getKind() == BuiltinType::SveBool) {
8461VecSize /= TypeSize;
8468 const VectorType*VT = dyn_cast<VectorType>(CurType);
8471diag::err_attribute_arm_mve_polymorphism);
8477State.getAttributedType(createSimpleAttr<ArmMveStrictPolymorphismAttr>(
8478State.getSema().Context,
Attr),
8490<<
Attr<<
"'zve32x'";
8497 if(!VScale || !VScale->first || VScale->first != VScale->second) {
8498S.
Diag(
Attr.
getLoc(), diag::err_attribute_riscv_rvv_bits_unsupported)
8505 if(
Attr.getNumArgs() != 1) {
8506S.
Diag(
Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
8513llvm::APSInt RVVVectorSizeInBits(32);
8519S.
Diag(
Attr.
getLoc(), diag::err_attribute_invalid_rvv_type)
8525 unsignedVecSize =
static_cast<unsigned>(RVVVectorSizeInBits.getZExtValue());
8529 unsignedMinElts = Info.
EC.getKnownMinValue();
8532 unsignedExpectedSize = VScale->first * MinElts;
8554ExpectedSize *= EltSize;
8555NumElts = VecSize / EltSize;
8559 if(VecSize != ExpectedSize) {
8560S.
Diag(
Attr.
getLoc(), diag::err_attribute_bad_rvv_vector_size)
8561<< VecSize << ExpectedSize;
8574S.
Diag(
Attr.
getLoc(), diag::err_opencl_invalid_access_qualifier);
8580 QualTypeBaseTy = TypedefTy->desugar();
8582std::string PrevAccessQual;
8584 if(TypedefTy->getDecl()->hasAttr<OpenCLAccessAttr>()) {
8585OpenCLAccessAttr *
Attr=
8586TypedefTy->getDecl()->getAttr<OpenCLAccessAttr>();
8589PrevAccessQual =
"read_only";
8593 switch(ImgType->getKind()) {
8594 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 8595 case BuiltinType::Id: \ 8596 PrevAccessQual = #Access; \ 8598 #include "clang/Basic/OpenCLImageTypes.def" 8600llvm_unreachable(
"Unable to find corresponding image type.");
8603llvm_unreachable(
"unexpected type");
8606 if(PrevAccessQual == AttrName.ltrim(
"_")) {
8612S.
Diag(
Attr.
getLoc(), diag::err_opencl_multiple_access_qualifiers);
8615S.
Diag(TypedefTy->getDecl()->getBeginLoc(),
8616diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
8618 if(
Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) {
8633 if(
Attr.getNumArgs() != 2) {
8634S.
Diag(
Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
8639 Expr*RowsExpr =
Attr.getArgAsExpr(0);
8640 Expr*ColsExpr =
Attr.getArgAsExpr(1);
8648 Sema&S = State.getSema();
8651S.
Diag(PA.
getLoc(), diag::err_attribute_too_few_arguments) << PA << 1;
8663 for(
unsignedIdx = 1; Idx < PA.
getNumArgs(); Idx++) {
8669 auto*AnnotateTypeAttr =
8670AnnotateTypeAttr::Create(S.
Context, Str, Args.data(), Args.size(), PA);
8671CurType = State.getAttributedType(AnnotateTypeAttr, CurType, CurType);
8677 if(State.getDeclarator().isDeclarationOfFunction()) {
8678CurType = State.getAttributedType(
8679createSimpleAttr<LifetimeBoundAttr>(State.getSema().Context,
Attr),
8683State.getSema().Diag(
Attr.
getLoc(), diag::err_attribute_wrong_decl_type)
8690 if(State.getDeclarator().isDeclarationOfFunction()) {
8691 auto*
Attr= State.getSema().ParseLifetimeCaptureByAttr(PA,
"this");
8693CurType = State.getAttributedType(
Attr, CurType, CurType);
8705 if(
Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout ||
8706 Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) {
8707State.setParsedHLSLParamMod(
true);
8716state.setParsedNoDeref(
false);
8717 if(attrs.
empty())
8732 if(
attr.isInvalid())
8735 if(
attr.isStandardAttributeSyntax() ||
attr.isRegularKeywordAttribute()) {
8740 if(
attr.isGNUScope()) {
8741assert(
attr.isStandardAttributeSyntax());
8742 boolIsTypeAttr =
attr.isTypeAttr();
8744state.getSema().Diag(
attr.getLoc(),
8746? diag::warn_gcc_ignores_type_attr
8747: diag::warn_cxx11_gnu_attribute_on_type)
8753!
attr.isTypeAttr()) {
8766 switch(
attr.getKind()) {
8769 if((
attr.isStandardAttributeSyntax() ||
8770 attr.isRegularKeywordAttribute()) &&
8772state.getSema().Diag(
attr.getLoc(), diag::err_attribute_not_type_attr)
8773<<
attr<<
attr.isRegularKeywordAttribute();
8774 attr.setUsedAsTypeAttr();
8779 if(
attr.isStandardAttributeSyntax()) {
8780state.getSema().Diag(
attr.getLoc(),
8781diag::warn_unknown_attribute_ignored)
8792 caseParsedAttr::AT_BTFTypeTag:
8794 attr.setUsedAsTypeAttr();
8797 caseParsedAttr::AT_MayAlias:
8800 attr.setUsedAsTypeAttr();
8802 caseParsedAttr::AT_OpenCLPrivateAddressSpace:
8803 caseParsedAttr::AT_OpenCLGlobalAddressSpace:
8804 caseParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
8805 caseParsedAttr::AT_OpenCLGlobalHostAddressSpace:
8806 caseParsedAttr::AT_OpenCLLocalAddressSpace:
8807 caseParsedAttr::AT_OpenCLConstantAddressSpace:
8808 caseParsedAttr::AT_OpenCLGenericAddressSpace:
8809 caseParsedAttr::AT_HLSLGroupSharedAddressSpace:
8810 caseParsedAttr::AT_AddressSpace:
8812 attr.setUsedAsTypeAttr();
8817 attr.setUsedAsTypeAttr();
8819 caseParsedAttr::AT_VectorSize:
8821 attr.setUsedAsTypeAttr();
8823 caseParsedAttr::AT_ExtVectorType:
8825 attr.setUsedAsTypeAttr();
8827 caseParsedAttr::AT_NeonVectorType:
8829 attr.setUsedAsTypeAttr();
8831 caseParsedAttr::AT_NeonPolyVectorType:
8834 attr.setUsedAsTypeAttr();
8836 caseParsedAttr::AT_ArmSveVectorBits:
8838 attr.setUsedAsTypeAttr();
8840 caseParsedAttr::AT_ArmMveStrictPolymorphism: {
8842 attr.setUsedAsTypeAttr();
8845 caseParsedAttr::AT_RISCVRVVVectorBits:
8847 attr.setUsedAsTypeAttr();
8849 caseParsedAttr::AT_OpenCLAccess:
8851 attr.setUsedAsTypeAttr();
8853 caseParsedAttr::AT_LifetimeBound:
8857 caseParsedAttr::AT_LifetimeCaptureBy:
8862 caseParsedAttr::AT_NoDeref: {
8867 if(
attr.isStandardAttributeSyntax()) {
8868state.getSema().Diag(
attr.getLoc(), diag::warn_attribute_ignored)
8873 type= state.getAttributedType(createSimpleAttr<NoDerefAttr>(Ctx,
attr),
8875 attr.setUsedAsTypeAttr();
8876state.setParsedNoDeref(
true);
8880 caseParsedAttr::AT_MatrixType:
8882 attr.setUsedAsTypeAttr();
8885 caseParsedAttr::AT_WebAssemblyFuncref: {
8887 attr.setUsedAsTypeAttr();
8891 caseParsedAttr::AT_HLSLParamModifier: {
8893 attr.setUsedAsTypeAttr();
8897 caseParsedAttr::AT_SwiftAttr: {
8904 attr.setUsedAsTypeAttr();
8912 if(
type->canHaveNullability() ||
type->isDependentType() ||
8913 type->isArrayType() ||
8917endIndex = state.getCurrentChunkIndex();
8919endIndex = state.getDeclarator().getNumTypeObjects();
8920 boolallowOnArrayType =
8921state.getDeclarator().isPrototypeContext() &&
8924allowOnArrayType)) {
8928 attr.setUsedAsTypeAttr();
8932 caseParsedAttr::AT_ObjCKindOf:
8940state.getSema().Diag(
attr.getLoc(),
8941diag::err_objc_kindof_wrong_position)
8944state.getDeclarator().getDeclSpec().getBeginLoc(),
8954 caseParsedAttr::AT_NoThrow:
8957 if(!state.getSema().getLangOpts().CPlusPlus)
8961 attr.setUsedAsTypeAttr();
8965 if(
attr.isStandardAttributeSyntax() ||
8966 attr.isRegularKeywordAttribute()) {
8983 caseParsedAttr::AT_AcquireHandle: {
8984 if(!
type->isFunctionType())
8987 if(
attr.getNumArgs() != 1) {
8988state.getSema().Diag(
attr.getLoc(),
8989diag::err_attribute_wrong_number_arguments)
8995StringRef HandleType;
8996 if(!state.getSema().checkStringLiteralArgumentAttr(
attr, 0, HandleType))
8998 type= state.getAttributedType(
8999AcquireHandleAttr::Create(state.getSema().Context, HandleType,
attr),
9001 attr.setUsedAsTypeAttr();
9004 caseParsedAttr::AT_AnnotateType: {
9006 attr.setUsedAsTypeAttr();
9009 caseParsedAttr::AT_HLSLResourceClass:
9010 caseParsedAttr::AT_HLSLROV:
9011 caseParsedAttr::AT_HLSLRawBuffer:
9012 caseParsedAttr::AT_HLSLContainedType: {
9017state.getSema().HLSL().handleResourceTypeAttr(
type,
attr))
9018 attr.setUsedAsTypeAttr();
9025 if(isa<AttributedType>(
type) &&
attr.hasMacroIdentifier() &&
9026!
type.getQualifiers().hasObjCLifetime() &&
9027!
type.getQualifiers().hasObjCGCAttr() &&
9028 attr.getKind() != ParsedAttr::AT_ObjCGC &&
9029 attr.getKind() != ParsedAttr::AT_ObjCOwnership) {
9031 type= state.getSema().Context.getMacroQualifiedType(
type, MacroII);
9032state.setExpansionLocForMacroQualifiedType(
9033cast<MacroQualifiedType>(
type.getTypePtr()),
9034 attr.getMacroExpansionLoc());
9041 if(
VarDecl*Var = dyn_cast<VarDecl>(DRE->getDecl())) {
9043 auto*Def = Var->getDefinition();
9049Def = Var->getDefinition();
9056 if(Var->getPointOfInstantiation().isInvalid() && Def) {
9057assert(Var->getTemplateSpecializationKind() ==
9059 "explicit instantiation with no point of instantiation");
9060Var->setTemplateSpecializationKind(
9061Var->getTemplateSpecializationKind(), PointOfInstantiation);
9081 if(
const autoCastE = dyn_cast<ExplicitCastExpr>(
E)) {
9082 QualTypeDestType = CastE->getTypeAsWritten();
9088IAT->getElementType(),
9125 if(RequireCompleteTypeImpl(
Loc,
T, Kind, &Diagnoser))
9128 if(!Tag->getDecl()->isCompleteDefinitionRequired()) {
9129Tag->getDecl()->setCompleteDefinitionRequired();
9148 returnCtx.IsEquivalent(
D, Suggested);
9159 if(isa<TagDecl>(
D) && cast<TagDecl>(
D)->isBeingDefined()) {
9163}
else if(
auto*RD = dyn_cast<CXXRecordDecl>(
D)) {
9164 if(
auto*Pattern = RD->getTemplateInstantiationPattern())
9166 D= RD->getDefinition();
9167}
else if(
auto*ED = dyn_cast<EnumDecl>(
D)) {
9168 if(
auto*Pattern = ED->getTemplateInstantiationPattern())
9170 if(OnlyNeedComplete && (ED->isFixed() ||
getLangOpts().MSVCCompat)) {
9176*Suggested =
nullptr;
9177 for(
auto*Redecl : ED->redecls()) {
9180 if(Redecl->isThisDeclarationADefinition() ||
9181(Redecl->isCanonicalDecl() && !*Suggested))
9182*Suggested = Redecl;
9187 D= ED->getDefinition();
9188}
else if(
auto*FD = dyn_cast<FunctionDecl>(
D)) {
9189 if(
auto*Pattern = FD->getTemplateInstantiationPattern())
9191 D= FD->getDefinition();
9192}
else if(
auto*VD = dyn_cast<VarDecl>(
D)) {
9193 if(
auto*Pattern = VD->getTemplateInstantiationPattern())
9195 D= VD->getDefinition();
9198assert(
D&&
"missing definition for pattern of instantiated definition");
9202 autoDefinitionIsAcceptable = [&] {
9222 if(DefinitionIsAcceptable())
9228Source->CompleteRedeclChain(
D);
9229 returnDefinitionIsAcceptable();
9245 boolOnlyNeedComplete) {
9262 boolOnlyNeedComplete) {
9270 if(!RD->
hasAttr<MSInheritanceAttr>()) {
9272 boolBestCase =
false;
9292RD->
addAttr(MSInheritanceAttr::CreateImplicit(
9299CompleteTypeKind Kind,
9300TypeDiagnoser *Diagnoser) {
9310 if(!MPTy->getClass()->isDependentType()) {
9312!MPTy->getClass()->getAsCXXRecordDecl()->isBeingDefined() &&
9314diag::err_memptr_incomplete))
9333 if(Def && !isa<EnumDecl>(Def))
9344 if(Diagnoser && Suggested)
9347 return!TreatAsComplete;
9349CodeSynthesisContext TempInst;
9351TempInst.Template = Def;
9352TempInst.Entity = Def;
9353TempInst.PointOfInstantiation =
Loc;
9361 TagDecl*
Tag= dyn_cast_or_null<TagDecl>(Def);
9375 if(Tag &&
Tag->hasExternalLexicalStorage())
9376Source->CompleteType(Tag);
9378Source->CompleteType(IFace);
9382 returnRequireCompleteTypeImpl(
Loc,
T, Kind, Diagnoser);
9389 if(
auto*RD = dyn_cast_or_null<CXXRecordDecl>(Tag)) {
9390 boolInstantiated =
false;
9391 boolDiagnosed =
false;
9392 if(RD->isDependentContext()) {
9396}
else if(
auto*ClassTemplateSpec =
9397dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
9398 if(ClassTemplateSpec->getSpecializationKind() ==
TSK_Undeclared) {
9404Instantiated =
true;
9408 if(!RD->isBeingDefined() && Pattern) {
9410assert(MSI &&
"Missing member specialization information?");
9420Instantiated =
true;
9428 if(Diagnoser && Diagnosed)
9434 returnRequireCompleteTypeImpl(
Loc,
T, Kind, Diagnoser);
9444Diagnoser->diagnose(*
this,
Loc,
T);
9448 if(Tag && !
Tag->isInvalidDecl() && !
Tag->getLocation().isInvalid())
9450 Tag->isBeingDefined() ? diag::note_type_being_defined
9451: diag::note_forward_declaration)
9485 default: llvm_unreachable(
"Invalid tag kind for literal type diagnostic!");
9529 for(
const auto&I : RD->
vbases())
9530 Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here)
9531<< I.getSourceRange();
9534 Diag(RD->
getLocation(), diag::note_non_literal_no_constexpr_ctors) << RD;
9536 for(
const auto&I : RD->
bases()) {
9537 if(!I.getType()->isLiteralType(
Context)) {
9538 Diag(I.getBeginLoc(), diag::note_non_literal_base_class)
9539<< RD << I.getType() << I.getSourceRange();
9543 for(
const auto*I : RD->
fields()) {
9544 if(!I->getType()->isLiteralType(
Context) ||
9545I->getType().isVolatileQualified()) {
9546 Diag(I->getLocation(), diag::note_non_literal_field)
9547<< RD << I << I->getType()
9548<< I->getType().isVolatileQualified();
9558assert(Dtor &&
"class has literal fields and bases but no dtor?");
9563 Diag(Dtor->
getLocation(), diag::note_non_literal_non_constexpr_dtor)
9567? diag::note_non_literal_user_provided_dtor
9568: diag::note_non_literal_nontrivial_dtor)
9613 auto*CountDecl = cast<DeclRefExpr>(
E)->getDecl();
9637 if(
auto*ImplCastExpr = dyn_cast<ImplicitCastExpr>(
E))
9638IDExpr = ImplCastExpr->getSubExpr();
9640 if(
auto*PackExpr = dyn_cast<PackIndexingExpr>(
E)) {
9642IDExpr = PackExpr->getPackIdExpression();
9644IDExpr = PackExpr->getSelectedExpr();
9660 if(
const auto*SNTTPE = dyn_cast<SubstNonTypeTemplateParmExpr>(IDExpr))
9661 returnSNTTPE->getParameterType(
Context);
9669 if(
const auto*DRE = dyn_cast<DeclRefExpr>(IDExpr)) {
9672 returnisa<TemplateParamObjectDecl>(VD) ?
T.getUnqualifiedType() :
T;
9674 if(
const auto*ME = dyn_cast<MemberExpr>(IDExpr)) {
9675 if(
const auto*VD = ME->getMemberDecl())
9676 if(isa<FieldDecl>(VD) || isa<VarDecl>(VD))
9677 returnVD->getType();
9678}
else if(
const auto*IR = dyn_cast<ObjCIvarRefExpr>(IDExpr)) {
9679 returnIR->getDecl()->getType();
9680}
else if(
const auto*PR = dyn_cast<ObjCPropertyRefExpr>(IDExpr)) {
9681 if(PR->isExplicitProperty())
9682 returnPR->getExplicitProperty()->getType();
9683}
else if(
const auto*PE = dyn_cast<PredefinedExpr>(IDExpr)) {
9684 returnPE->getType();
9695 if(
auto*DRE = dyn_cast<DeclRefExpr>(IDExpr->
IgnoreParens())) {
9696 if(
auto*Var = dyn_cast<VarDecl>(DRE->getDecl())) {
9716 Diag(
E->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
9729 Diag(
Loc, diag::err_expected_name_of_pack) << Pattern;
9733 if(!
Type.isNull())
9735: diag::ext_pack_indexing);
9742 boolFullySubstituted,
9745std::optional<int64_t> Index;
9753Index =
Value.getExtValue();
9754IndexExpr = Res.
get();
9757 if(FullySubstituted && Index) {
9758 if(*Index < 0 || *Index >= int64_t(Expansions.size())) {
9760<< *Index << Pattern << Expansions.size();
9766Expansions, Index.value_or(-1));
9773assert(ED &&
"EnumType has no EnumDecl");
9778assert(!Underlying.
isNull());
9786 Diag(
Loc, diag::err_only_enums_have_underlying_types);
9794 Diag(
Loc, diag::err_underlying_type_of_incomplete_enum) << BaseType;
9795 Diag(FwdDecl->
getLocation(), diag::note_forward_declaration) << FwdDecl;
9830Split.Quals.removeCVRQualifiers();
9840UKind == UnaryTransformType::AddLvalueReference,
9848 if(UKind == UnaryTransformType::RemoveAllExtents)
9852 returnAT->getElementType();
9861 if(UKind == UTTKind::RemoveCVRef &&
9862(
T.isConstQualified() ||
T.isVolatileQualified())) {
9874 if((BaseType->
isReferenceType() && UKind != UTTKind::RemoveRestrict) ||
9881 if(UKind == UTTKind::RemoveConst || UKind == UTTKind::RemoveCV)
9883 if(UKind == UTTKind::RemoveVolatile || UKind == UTTKind::RemoveCV)
9885 if(UKind == UTTKind::RemoveRestrict)
9896 if(
auto*
BitInt= dyn_cast<BitIntType>(Underlying)) {
9897 unsigned intBits =
BitInt->getNumBits();
9901S.
Diag(
Loc, diag::err_make_signed_integral_only)
9902<< IsMakeSigned <<
true<< BaseType << 1 << Underlying;
9906S.
Diag(
Loc, diag::err_make_signed_integral_only)
9907<< IsMakeSigned <<
false<< BaseType << 1
9914std::array<CanQualType *, 6> AllSignedIntegers = {
9918AllSignedIntegers.data(), AllSignedIntegers.size() - Int128Unsupported);
9919std::array<CanQualType *, 6> AllUnsignedIntegers = {
9924AllUnsignedIntegers.size() -
9927IsMakeSigned ? &AvailableSignedIntegers : &AvailableUnsignedIntegers;
9931llvm::find_if(*Consider, [&S, BaseSize](
const CanQual<Type>*
T) {
9935assert(
Result!= Consider->end());
9936 return QualType((*Result)->getTypePtr(), 0);
9941 boolIsMakeSigned = UKind == UnaryTransformType::MakeSigned;
9946 Diag(
Loc, diag::err_make_signed_integral_only)
9947<< IsMakeSigned << BaseType->
isBitIntType() << BaseType << 0;
9951 boolIsNonIntIntegral =
9960 if(Underlying.
isNull())
9971 caseUnaryTransformType::EnumUnderlyingType: {
9975 caseUnaryTransformType::AddPointer: {
9979 caseUnaryTransformType::RemovePointer: {
9983 caseUnaryTransformType::Decay: {
9987 caseUnaryTransformType::AddLvalueReference:
9988 caseUnaryTransformType::AddRvalueReference: {
9992 caseUnaryTransformType::RemoveAllExtents:
9993 caseUnaryTransformType::RemoveExtent: {
9997 caseUnaryTransformType::RemoveCVRef:
9998 caseUnaryTransformType::RemoveReference: {
10002 caseUnaryTransformType::RemoveConst:
10003 caseUnaryTransformType::RemoveCV:
10004 caseUnaryTransformType::RemoveRestrict:
10005 caseUnaryTransformType::RemoveVolatile: {
10009 caseUnaryTransformType::MakeSigned:
10010 caseUnaryTransformType::MakeUnsigned: {
10016 return!
Result.isNull()
10028 intDisallowedKind = -1;
10030DisallowedKind = 1;
10032DisallowedKind = 2;
10034DisallowedKind = 3;
10036DisallowedKind = 4;
10037 else if(
T.hasQualifiers())
10038DisallowedKind = 5;
10040DisallowedKind = 6;
10043DisallowedKind = 7;
10045DisallowedKind = 8;
10048DisallowedKind = 9;
10050 if(DisallowedKind != -1) {
10051 Diag(
Loc, diag::err_atomic_specifier_bad_type) << DisallowedKind <<
T;
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
Defines the clang::LangOptions interface.
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.
Defines the clang::Preprocessor interface.
static QualType getUnderlyingType(const SubRegion *R)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for HLSL constructs.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenMP constructs and clauses.
static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S, VectorKind VecKind)
HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to c...
static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType)
static bool isPermittedNeonBaseType(QualType &Ty, VectorKind VecKind, Sema &S)
static void distributeObjCPointerTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType type)
Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator i...
static void maybeSynthesizeBlockSignature(TypeProcessingState &state, QualType declSpecType)
Add a synthetic '()' to a block-literal declarator if it is required, given the return type.
#define MS_TYPE_ATTRS_CASELIST
#define CALLING_CONV_ATTRS_CASELIST
static void emitNullabilityConsistencyWarning(Sema &S, SimplePointerKind PointerKind, SourceLocation PointerLoc, SourceLocation PointerEndLoc)
static void fixItNullability(Sema &S, DiagBuilderT &Diag, SourceLocation PointerLoc, NullabilityKind Nullability)
Creates a fix-it to insert a C-style nullability keyword at pointerLoc, taking into account whitespac...
static ExprResult checkArraySize(Sema &S, Expr *&ArraySize, llvm::APSInt &SizeVal, unsigned VLADiag, bool VLAIsError)
Check whether the specified array bound can be evaluated using the relevant language rules.
static Attr * createNullabilityAttr(ASTContext &Ctx, ParsedAttr &Attr, NullabilityKind NK)
static void HandleVectorSizeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars,...
static void inferARCWriteback(TypeProcessingState &state, QualType &declSpecType)
Given that this is the declaration of a parameter under ARC, attempt to infer attributes and such for...
static TypeSourceInfo * GetTypeSourceInfoForDeclarator(TypeProcessingState &State, QualType T, TypeSourceInfo *ReturnTypeInfo)
Create and instantiate a TypeSourceInfo with type source information.
static bool BuildAddressSpaceIndex(Sema &S, LangAS &ASIdx, const Expr *AddrSpace, SourceLocation AttrLoc)
Build an AddressSpace index from a constant expression and diagnose any errors related to invalid add...
static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state, Qualifiers::ObjCLifetime ownership, unsigned chunkIndex)
static bool handleObjCGCTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type.
static void fillAtomicQualLoc(AtomicTypeLoc ATL, const DeclaratorChunk &Chunk)
static void HandleExtVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
Process the OpenCL-like ext_vector_type attribute when it occurs on a type.
static void HandleHLSLParamModifierAttr(TypeProcessingState &State, QualType &CurType, const ParsedAttr &Attr, Sema &S)
static void HandleLifetimeBoundAttr(TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
static bool handleArmStateAttribute(Sema &S, FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, FunctionType::ArmStateValue State)
static bool handleArmAgnosticAttribute(Sema &S, FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr)
static void distributeFunctionTypeAttrFromDeclSpec(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
A function type attribute was written in the decl spec.
static bool handleObjCPointerTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static QualType inferARCLifetimeForPointee(Sema &S, QualType type, SourceLocation loc, bool isReference)
Given that we're building a pointer or reference to the given.
static bool handleNonBlockingNonAllocatingTypeAttr(TypeProcessingState &TPState, ParsedAttr &PAttr, QualType &QT, FunctionTypeUnwrapper &Unwrapped)
static QualType ChangeIntegralSignedness(Sema &S, QualType BaseType, bool IsMakeSigned, SourceLocation Loc)
static bool CheckNullabilityTypeSpecifier(Sema &S, TypeProcessingState *State, ParsedAttr *PAttr, QualType &QT, NullabilityKind Nullability, SourceLocation NullabilityLoc, bool IsContextSensitive, bool AllowOnArrayType, bool OverrideExisting)
#define OBJC_POINTER_TYPE_ATTRS_CASELIST
static void diagnoseBadTypeAttribute(Sema &S, const ParsedAttr &attr, QualType type)
diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type.
static PointerDeclaratorKind classifyPointerDeclarator(Sema &S, QualType type, Declarator &declarator, PointerWrappingDeclaratorKind &wrappingKind)
Classify the given declarator, whose type-specified is type, based on what kind of pointer it refers ...
static bool verifyValidIntegerConstantExpr(Sema &S, const ParsedAttr &Attr, llvm::APSInt &Result)
static void HandleSwiftAttr(TypeProcessingState &State, TypeAttrLocation TAL, QualType &QT, ParsedAttr &PAttr)
static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static bool shouldHaveNullability(QualType T)
static void HandleArmMveStrictPolymorphismAttr(TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
static void warnAboutAmbiguousFunction(Sema &S, Declarator &D, DeclaratorChunk &DeclType, QualType RT)
Produce an appropriate diagnostic for an ambiguity between a function declarator and a C++ direct-ini...
static void distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
Distribute an objc_gc type attribute that was written on the declarator.
static FileID getNullabilityCompletenessCheckFileID(Sema &S, SourceLocation loc)
static void HandleArmSveVectorBitsTypeAttr(QualType &CurType, ParsedAttr &Attr, Sema &S)
HandleArmSveVectorBitsTypeAttr - The "arm_sve_vector_bits" attribute is used to create fixed-length v...
#define FUNCTION_TYPE_ATTRS_CASELIST
static void HandleLifetimeCaptureByAttr(TypeProcessingState &State, QualType &CurType, ParsedAttr &PA)
static bool distributeNullabilityTypeAttr(TypeProcessingState &state, QualType type, ParsedAttr &attr)
Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer,...
static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, QualType &declSpecType, CUDAFunctionTarget CFT)
Given that there are attributes written on the declarator or declaration itself, try to distribute an...
static void fillHLSLAttributedResourceTypeLoc(HLSLAttributedResourceTypeLoc TL, TypeProcessingState &State)
static bool isDependentOrGNUAutoType(QualType T)
static void distributeFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType type)
A function type attribute was written somewhere in a declaration other than on the declarator itself ...
static void HandleMatrixTypeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
HandleMatrixTypeAttr - "matrix_type" attribute, like ext_vector_type.
static bool HandleWebAssemblyFuncrefAttr(TypeProcessingState &State, QualType &QT, ParsedAttr &PAttr)
static bool hasOuterPointerLikeChunk(const Declarator &D, unsigned endIndex)
Returns true if any of the declarator chunks before endIndex include a level of indirection: array,...
static void HandleOpenCLAccessAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
Handle OpenCL Access Qualifier Attribute.
static NullabilityKind mapNullabilityAttrKind(ParsedAttr::Kind kind)
Map a nullability attribute kind to a nullability kind.
static bool distributeFunctionTypeAttrToInnermost(TypeProcessingState &state, ParsedAttr &attr, ParsedAttributesView &attrList, QualType &declSpecType, CUDAFunctionTarget CFT)
Try to distribute a function type attribute to the innermost function chunk or type.
#define NULLABILITY_TYPE_ATTRS_CASELIST
static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, TypeSourceInfo *&ReturnTypeInfo)
static void checkNullabilityConsistency(Sema &S, SimplePointerKind pointerKind, SourceLocation pointerLoc, SourceLocation pointerEndLoc=SourceLocation())
Complains about missing nullability if the file containing pointerLoc has other uses of nullability (...
static void transferARCOwnership(TypeProcessingState &state, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
Used for transferring ownership in casts resulting in l-values.
static std::string getPrintableNameForEntity(DeclarationName Entity)
static std::string getFunctionQualifiersAsString(const FunctionProtoType *FnTy)
static QualType rebuildAttributedTypeWithoutNullability(ASTContext &Ctx, QualType Type)
Rebuild an attributed type without the nullability attribute on it.
static DeclaratorChunk * maybeMovePastReturnType(Declarator &declarator, unsigned i, bool onlyBlockPointers)
Given the index of a declarator chunk, check whether that chunk directly specifies the return type of...
static OpenCLAccessAttr::Spelling getImageAccess(const ParsedAttributesView &Attrs)
static void fillMatrixTypeLoc(MatrixTypeLoc MTL, const ParsedAttributesView &Attrs)
static UnaryTransformType::UTTKind TSTToUnaryTransformType(DeclSpec::TST SwitchTST)
static void HandleRISCVRVVVectorBitsTypeAttr(QualType &CurType, ParsedAttr &Attr, Sema &S)
HandleRISCVRVVVectorBitsTypeAttr - The "riscv_rvv_vector_bits" attribute is used to create fixed-leng...
static void HandleAddressSpaceTypeAttribute(QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type.
static bool checkQualifiedFunction(Sema &S, QualType T, SourceLocation Loc, QualifiedFunctionKind QFK)
Check whether the type T is a qualified function type, and if it is, diagnose that it cannot be conta...
static bool checkOmittedBlockReturnType(Sema &S, Declarator &declarator, QualType Result)
Return true if this is omitted block return type.
static bool DiagnoseMultipleAddrSpaceAttributes(Sema &S, LangAS ASOld, LangAS ASNew, SourceLocation AttrLoc)
static void warnAboutRedundantParens(Sema &S, Declarator &D, QualType T)
Produce an appropriate diagnostic for a declarator with top-level parentheses.
static QualType ConvertDeclSpecToType(TypeProcessingState &state)
Convert the specified declspec to the appropriate type object.
static std::pair< QualType, TypeSourceInfo * > InventTemplateParameter(TypeProcessingState &state, QualType T, TypeSourceInfo *TrailingTSI, AutoType *Auto, InventedTemplateParameterInfo &Info)
static void distributeFunctionTypeAttrFromDeclarator(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType, CUDAFunctionTarget CFT)
A function type attribute was written on the declarator or declaration.
static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, unsigned &TypeQuals, QualType TypeSoFar, unsigned RemoveTQs, unsigned DiagID)
static CallingConv getCCForDeclaratorChunk(Sema &S, Declarator &D, const ParsedAttributesView &AttrList, const DeclaratorChunk::FunctionTypeInfo &FTI, unsigned ChunkIndex)
Helper for figuring out the default CC for a function declarator type.
static unsigned getLiteralDiagFromTagKind(TagTypeKind Tag)
Get diagnostic select index for tag kind for literal type diagnostic message.
static void recordNullabilitySeen(Sema &S, SourceLocation loc)
Marks that a nullability feature has been used in the file containing loc.
static bool CheckBitIntElementType(Sema &S, SourceLocation AttrLoc, const BitIntType *BIT, bool ForMatrixType=false)
static void checkExtParameterInfos(Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
Check the extended parameter information.
static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type, CUDAFunctionTarget CFT)
Process an individual function attribute.
static void transferARCOwnershipToDeclSpec(Sema &S, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
static void BuildTypeCoupledDecls(Expr *E, llvm::SmallVectorImpl< TypeCoupledDeclRefInfo > &Decls)
static void assignInheritanceModel(Sema &S, CXXRecordDecl *RD)
Locks in the inheritance model for the given class and all of its bases.
static bool checkObjCKindOfType(TypeProcessingState &state, QualType &type, ParsedAttr &attr)
Check the application of the Objective-C '__kindof' qualifier to the given type.
static bool hasNullabilityAttr(const ParsedAttributesView &attrs)
Check whether there is a nullability attribute of any kind in the given attribute list.
static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type.
static void moveAttrFromListToList(ParsedAttr &attr, ParsedAttributesView &fromList, ParsedAttributesView &toList)
static void HandleAnnotateTypeAttr(TypeProcessingState &State, QualType &CurType, const ParsedAttr &PA)
static void fillAttributedTypeLoc(AttributedTypeLoc TL, TypeProcessingState &State)
static void fillDependentAddressSpaceTypeLoc(DependentAddressSpaceTypeLoc DASTL, const ParsedAttributesView &Attrs)
TypeAttrLocation
The location of a type attribute.
@ TAL_DeclChunk
The attribute is part of a DeclaratorChunk.
@ TAL_DeclSpec
The attribute is in the decl-specifier-seq.
@ TAL_DeclName
The attribute is immediately after the declaration's name.
static bool isOmittedBlockReturnType(const Declarator &D)
isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a ...
static TypeSourceInfo * GetFullTypeForDeclarator(TypeProcessingState &state, QualType declSpecType, TypeSourceInfo *TInfo)
static QualType GetEnumUnderlyingType(Sema &S, QualType BaseType, SourceLocation Loc)
static bool IsNoDerefableChunk(const DeclaratorChunk &Chunk)
static AttrT * createSimpleAttr(ASTContext &Ctx, ParsedAttr &AL)
static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy, Declarator &D, unsigned FunctionChunkIndex)
static void processTypeAttrs(TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, const ParsedAttributesView &attrs, CUDAFunctionTarget CFT=CUDAFunctionTarget::HostDevice)
static bool checkMutualExclusion(TypeProcessingState &state, const FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, AttributeCommonInfo::Kind OtherKind)
static Attr * getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr)
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
__DEVICE__ int max(int __a, int __b)
virtual void HandleTagDeclRequiredDefinition(const TagDecl *D)
This callback is invoked the first time each TagDecl is required to be complete.
virtual void AssignInheritanceModel(CXXRecordDecl *RD)
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
QualType getParenType(QualType NamedType) const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped) const
unsigned getIntWidth(QualType T) const
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
const LangOptions & getLangOpts() const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const
Get a function type and produce the equivalent function type with the specified exception specificati...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const TargetInfo * getAuxTargetInfo() const
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
QualType getCorrespondingSaturatedType(QualType Ty) const
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
LangAS getDefaultOpenCLPointeeAddrSpace()
Returns default address space based on OpenCL version and enabled features.
const clang::PrintingPolicy & getPrintingPolicy() const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedInt128Ty
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
CanQualType UnsignedLongLongTy
CanQualType UnsignedShortTy
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
const TargetInfo & getTargetInfo() const
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
QualType getCorrespondingUnsignedType(QualType T) const
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getCorrespondingSignedType(QualType T) const
bool isPromotableIntegerType(QualType T) const
More type predicates useful for type checking/promotion.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
Wrapper for source info for array parameter types.
Wrapper for source info for arrays.
void setLBracketLoc(SourceLocation Loc)
void setRBracketLoc(SourceLocation Loc)
void setSizeExpr(Expr *Size)
TypeLoc getValueLoc() const
void setKWLoc(SourceLocation Loc)
void setParensRange(SourceRange Range)
Attr - This represents one attribute.
attr::Kind getKind() const
const char * getSpelling() const
Combines information about the source-code form of an attribute, including its syntax and spelling.
SourceRange getRange() const
bool isContextSensitiveKeywordAttribute() const
bool isRegularKeywordAttribute() const
SourceLocation getLoc() const
const IdentifierInfo * getAttrName() const
Type source information for an attributed type.
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
void setAttr(const Attr *A)
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
bool isCallingConv() const
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
bool hasExplicitTemplateArgs() const
const NestedNameSpecifierLoc getNestedNameSpecifierLoc() const
SourceLocation getRAngleLoc() const
ConceptDecl * getNamedConcept() const
SourceLocation getLAngleLoc() const
void setConceptReference(ConceptReference *CR)
NamedDecl * getFoundDecl() const
TemplateArgumentLoc getArgLoc(unsigned i) const
unsigned getNumArgs() const
DeclarationNameInfo getConceptNameInfo() const
void setRParenLoc(SourceLocation Loc)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
bool isDecltypeAuto() const
ConceptDecl * getTypeConstraintConcept() const
Type source information for an btf_tag attributed type.
TypeLoc getWrappedLoc() const
Comparison function object.
A fixed int type of a specified bitwidth.
unsigned getNumBits() const
Wrapper for source info for block pointers.
void setCaretLoc(SourceLocation Loc)
Wrapper for source info for builtin types.
TypeSpecifierWidth getWrittenWidthSpec() const
bool needsExtraLocalData() const
void setBuiltinLoc(SourceLocation Loc)
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
TypeSpecifierSign getWrittenSignSpec() const
void expandBuiltinRange(SourceRange Range)
This class is used for builtin types like 'int'.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
bool isLambda() const
Determine whether this class describes a lambda function object.
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
CXXRecordDecl * getMostRecentNonInjectedDecl()
base_class_range vbases()
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
bool hasDefinition() const
MSInheritanceModel calculateInheritanceModel() const
Calculate what the inheritance model would be for this class.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
SourceRange getRange() const
SourceLocation getBeginLoc() const
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
Represents a canonical, potentially-qualified type.
SourceLocation getBegin() const
CharUnits - This is an opaque type for sizes expressed in character units.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Declaration of a C++20 concept.
static ConceptReference * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten)
const TypeClass * getTypePtr() const
TypeLoc getNextTypeLoc() const
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
Wrapper for source info for pointers decayed from arrays and functions.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool isFunctionOrMethod() const
A reference to a declared variable, function, enum, etc.
Captures information about "declaration specifiers".
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
bool isTypeSpecPipe() const
static const TST TST_typeof_unqualType
SourceLocation getTypeSpecSignLoc() const
static const TST TST_typename
SourceLocation getEndLoc() const LLVM_READONLY
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
static const TST TST_char8
static const TST TST_BFloat16
Expr * getPackIndexingExpr() const
TST getTypeSpecType() const
SCS getStorageClassSpec() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isTypeSpecSat() const
SourceRange getSourceRange() const LLVM_READONLY
static const TST TST_auto_type
static const TST TST_interface
static const TST TST_double
static const TST TST_typeofExpr
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
TemplateIdAnnotation * getRepAsTemplateId() const
static const TST TST_union
static const TST TST_typename_pack_indexing
static const TST TST_char
static const TST TST_bool
static const TST TST_char16
static const TST TST_unknown_anytype
TSC getTypeSpecComplex() const
ParsedType getRepAsType() const
static const TST TST_accum
static const TST TST_half
ParsedAttributes & getAttributes()
SourceLocation getEllipsisLoc() const
bool isTypeAltiVecPixel() const
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
SourceLocation getConstSpecLoc() const
static const TST TST_ibm128
Expr * getRepAsExpr() const
static const TST TST_enum
static const TST TST_float128
static const TST TST_decltype
SourceRange getTypeSpecWidthRange() const
SourceLocation getTypeSpecTypeNameLoc() const
SourceLocation getTypeSpecWidthLoc() const
SourceLocation getRestrictSpecLoc() const
static const TST TST_typeof_unqualExpr
static const TST TST_class
static const TST TST_decimal64
bool isTypeAltiVecBool() const
bool isConstrainedAuto() const
static const TST TST_wchar
SourceLocation getTypeSpecComplexLoc() const
static const TST TST_void
bool isTypeAltiVecVector() const
static const TST TST_bitint
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
static const TST TST_float
static const TST TST_atomic
static const TST TST_fract
Decl * getRepAsDecl() const
static const TST TST_float16
static bool isTransformTypeTrait(TST T)
static const TST TST_unspecified
SourceLocation getAtomicSpecLoc() const
TypeSpecifierSign getTypeSpecSign() const
CXXScopeSpec & getTypeSpecScope()
SourceLocation getTypeSpecTypeLoc() const
static const TST TST_decltype_auto
static const TST TST_error
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
static const TST TST_decimal32
TypeSpecifierWidth getTypeSpecWidth() const
static const TST TST_char32
static const TST TST_decimal128
bool isTypeSpecOwned() const
SourceLocation getTypeSpecSatLoc() const
SourceRange getTypeofParensRange() const
static const TST TST_int128
SourceLocation getVolatileSpecLoc() const
static const TST TST_typeofType
static const TST TST_auto
static const TST TST_struct
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
ASTContext & getASTContext() const LLVM_READONLY
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
Kind
Lists the kind of concrete classes of Decl.
bool isInvalidDecl() const
SourceLocation getLocation() const
void setImplicit(bool I=true)
SourceLocation getBeginLoc() const LLVM_READONLY
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible.
The name of a declaration.
std::string getAsString() const
Retrieve the human-readable string for this name.
NameKind getNameKind() const
Determine what kind of name this is.
Information about one declarator, including the parsed type information and the identifier.
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
const ParsedAttributes & getAttributes() const
SourceLocation getIdentifierLoc() const
void setInvalidType(bool Val=true)
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
const ParsedAttributesView & getDeclarationAttributes() const
DeclaratorContext getContext() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
void setRParenLoc(SourceLocation Loc)
void setDecltypeLoc(SourceLocation Loc)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
void setAttrNameLoc(SourceLocation loc)
void setAttrOperandParensRange(SourceRange range)
void setAttrExprOperand(Expr *e)
Represents an extended address space qualifier where the input address space value is dependent.
void copy(DependentNameTypeLoc Loc)
void setNameLoc(SourceLocation Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
void setNameLoc(SourceLocation Loc)
void copy(DependentTemplateSpecializationTypeLoc Loc)
void setNameLoc(SourceLocation Loc)
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
bool getSuppressSystemWarnings() const
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
void copy(ElaboratedTypeLoc Loc)
void setElaboratedKeywordLoc(SourceLocation Loc)
TypeLoc getNamedTypeLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
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...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
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 CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
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.
A SourceLocation and its associated SourceManager.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
A mutable set of FunctionEffects and possibly conditions attached to them.
bool insert(const FunctionEffectWithCondition &NewEC, Conflicts &Errs)
Represents an abstract function effect, using just an enumeration describing its kind.
Kind
Identifies the particular effect.
An immutable set of FunctionEffects and possibly conditions attached to them.
Represents a prototype with parameter type info, e.g.
Qualifiers getMethodQuals() const
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Wrapper for source info for functions.
unsigned getNumParams() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
void setParam(unsigned i, ParmVarDecl *VD)
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
A class which abstracts out some details necessary for making a call.
ExtInfo withNoCfCheck(bool noCfCheck) const
ExtInfo withCallingConv(CallingConv cc) const
CallingConv getCC() const
ExtInfo withProducesResult(bool producesResult) const
ExtInfo withNoReturn(bool noReturn) const
bool getProducesResult() const
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
ExtInfo withCmseNSCall(bool cmseNSCall) const
ExtInfo withRegParm(unsigned RegParm) const
ParameterABI getABI() const
Return the ABI treatment of this parameter.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
static StringRef getNameForCallConv(CallingConv CC)
static ArmStateValue getArmZT0State(unsigned AttrBits)
static ArmStateValue getArmZAState(unsigned AttrBits)
CallingConv getCallConv() const
QualType getReturnType() const
bool getHasRegParm() const
AArch64SMETypeAttributes
The AArch64 SME ACLE (Arm C/C++ Language Extensions) define a number of function type attributes that...
@ SME_PStateSMEnabledMask
@ SME_PStateSMCompatibleMask
@ SME_AgnosticZAStateMask
Type source information for HLSL attributed resource type.
TypeLoc getWrappedLoc() const
void setContainedTypeSourceInfo(TypeSourceInfo *TSI) const
void setSourceRange(const SourceRange &R)
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
void setAmpLoc(SourceLocation Loc)
An lvalue reference type, per C++11 [dcl.ref].
@ PPTMK_FullGeneralityMultipleInheritance
@ PPTMK_FullGeneralityVirtualInheritance
@ PPTMK_FullGeneralitySingleInheritance
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool requiresStrictPrototypes() const
Returns true if functions without prototypes or functions with an identifier list (aka K&R C function...
bool isImplicitIntAllowed() const
Returns true if implicit int is supported at all.
bool isImplicitIntRequired() const
Returns true if implicit int is part of the language requirements.
unsigned getOpenCLCompatibleVersion() const
Return the OpenCL version that kernel language is compatible with.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
Represents the results of name lookup.
TypeLoc getInnerLoc() const
void setExpansionLoc(SourceLocation Loc)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
void setAttrRowOperand(Expr *e)
void setAttrColumnOperand(Expr *e)
void setAttrOperandParensRange(SourceRange range)
void setAttrNameLoc(SourceLocation loc)
static bool isValidElementType(QualType T)
Valid elements types are the following:
Wrapper for source info for member pointers.
void setStarLoc(SourceLocation Loc)
void setClassTInfo(TypeSourceInfo *TI)
const Type * getClass() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
const Type * getClass() const
Provides information a specialization of a member of a class template, which may be a member function...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
A C++ nested-name-specifier augmented with source location information.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Represents an ObjC class declaration.
Wrapper for source info for ObjC interfaces.
void setNameLoc(SourceLocation Loc)
void setNameEndLoc(SourceLocation Loc)
Interfaces are the core concept in Objective-C for object oriented design.
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
Represents a pointer to an Objective C object.
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
Represents a class type in Objective C.
static OpaquePtr make(QualType P)
OpenCL supported extensions and optional core features.
bool isAvailableOption(llvm::StringRef Ext, const LangOptions &LO) const
bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const
void setEllipsisLoc(SourceLocation Loc)
A parameter attribute which changes the argument-passing ABI rule for the parameter.
void setRParenLoc(SourceLocation Loc)
void setLParenLoc(SourceLocation Loc)
Represents a parameter to a function.
bool isExplicitObjectParameter() const
void setKNRPromoted(bool promoted)
void setExplicitObjectParameterLoc(SourceLocation Loc)
ParsedAttr - Represents a syntactic attribute.
void setInvalid(bool b=true) const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
bool isArgIdent(unsigned Arg) const
Expr * getArgAsExpr(unsigned Arg) const
AttributeCommonInfo::Kind getKind() const
void setUsedAsTypeAttr(bool Used=true)
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
void addAtEnd(ParsedAttr *newAttr)
bool hasAttribute(ParsedAttr::Kind K) const
void remove(ParsedAttr *ToBeRemoved)
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
TypeLoc getValueLoc() const
void setKWLoc(SourceLocation Loc)
Wrapper for source info for pointers.
void setStarLoc(SourceLocation Loc)
PointerType - C99 6.7.5.1 - Pointer Declarators.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
SourceLocation getPragmaAssumeNonNullLoc() const
The location of the currently-active #pragma clang assume_nonnull begin.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasQualifiers() const
Determine whether this type has any 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.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
bool isReferenceable() const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
Wrapper of type source information for a type with non-trivial direct qualifiers.
UnqualTypeLoc getUnqualifiedLoc() const
The collection of all-type qualifiers we support.
void removeCVRQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
void addCVRUQualifiers(unsigned mask)
@ MaxAddressSpace
The maximum supported address space number.
static Qualifiers fromCVRMask(unsigned CVR)
void setUnaligned(bool flag)
std::string getAsString() const
void addObjCLifetime(ObjCLifetime type)
void setAmpAmpLoc(SourceLocation Loc)
Represents a struct/union/class.
field_range fields() const
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
bool isSpelledAsLValue() const
bool isFunctionDeclarationScope() const
isFunctionDeclarationScope - Return true if this scope is a function prototype scope.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
CUDAFunctionTarget IdentifyTarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
QualType ProcessResourceTypeAttributes(QualType Wrapped)
QualType getInoutParameterType(QualType Ty)
bool isCFError(RecordDecl *D)
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
bool isInOpenMPTaskUntiedContext() const
Return true if currently in OpenMP task with untied clause context.
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
Abstract base class used for diagnosing integer constant expression violations.
Sema - This implements semantic analysis and AST building for C.
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
QualType BuildParenType(QualType T)
Build a paren type including T.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Scope * getCurScope() const
Retrieve the parser's current scope.
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
bool checkArrayElementAlignment(QualType EltTy, SourceLocation Loc)
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
std::optional< FunctionEffectMode > ActOnEffectExpression(Expr *CondExpr, StringRef AttributeName)
Try to parse the conditional expression attached to an effect attribute (e.g.
@ AcceptSizeless
Relax the normal rules for complete types so that they include sizeless built-in types.
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
bool hasMergedDefinitionInCurrentModule(const NamedDecl *Def)
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
ASTContext & getASTContext() const
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr, CUDAFunctionTarget CFT=CUDAFunctionTarget::InvalidTarget)
Check validaty of calling convention attribute attr.
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, Expr *CountExpr, bool CountInBytes, bool OrNull)
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
QualType BuiltinRemoveReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
@ UPPC_TypeConstraint
A type constraint.
const LangOptions & getLangOpts() const
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, QualType ConstrainedType, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
void NoteTemplateLocation(const NamedDecl &Decl, std::optional< SourceRange > ParamRange={})
QualType BuiltinEnumUnderlyingType(QualType BaseType, SourceLocation Loc)
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
const LangOptions & LangOpts
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(const IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
void completeExprArrayBound(Expr *E)
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
bool hasExplicitCallingConv(QualType T)
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
sema::FunctionScopeInfo * getCurFunction() const
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true, bool PrimaryHasMatchedPackOnParmToNonPackOnArg=false)
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
ExprResult DefaultLvalueConversion(Expr *E)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false, bool ForDefaultArgumentSubstitution=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc)
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
QualType getDecltypeForExpr(Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
SourceManager & getSourceManager() const
QualType BuiltinAddReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
bool hasVisibleMergedDefinition(const NamedDecl *Def)
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
QualType BuildAtomicType(QualType T, SourceLocation Loc)
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
bool diagnoseConflictingFunctionEffect(const FunctionEffectsRef &FX, const FunctionEffectWithCondition &EC, SourceLocation NewAttrLoc)
Warn and return true if adding a function effect to a set would create a conflict.
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
TypeResult ActOnTypeName(Declarator &D)
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration,...
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
QualType BuiltinAddPointer(QualType BaseType, SourceLocation Loc)
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
bool CheckImplicitNullabilityTypeSpecifier(QualType &Type, NullabilityKind Nullability, SourceLocation DiagLoc, bool AllowArrayTypes, bool OverrideExisting)
Check whether a nullability type specifier can be added to the given type through some means not writ...
void CheckConstrainedAuto(const AutoType *AutoT, SourceLocation Loc)
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
QualType getCapturedDeclRefType(ValueDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind, SourceLocation Loc)
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary â that is,...
QualType BuiltinChangeCVRQualifiers(QualType BaseType, UTTKind UKind, SourceLocation Loc)
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
SourceManager & SourceMgr
DiagnosticsEngine & Diags
OpenCLOptions & getOpenCLOptions()
QualType BuiltinRemovePointer(QualType BaseType, SourceLocation Loc)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
llvm::BumpPtrAllocator BumpAlloc
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc)
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD=nullptr)
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind, SourceLocation Loc)
void adjustMemberFunctionCC(QualType &T, bool HasThisPointer, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMemberKind CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
const char * getCharacterData(SourceLocation SL, bool *Invalid=nullptr) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer.
CharSourceRange getImmediateExpansionRange(SourceLocation Loc) const
Return the start/end of the expansion information for an expansion location.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Information about a FileID, basically just the logical file that it represents and include stack info...
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
SourceLocation getIncludeLoc() const
This is a discriminated union of FileInfo and ExpansionInfo.
const FileInfo & getFile() const
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
Represents the declaration of a struct/union/class/enum.
void setEmbeddedInDeclarator(bool isInDeclarator)
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
TagKind getTagKind() const
Wrapper for source info for tag types.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Exposes information about the current target.
virtual bool hasBitIntType() const
Determine whether the _BitInt type is supported on this target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual size_t getMaxBitIntWidth() const
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
virtual bool allowHalfArgsAndReturns() const
Whether half args and returns are supported.
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts, bool IsArmStreamingFunction) const
Returns target-specific min and max values VScale_Range.
bool isVLASupported() const
Whether target supports variable-length arrays.
virtual bool hasIbm128Type() const
Determine whether the __ibm128 type is supported on this target.
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Location wrapper for a TemplateArgument.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
SourceLocation getRAngleLoc() const
void copy(TemplateSpecializationTypeLoc Loc)
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
const Type * getTypeForDecl() const
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
void initializeFullCopy(TypeLoc Other)
Initializes this by copying its information from another TypeLoc of the same type.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
void * getOpaqueData() const
Get the pointer where source information is stored.
void copy(TypeLoc other)
Copies the other type loc into this one.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location.
SourceLocation getEndLoc() const
Get the end source location.
SourceLocation getBeginLoc() const
Get the begin source location.
void setUnmodifiedTInfo(TypeSourceInfo *TI) const
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.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
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
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isIncompleteArrayType() const
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool isUndeducedAutoType() const
bool isConstantArrayType() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
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 isVariableArrayType() const
bool isSizelessBuiltinType() const
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isBitIntType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isChar16Type() const
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
QualType getCanonicalTypeInternal() const
bool isWebAssemblyTableType() const
Returns true if this is a WebAssembly table type: either an array of reference types,...
bool isMemberPointerType() const
bool isAtomicType() const
bool isFunctionProtoType() const
bool isChar32Type() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCObjectType() const
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool isObjectType() const
Determine whether this type is an object type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRealFloatingType() const
Floating point categories.
bool isWideCharType() const
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isRecordType() const
bool isObjCRetainableType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Base class for declarations which introduce a typedef-name.
Wrapper for source info for typedefs.
void setParensRange(SourceRange range)
void setTypeofLoc(SourceLocation Loc)
void setParensRange(SourceRange Range)
void setKWLoc(SourceLocation Loc)
void setUnderlyingTInfo(TypeSourceInfo *TInfo)
Wrapper of type source information for a type with no direct qualifiers.
TypeLocClass getTypeLocClass() const
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
Represents a variable declaration or definition.
void setNameLoc(SourceLocation Loc)
Represents a GCC generic vector type.
VectorKind getVectorKind() const
static DelayedDiagnostic makeForbiddenType(SourceLocation loc, unsigned diagnostic, QualType type, unsigned argument)
Retains information about a function, method, or block that is currently being parsed.
Defines the clang::TargetInfo interface.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
@ ExpectedParameterOrImplicitObjectParameter
@ ExpectedFunctionWithProtoType
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
llvm::StringRef getParameterABISpelling(ParameterABI kind)
FunctionEffectMode
Used with attributes/effects with a boolean condition, e.g. nonblocking.
LLVM_READONLY bool isAsciiIdentifierContinue(unsigned char c)
NullabilityKind
Describes the nullability of a particular type.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
@ IK_DeductionGuideName
A deduction-guide name (a template-name)
@ IK_ImplicitSelfParam
An implicit 'self' parameter.
@ IK_TemplateId
A template-id, e.g., f<int>.
@ IK_ConstructorTemplateId
A constructor named via a template-id.
@ IK_ConstructorName
A constructor name.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
@ IK_ConversionFunctionId
A conversion function name, e.g., operator int.
TypeOfKind
The kind of 'typeof' expression we're after.
@ AANT_ArgumentIntegerConstant
@ Result
The result type of a method or function.
llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)
Retrieve the spelling of the given nullability kind.
ArraySizeModifier
Capture whether this is a normal array (e.g.
@ SwiftAsyncContext
This parameter (which must have pointer type) uses the special Swift asynchronous context-pointer ABI...
@ SwiftErrorResult
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
@ Ordinary
This parameter uses ordinary ABI rules for its type.
@ SwiftIndirectResult
This parameter (which must have pointer type) is a Swift indirect result parameter.
@ SwiftContext
This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment.
bool supportsVariadicCall(CallingConv CC)
Checks whether the given calling convention supports variadic calls.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
static bool isBlockPointer(Expr *Arg)
ActionResult< Expr * > ExprResult
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Union
The "union" keyword.
@ Enum
The "enum" keyword.
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t',...
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
LangAS
Defines the address space values used by the address space qualifier of QualType.
@ FirstTargetAddressSpace
const FunctionProtoType * T
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
@ Incomplete
Template argument deduction did not deduce a value for every template parameter.
@ Success
Template argument deduction was successful.
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ Neon
is ARM Neon vector
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ NeonPoly
is ARM Neon polynomial vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
LangAS getLangASFromTargetAS(unsigned TargetAS)
@ None
The alignment was not explicit in code.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_DynamicNone
throw()
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
@ Implicit
An implicit conversion.
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
unsigned hasStatic
True if this dimension included the 'static' keyword.
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
unsigned TypeQuals
For now, sema will catch these as invalid.
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
SourceLocation getTrailingReturnTypeLoc() const
Get the trailing-return-type location for this function declarator.
SourceLocation getLParenLoc() const
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
SourceLocation getExceptionSpecLocBeg() const
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
SourceLocation getRParenLoc() const
SourceLocation getEllipsisLoc() const
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceRange getExceptionSpecRange() const
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
SourceLocation StarLoc
Location of the '*' token.
const IdentifierInfo * Ident
SourceLocation RestrictQualLoc
The location of the restrict-qualifier, if any.
SourceLocation ConstQualLoc
The location of the const-qualifier, if any.
SourceLocation VolatileQualLoc
The location of the volatile-qualifier, if any.
SourceLocation UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
SourceLocation AtomicQualLoc
The location of the _Atomic-qualifier, if any.
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
One instance of this struct is used for each type in a declarator that is parsed.
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
enum clang::DeclaratorChunk::@223 Kind
MemberPointerTypeInfo Mem
SourceLocation Loc
Loc - The place where this type was defined.
Describes whether we've seen any nullability information for the given file.
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
uint8_t PointerKind
Which kind of pointer declarator we saw.
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
Holds information about the various types of exception specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
unsigned AArch64SMEAttributes
SourceLocation EllipsisLoc
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
void setArmSMEAttribute(AArch64SMETypeAttributes Kind, bool Enable=true)
FunctionType::ExtInfo ExtInfo
TypeSourceInfo * ContainedTyInfo
Wraps an identifier and optional source location for the identifier.
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
unsigned AutoTemplateParameterDepth
If this is a generic lambda or abbreviated function template, use this as the depth of each 'auto' pa...
Describes how types, statements, expressions, and declarations should be printed.
@ Memoization
Added for Template instantiation observation.
Abstract class used to diagnose incomplete types.
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
SplitQualType getSingleStepDesugaredType() const
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
Store declaration pairs already found to be non-equivalent.
Information about a template-id annotation token.
const IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
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