36 #include "llvm/ADT/SmallPtrSet.h" 37 #include "llvm/ADT/SmallString.h" 38 #include "llvm/ADT/StringSwitch.h" 39 #include "llvm/Support/ErrorHandling.h" 41 using namespace clang;
71 bool useExpansionLoc =
true;
73 case ParsedAttr::AT_ObjCGC:
76 case ParsedAttr::AT_ObjCOwnership:
82 useExpansionLoc =
false;
92 if (useExpansionLoc && loc.
isMacroID() && II) {
93 if (II->
isStr(
"strong")) {
95 }
else if (II->
isStr(
"weak")) {
100 S.
Diag(loc, diag::warn_type_attribute_wrong_type) << name << WhichType
106 #define OBJC_POINTER_TYPE_ATTRS_CASELIST \ 107 case ParsedAttr::AT_ObjCGC: \ 108 case ParsedAttr::AT_ObjCOwnership 111 #define CALLING_CONV_ATTRS_CASELIST \ 112 case ParsedAttr::AT_CDecl: \ 113 case ParsedAttr::AT_FastCall: \ 114 case ParsedAttr::AT_StdCall: \ 115 case ParsedAttr::AT_ThisCall: \ 116 case ParsedAttr::AT_RegCall: \ 117 case ParsedAttr::AT_Pascal: \ 118 case ParsedAttr::AT_SwiftCall: \ 119 case ParsedAttr::AT_VectorCall: \ 120 case ParsedAttr::AT_AArch64VectorPcs: \ 121 case ParsedAttr::AT_MSABI: \ 122 case ParsedAttr::AT_SysVABI: \ 123 case ParsedAttr::AT_Pcs: \ 124 case ParsedAttr::AT_IntelOclBicc: \ 125 case ParsedAttr::AT_PreserveMost: \ 126 case ParsedAttr::AT_PreserveAll 129 #define FUNCTION_TYPE_ATTRS_CASELIST \ 130 case ParsedAttr::AT_NSReturnsRetained: \ 131 case ParsedAttr::AT_NoReturn: \ 132 case ParsedAttr::AT_Regparm: \ 133 case ParsedAttr::AT_AnyX86NoCallerSavedRegisters: \ 134 case ParsedAttr::AT_AnyX86NoCfCheck: \ 135 CALLING_CONV_ATTRS_CASELIST 138 #define MS_TYPE_ATTRS_CASELIST \ 139 case ParsedAttr::AT_Ptr32: \ 140 case ParsedAttr::AT_Ptr64: \ 141 case ParsedAttr::AT_SPtr: \ 142 case ParsedAttr::AT_UPtr 145 #define NULLABILITY_TYPE_ATTRS_CASELIST \ 146 case ParsedAttr::AT_TypeNonNull: \ 147 case ParsedAttr::AT_TypeNullable: \ 148 case ParsedAttr::AT_TypeNullUnspecified 153 class TypeProcessingState {
183 using TypeAttrPair = std::pair<const AttributedType*, const Attr*>;
185 bool AttrsForTypesSorted =
true;
189 llvm::DenseMap<const MacroQualifiedType *, SourceLocation> LocsForMacros;
197 : sema(sema), declarator(declarator),
199 hasSavedAttrs(
false), parsedNoDeref(
false) {}
201 Sema &getSema()
const {
209 bool isProcessingDeclSpec()
const {
213 unsigned getCurrentChunkIndex()
const {
217 void setCurrentChunkIndex(
unsigned idx) {
223 if (isProcessingDeclSpec())
224 return getMutableDeclSpec().getAttributes();
229 void saveDeclSpecAttrs() {
231 if (hasSavedAttrs)
return;
233 DeclSpec &spec = getMutableDeclSpec();
235 savedAttrs.push_back(&AL);
236 trivial &= savedAttrs.empty();
237 hasSavedAttrs =
true;
243 ignoredTypeAttrs.push_back(&attr);
249 for (
auto *
Attr : ignoredTypeAttrs)
259 AttrsForTypes.push_back({cast<AttributedType>(T.
getTypePtr()), A});
260 AttrsForTypesSorted =
false;
271 auto *NewAttrTy = cast<AttributedType>(T.
getTypePtr());
272 for (TypeAttrPair &A : AttrsForTypes) {
273 if (A.first == AttrTy)
276 AttrsForTypesSorted =
false;
283 if (!AttrsForTypesSorted) {
284 llvm::stable_sort(AttrsForTypes, llvm::less_first());
285 AttrsForTypesSorted =
true;
290 for (
auto It = std::partition_point(
291 AttrsForTypes.begin(), AttrsForTypes.end(),
292 [=](
const TypeAttrPair &A) {
return A.first < AT; });
293 It != AttrsForTypes.end() && It->first == AT; ++It) {
296 It->second =
nullptr;
301 llvm_unreachable(
"no Attr* for AttributedType*");
306 auto FoundLoc = LocsForMacros.find(MQT);
307 assert(FoundLoc != LocsForMacros.end() &&
308 "Unable to find macro expansion location for MacroQualifedType");
309 return FoundLoc->second;
314 LocsForMacros[MQT] = Loc;
317 void setParsedNoDeref(
bool parsed) { parsedNoDeref = parsed; }
319 bool didParseNoDeref()
const {
return parsedNoDeref; }
321 ~TypeProcessingState() {
324 restoreDeclSpecAttrs();
328 DeclSpec &getMutableDeclSpec()
const {
332 void restoreDeclSpecAttrs() {
333 assert(hasSavedAttrs);
335 getMutableDeclSpec().getAttributes().clearListOnly();
337 getMutableDeclSpec().getAttributes().addAtEnd(AL);
376 if (attr.
getKind() == ParsedAttr::AT_ObjCGC)
378 assert(attr.
getKind() == ParsedAttr::AT_ObjCOwnership);
393 bool onlyBlockPointers) {
399 for (; i != 0; --i) {
401 switch (fnChunk.
Kind) {
417 for (--i; i != 0; --i) {
419 switch (ptrChunk.
Kind) {
429 if (onlyBlockPointers)
438 llvm_unreachable(
"bad declarator chunk kind");
444 llvm_unreachable(
"bad declarator chunk kind");
461 Declarator &declarator = state.getDeclarator();
464 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
466 switch (chunk.
Kind) {
472 if (state.isProcessingDeclSpec() &&
473 attr.
getKind() == ParsedAttr::AT_ObjCOwnership)
476 if (!destChunk) destChunk = &chunk;
489 if (state.isProcessingDeclSpec() &&
490 attr.
getKind() == ParsedAttr::AT_ObjCOwnership) {
517 Declarator &declarator = state.getDeclarator();
521 unsigned innermost = -1U;
522 bool considerDeclSpec =
true;
525 switch (chunk.
Kind) {
539 considerDeclSpec =
false;
547 if (considerDeclSpec) {
552 state.saveDeclSpecAttrs();
561 if (innermost != -1U) {
569 state.addIgnoredTypeAttr(attr);
578 Declarator &declarator = state.getDeclarator();
582 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
584 switch (chunk.
Kind) {
610 Declarator &declarator = state.getDeclarator();
629 state.saveDeclSpecAttrs();
636 state.getDeclarator().getAttributes());
642 state, attr, state.getCurrentAttributes(), declSpecType))
647 state.addIgnoredTypeAttr(attr);
655 Declarator &declarator = state.getDeclarator();
665 state.addIgnoredTypeAttr(attr);
680 assert(!state.getDeclarator().getAttributes().empty() &&
681 "declarator has no attrs!");
689 if (attr.isCXX11Attribute())
692 switch (attr.getKind()) {
709 case ParsedAttr::AT_ObjCKindOf:
722 Declarator &declarator = state.getDeclarator();
768 None, loc, loc, declarator));
783 typedef std::pair<DeclSpec::TQ, SourceLocation> QualLoc;
788 if (!(RemoveTQs & Qual.first))
792 if (TypeQuals & Qual.first)
793 S.
Diag(Qual.second, DiagID)
798 TypeQuals &= ~Qual.first;
812 if (AL.isInvalid() || !AL.isTypeAttr())
815 diag::warn_block_literal_attributes_on_omitted_return_type)
817 ToBeRemoved.push_back(&AL);
827 diag::warn_block_literal_qualifiers_on_omitted_return_type);
837 bool failOnError =
false) {
840 if (!objcObjectType || !objcObjectType->getInterface()) {
841 S.
Diag(loc, diag::err_objc_type_args_non_class)
854 S.
Diag(loc, diag::err_objc_type_args_non_parameterized_class)
865 if (objcObjectType->isSpecialized()) {
866 S.
Diag(loc, diag::err_objc_type_args_specialized_class)
878 unsigned numTypeParams = typeParams->
size();
879 bool anyPackExpansions =
false;
880 for (
unsigned i = 0, n = typeArgs.size(); i != n; ++i) {
888 bool diagnosed =
false;
891 rangeToRemove = attr.getLocalSourceRange();
892 if (attr.getTypePtr()->getImmediateNullability()) {
893 typeArg = attr.
getTypePtr()->getModifiedType();
894 S.
Diag(attr.getBeginLoc(),
895 diag::err_objc_type_arg_explicit_nullability)
902 S.
Diag(qual.getBeginLoc(), diag::err_objc_type_arg_qualified)
911 finalTypeArgs.push_back(typeArg);
914 anyPackExpansions =
true;
918 if (!anyPackExpansions) {
919 if (i < numTypeParams) {
920 typeParam = typeParams->
begin()[i];
923 S.
Diag(loc, diag::err_objc_type_args_wrong_arity)
926 << (unsigned)typeArgs.size()
944 assert(anyPackExpansions &&
"Too many arguments?");
953 if (typeArgObjC->isObjCIdType()) {
956 if (boundObjC->isObjCIdType())
965 diag::err_objc_type_arg_does_not_match_bound)
982 assert(anyPackExpansions &&
"Too many arguments?");
993 diag::err_objc_type_arg_does_not_match_bound)
1011 diag::err_objc_type_arg_not_id_compatible)
1021 if (!anyPackExpansions && finalTypeArgs.size() != numTypeParams) {
1022 S.
Diag(loc, diag::err_objc_type_args_wrong_arity)
1023 << (typeArgs.size() < typeParams->
size())
1025 << (unsigned)finalTypeArgs.size()
1026 << (unsigned)numTypeParams;
1047 if (!Protocols.empty()) {
1053 <<
SourceRange(ProtocolLAngleLoc, ProtocolRAngleLoc);
1054 if (FailOnError) Result =
QualType();
1056 if (FailOnError && Result.
isNull())
1074 if (!TypeArgs.empty()) {
1079 if (FailOnError && Result.
isNull())
1083 if (!Protocols.empty()) {
1088 Diag(Loc, diag::err_invalid_protocol_qualifiers)
1089 <<
SourceRange(ProtocolLAngleLoc, ProtocolRAngleLoc);
1090 if (FailOnError) Result =
QualType();
1092 if (FailOnError && Result.
isNull())
1119 auto ObjCObjectTL = ObjCObjectPointerTL.getPointeeLoc()
1129 ObjCObjectTL.setProtocolLAngleLoc(lAngleLoc);
1130 ObjCObjectTL.setProtocolRAngleLoc(rAngleLoc);
1131 for (
unsigned i = 0, n = protocols.size(); i != n; ++i)
1132 ObjCObjectTL.setProtocolLoc(i, protocolLocs[i]);
1135 return CreateParsedType(Result, ResultTInfo);
1150 QualType T = GetTypeFromParser(BaseType, &BaseTypeInfo);
1160 for (
unsigned i = 0, n = TypeArgs.size(); i != n; ++i) {
1162 QualType TypeArg = GetTypeFromParser(TypeArgs[i], &TypeArgInfo);
1164 ActualTypeArgInfos.clear();
1168 assert(TypeArgInfo &&
"No type source info?");
1169 ActualTypeArgInfos.push_back(TypeArgInfo);
1175 TypeArgsLAngleLoc, ActualTypeArgInfos, TypeArgsRAngleLoc,
1179 ProtocolLocs, ProtocolRAngleLoc,
1194 ResultTL = ObjCObjectPointerTL.getPointeeLoc();
1199 if (OTPTL.getNumProtocols() > 0) {
1200 assert(OTPTL.getNumProtocols() == Protocols.size());
1201 OTPTL.setProtocolLAngleLoc(ProtocolLAngleLoc);
1202 OTPTL.setProtocolRAngleLoc(ProtocolRAngleLoc);
1203 for (
unsigned i = 0, n = Protocols.size(); i != n; ++i)
1204 OTPTL.setProtocolLoc(i, ProtocolLocs[i]);
1208 return CreateParsedType(Result, ResultTInfo);
1214 if (ObjCObjectTL.getNumTypeArgs() > 0) {
1215 assert(ObjCObjectTL.getNumTypeArgs() == ActualTypeArgInfos.size());
1217 ObjCObjectTL.setTypeArgsRAngleLoc(TypeArgsRAngleLoc);
1218 for (
unsigned i = 0, n = ActualTypeArgInfos.size(); i != n; ++i)
1219 ObjCObjectTL.setTypeArgTInfo(i, ActualTypeArgInfos[i]);
1226 if (ObjCObjectTL.getNumProtocols() > 0) {
1227 assert(ObjCObjectTL.getNumProtocols() == Protocols.size());
1228 ObjCObjectTL.setProtocolLAngleLoc(ProtocolLAngleLoc);
1229 ObjCObjectTL.setProtocolRAngleLoc(ProtocolRAngleLoc);
1230 for (
unsigned i = 0, n = Protocols.size(); i != n; ++i)
1231 ObjCObjectTL.setProtocolLoc(i, ProtocolLocs[i]);
1238 ObjCObjectTL.setHasBaseTypeAsWritten(
true);
1239 if (ObjCObjectTL.getType() == T)
1240 ObjCObjectTL.getBaseLoc().initializeFullCopy(BaseTypeInfo->
getTypeLoc());
1242 ObjCObjectTL.getBaseLoc().initialize(Context, Loc);
1245 return CreateParsedType(Result, ResultTInfo);
1248 static OpenCLAccessAttr::Spelling
1251 if (AL.getKind() == ParsedAttr::AT_OpenCLAccess)
1252 return static_cast<OpenCLAccessAttr::Spelling>(AL.getSemanticSpelling());
1253 return OpenCLAccessAttr::Keyword_read_only;
1264 TemplateId->NumArgs);
1267 for (
auto &ArgLoc : TemplateArgsInfo.
arguments())
1268 TemplateArgs.push_back(ArgLoc.getArgument());
1271 cast<ConceptDecl>(TemplateId->Template.get()
1272 .getAsTemplateDecl()),
1286 Sema &S = state.getSema();
1287 Declarator &declarator = state.getDeclarator();
1307 "Unknown TSS value");
1321 "Unknown TSS value");
1330 "Unknown TSS value");
1335 "Unknown TSS value");
1340 "Unknown TSS value");
1372 S.
Diag(DeclLoc, diag::ext_missing_declspec)
1382 S.
Diag(DeclLoc, diag::err_missing_type_specifier)
1389 }
else if ((S.
getLangOpts().OpenCLVersion >= 200 ||
1392 S.
Diag(DeclLoc, diag::err_missing_actual_pipe_type)
1396 S.
Diag(DeclLoc, diag::ext_missing_type_specifier)
1416 diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1435 diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1456 llvm_unreachable(
"Unable to specify long long as _Accum width");
1479 llvm_unreachable(
"Unable to specify long long as _Fract width");
1531 Result = Context.
IntTy;
1542 Result = Context.
IntTy;
1566 "Can't handle qualifiers on typedef names yet!");
1568 if (Result.isNull()) {
1578 assert(!Result.isNull() &&
"Didn't get a type for typeof?");
1579 if (!Result->isDependentType())
1587 assert(E &&
"Didn't get an expression for typeof?");
1590 if (Result.isNull()) {
1591 Result = Context.
IntTy;
1598 assert(E &&
"Didn't get an expression for decltype?");
1601 if (Result.isNull()) {
1602 Result = Context.
IntTy;
1609 assert(!Result.isNull() &&
"Didn't get a type for __underlying_type?");
1613 if (Result.isNull()) {
1614 Result = Context.
IntTy;
1649 assert(!Result.isNull() &&
"Didn't get a type for _Atomic?");
1651 if (Result.isNull()) {
1652 Result = Context.
IntTy;
1657 #define GENERIC_IMAGE_TYPE(ImgType, Id) \ 1658 case DeclSpec::TST_##ImgType##_t: \ 1659 switch (getImageAccess(DS.getAttributes())) { \ 1660 case OpenCLAccessAttr::Keyword_write_only: \ 1661 Result = Context.Id##WOTy; \ 1663 case OpenCLAccessAttr::Keyword_read_write: \ 1664 Result = Context.Id##RWTy; \ 1666 case OpenCLAccessAttr::Keyword_read_only: \ 1667 Result = Context.Id##ROTy; \ 1669 case OpenCLAccessAttr::SpellingNotCalculated: \ 1670 llvm_unreachable("Spelling not yet calculated"); \ 1673 #include "clang/Basic/OpenCLImageTypes.def" 1676 Result = Context.
IntTy;
1683 declarator.setInvalidType(
true);
1689 if (DS.isTypeSpecSat() && !IsFixedPointType)
1690 S.
Diag(DS.getTypeSpecSatLoc(), diag::err_invalid_saturation_spec)
1691 << DS.getSpecifierName(DS.getTypeSpecType(),
1697 S.
Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex);
1699 }
else if (DS.isTypeAltiVecVector()) {
1701 assert(typeSize > 0 &&
"type size for vector must be greater than 0 bits");
1703 if (DS.isTypeAltiVecPixel())
1705 else if (DS.isTypeAltiVecBool())
1712 S.
Diag(DS.getTypeSpecComplexLoc(), diag::err_imaginary_not_supported);
1723 if (!DS.isTypeSpecPipe())
1727 if (
unsigned TypeQuals = DS.getTypeQualifiers()) {
1736 if (TypeQuals &&
Result->isFunctionType()) {
1740 ? diag::warn_typecheck_function_qualifiers_ignored
1741 : diag::warn_typecheck_function_qualifiers_unspecified);
1754 if (TypeQuals &&
Result->isReferenceType()) {
1756 S, DS, TypeQuals,
Result,
1758 diag::warn_typecheck_reference_qualifiers);
1765 && TypeQuals &
Result.getCVRQualifiers()) {
1767 S.
Diag(DS.getConstSpecLoc(), diag::ext_duplicate_declspec)
1772 S.
Diag(DS.getVolatileSpecLoc(), diag::ext_duplicate_declspec)
1784 declarator.setInvalidType(
true);
1789 assert(!
Result.isNull() &&
"This function should not return a null type");
1814 unsigned DiagID = 0;
1830 DiagID = diag::err_typecheck_invalid_restrict_invalid_pointee;
1834 DiagID = diag::err_typecheck_invalid_restrict_not_pointer;
1848 unsigned CVRAU,
const DeclSpec *DS) {
1883 return BuildQualifiedType(T, Loc, Split.
Quals);
1888 return BuildQualifiedType(T, Loc, Q, DS);
1935 diag::err_arc_indirect_no_ownership, type, isReference));
1937 S.
Diag(loc, diag::err_arc_indirect_no_ownership) << type << isReference;
1941 assert(implicitLifetime &&
"didn't infer any lifetime!");
1995 S.
Diag(Loc, diag::err_compound_qualified_function_type)
2007 Diag(Loc, diag::err_qualified_function_typeid)
2042 Diag(Loc, diag::err_illegal_decl_pointer_to_reference)
2048 Diag(Loc, diag::err_opencl_function_pointer);
2058 if (getLangOpts().ObjCAutoRefCount)
2061 if (getLangOpts().OpenCL)
2085 "Unresolved overloaded function type");
2113 Diag(Loc, diag::err_reference_to_void);
2121 if (getLangOpts().ObjCAutoRefCount)
2124 if (getLangOpts().
OpenCL)
2170 S.
Diag(Loc, diag::ext_vla_folded_to_constant) << SR;
2195 Expr *ArraySize,
unsigned Quals,
2212 Diag(Loc, diag::err_illegal_decl_array_of_references)
2218 Diag(Loc, diag::err_illegal_decl_array_incomplete_type) << T;
2222 if (RequireNonAbstractType(Brackets.
getBegin(), T,
2223 diag::err_array_of_abstract_type))
2230 if (!MPTy->getClass()->isDependentType())
2231 (
void)isCompleteType(Loc, T);
2236 if (RequireCompleteType(Loc, T,
2237 diag::err_illegal_decl_array_incomplete_type))
2242 Diag(Loc, diag::err_illegal_decl_array_of_functions)
2250 if (EltTy->getDecl()->hasFlexibleArrayMember())
2251 Diag(Loc, diag::ext_flexible_array_in_array) << T;
2253 Diag(Loc, diag::err_objc_array_of_interfaces) << T;
2261 ArraySize = Result.
get();
2265 if (ArraySize && !ArraySize->
isRValue()) {
2270 ArraySize = Result.
get();
2296 if (getLangOpts().CPlusPlus11 &&
2310 if (ConstVal.isSigned() && ConstVal.isNegative()) {
2315 Diag(ArraySize->
getBeginLoc(), diag::err_typecheck_negative_array_size)
2319 if (ConstVal == 0) {
2323 ? diag::err_typecheck_zero_array_size
2324 : diag::ext_typecheck_zero_array_size)
2329 diag::warn_typecheck_zero_static_array_size)
2336 unsigned ActiveSizeBits
2350 Diag(Loc, diag::err_opencl_vla);
2356 targetDiag(Loc, (getLangOpts().
CUDA && getLangOpts().CUDAIsDevice)
2357 ? diag::err_cuda_vla
2358 : diag::err_vla_unsupported)
2359 << ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice)
2360 ? CurrentCUDATarget()
2361 : CFT_InvalidTarget);
2365 if (!getLangOpts().C99) {
2368 if (isSFINAEContext()) {
2369 Diag(Loc, diag::err_vla_in_sfinae);
2374 Diag(Loc, diag::ext_vla);
2377 getLangOpts().
CPlusPlus? diag::err_c99_array_usage_cxx
2378 : diag::ext_c99_array_usage) << ASM;
2383 Diag(Loc, diag::warn_vla_used);
2389 if (getLangOpts().
OpenCL) {
2393 Diag(Loc, diag::err_opencl_invalid_type_array) << ArrType;
2408 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << CurType;
2418 Diag(AttrLoc, diag::err_attribute_argument_type)
2428 unsigned VectorSize =
static_cast<unsigned>(VecSize.getZExtValue() * 8);
2429 unsigned TypeSize =
static_cast<unsigned>(Context.
getTypeSize(CurType));
2431 if (VectorSize == 0) {
2437 if (VectorSize % TypeSize) {
2438 Diag(AttrLoc, diag::err_attribute_invalid_size)
2444 Diag(AttrLoc, diag::err_attribute_size_too_large)
2449 return Context.
getVectorType(CurType, VectorSize / TypeSize,
2468 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T;
2475 Diag(AttrLoc, diag::err_attribute_argument_type)
2483 unsigned vectorSize =
static_cast<unsigned>(vecSize.getZExtValue());
2485 if (vectorSize == 0) {
2486 Diag(AttrLoc, diag::err_attribute_zero_size)
2492 Diag(AttrLoc, diag::err_attribute_size_too_large)
2505 Diag(Loc, diag::err_func_returning_array_function)
2511 if (T->
isHalfType() && !getLangOpts().HalfArgsAndReturns) {
2512 Diag(Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 1 <<
2520 Diag(Loc, diag::err_object_cannot_be_passed_returned_by_value)
2527 checkNonTrivialCUnion(T, Loc, NTCUC_FunctionReturn,
2528 NTCUK_Destruct|NTCUK_Copy);
2533 Diag(Loc, diag::warn_deprecated_volatile_return) << T;
2546 bool hasCheckedSwiftCall =
false;
2547 auto checkForSwiftCC = [&](
unsigned paramIndex) {
2549 if (hasCheckedSwiftCall)
return;
2550 hasCheckedSwiftCall =
true;
2552 S.
Diag(getParamLoc(paramIndex), diag::err_swift_param_attr_not_swiftcall)
2556 for (
size_t paramIndex = 0, numParams = paramTypes.size();
2557 paramIndex != numParams; ++paramIndex) {
2566 checkForSwiftCC(paramIndex);
2567 if (paramIndex != 0 &&
2570 S.
Diag(getParamLoc(paramIndex),
2571 diag::err_swift_indirect_result_not_first);
2576 checkForSwiftCC(paramIndex);
2581 checkForSwiftCC(paramIndex);
2582 if (paramIndex == 0 ||
2585 S.
Diag(getParamLoc(paramIndex),
2586 diag::err_swift_error_result_not_after_swift_context);
2590 llvm_unreachable(
"bad ABI kind");
2598 bool Invalid =
false;
2600 Invalid |= CheckFunctionReturnType(T, Loc);
2602 for (
unsigned Idx = 0, Cnt = ParamTypes.size(); Idx < Cnt; ++Idx) {
2606 Diag(Loc, diag::err_param_with_void_type);
2608 }
else if (ParamType->
isHalfType() && !getLangOpts().HalfArgsAndReturns) {
2610 Diag(Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 0 <<
2618 Diag(Loc, diag::warn_deprecated_volatile_param) << ParamType;
2620 ParamTypes[Idx] = ParamType;
2625 [=](
unsigned i) {
return Loc; });
2630 checkNSReturnsRetainedReturnType(Loc, T);
2653 if (CheckDistantExceptionSpec(T)) {
2654 Diag(Loc, diag::err_distant_exception_spec);
2661 Diag(Loc, diag::err_illegal_decl_mempointer_to_reference)
2667 Diag(Loc, diag::err_illegal_decl_mempointer_to_void)
2673 Diag(Loc, diag::err_mempointer_in_nonclass_type) << Class;
2683 adjustMemberFunctionCC(T,
false, IsCtorOrDtor, Loc);
2703 Diag(Loc, diag::err_nonfunction_block_type);
2710 if (getLangOpts().
OpenCL)
2719 if (TInfo) *TInfo =
nullptr;
2724 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
2725 QT = LIT->getType();
2726 DI = LIT->getTypeSourceInfo();
2729 if (TInfo) *TInfo = DI;
2735 unsigned chunkIndex);
2742 Sema &S = state.getSema();
2743 Declarator &declarator = state.getDeclarator();
2749 unsigned outermostPointerIndex = 0;
2751 unsigned numPointers = 0;
2753 unsigned chunkIndex = i;
2755 switch (chunk.
Kind) {
2765 outermostPointerIndex = chunkIndex;
2773 if (numPointers != 1)
return;
2775 outermostPointerIndex = chunkIndex;
2776 isBlockPointer =
true;
2793 if (numPointers == 1) {
2811 }
else if (numPointers == 2) {
2824 if (AL.getKind() == ParsedAttr::AT_ObjCOwnership)
2828 outermostPointerIndex);
2850 }
const QualKinds[5] = {
2859 unsigned NumQuals = 0;
2864 for (
auto &E : QualKinds) {
2865 if (Quals & E.Mask) {
2866 if (!QualStr.empty()) QualStr +=
' ';
2874 getSourceManager().isBeforeInTranslationUnit(QualLoc, Loc))
2883 << QualStr << NumQuals << FixIts[0] << FixIts[1] << FixIts[2] << FixIts[3];
2889 unsigned FunctionChunkIndex) {
2899 for (
unsigned OuterChunkIndex = FunctionChunkIndex + 1,
2901 OuterChunkIndex !=
End; ++OuterChunkIndex) {
2903 switch (OuterChunk.
Kind) {
2910 diag::warn_qual_return_type,
2936 llvm_unreachable(
"unknown declarator chunk kind");
2963 for (
unsigned Idx = 0; Idx < AutoLoc.
getNumArgs(); ++Idx)
2975 Sema &S = state.getSema();
2979 const unsigned AutoParameterPosition = Info.
TemplateParams.size();
2993 TemplateParameterDepth, AutoParameterPosition,
3030 return state.ReplaceAutoType(
3040 Sema &SemaRef = state.getSema();
3043 ReturnTypeInfo =
nullptr;
3046 TagDecl *OwnedTagDecl =
nullptr;
3097 bool IsCXXAutoType =
3099 bool IsDeducedReturnType =
false;
3118 if (!SemaRef.
getLangOpts().CPlusPlus2a || !Auto ||
3134 if (!SemaRef.
getLangOpts().CPlusPlus14 || !Auto ||
3140 assert(Info &&
"No LambdaScopeInfo on the stack!");
3150 switch (cast<TagDecl>(SemaRef.
CurContext)->getTagKind()) {
3151 case TTK_Enum: llvm_unreachable(
"unhandled tag kind");
3153 case TTK_Union: Error = Cxx ? 3 : 4;
break;
3166 if (isa<DeducedTemplateSpecializationType>(Deduced))
3177 if (isa<DeducedTemplateSpecializationType>(Deduced) &&
3191 if (!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
3193 IsDeducedReturnType =
true;
3196 if (!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
3198 IsDeducedReturnType =
true;
3201 if (isa<DeducedTemplateSpecializationType>(Deduced))
3219 if (!IsCXXAutoType && !isa<DeducedTemplateSpecializationType>(Deduced))
3233 (!SemaRef.
getLangOpts().CPlusPlus11 || !IsCXXAutoType))
3236 bool HaveTrailing =
false;
3244 if (SemaRef.
getLangOpts().CPlusPlus11 && IsCXXAutoType &&
3246 HaveTrailing =
true;
3263 assert(isa<DeducedTemplateSpecializationType>(Deduced) &&
3264 "unknown auto type");
3271 SemaRef.
Diag(AutoRange.
getBegin(), diag::err_auto_not_allowed)
3273 <<
QualType(Deduced, 0) << AutoRange;
3274 if (
auto *TD = TN.getAsTemplateDecl())
3275 SemaRef.
Diag(TD->getLocation(), diag::note_template_decl_here);
3279 }
else if (Auto && !HaveTrailing &&
3286 ? diag::warn_cxx11_compat_generic_lambda
3287 : IsDeducedReturnType
3288 ? diag::warn_cxx11_compat_deduced_return_type
3289 : diag::warn_cxx98_compat_auto_type_specifier)
3298 unsigned DiagID = 0;
3304 llvm_unreachable(
"parser should not have allowed this");
3320 DiagID = diag::err_type_defined_in_alias_template;
3331 DiagID = diag::err_type_defined_in_type_specifier;
3341 DiagID = diag::err_type_defined_in_param_type;
3347 DiagID = diag::err_type_defined_in_condition;
3358 assert(!T.
isNull() &&
"This function should not return a null type");
3367 assert(FTI.
isAmbiguous &&
"no direct-initializer / function ambiguity");
3398 FTI.
NumParams ? diag::warn_parens_disambiguated_as_function_declaration
3399 : diag::warn_empty_parens_are_function_decl)
3410 if (
Comma.getFileID() != Name.getFileID() ||
3411 Comma.getSpellingLineNumber() != Name.getSpellingLineNumber()) {
3418 Result.suppressDiagnostics();
3431 S.
Diag(B, diag::note_additional_parens_for_variable_declaration)
3446 S.
Diag(DeclType.
Loc, diag::note_empty_parens_default_ctor)
3451 if (Init.empty() && S.
LangOpts.CPlusPlus11)
3454 S.
Diag(DeclType.
Loc, diag::note_empty_parens_zero_initialize)
3465 "do not have redundant top-level parentheses");
3474 bool CouldBeTemporaryObject =
3481 bool StartsWithDeclaratorId =
true;
3489 StartsWithDeclaratorId =
false;
3494 CouldBeTemporaryObject =
false;
3502 CouldBeTemporaryObject =
false;
3503 StartsWithDeclaratorId =
false;
3513 CouldBeTemporaryObject =
false;
3520 CouldBeTemporaryObject =
false;
3521 StartsWithDeclaratorId =
false;
3531 if (CouldBeTemporaryObject) {
3535 CouldBeTemporaryObject =
false;
3536 Result.suppressDiagnostics();
3541 if (!CouldBeTemporaryObject) {
3554 S.
Diag(Paren.
Loc, diag::warn_redundant_parens_around_declarator)
3560 S.
Diag(Paren.
Loc, diag::warn_parens_disambiguated_as_variable_declaration)
3563 if (!RD || !RD->hasDefinition() || RD->hasNonTrivialDestructor())
3564 S.
Diag(Paren.
Loc, diag::note_raii_guard_add_name)
3569 S.
Diag(D.
getBeginLoc(), diag::note_function_style_cast_add_parentheses)
3572 S.
Diag(Paren.
Loc, diag::note_remove_parens_for_variable_declaration)
3588 switch (AL.getKind()) {
3606 bool IsCXXInstanceMethod =
false;
3612 unsigned I = ChunkIndex;
3613 bool FoundNonParen =
false;
3614 while (I && !FoundNonParen) {
3617 FoundNonParen =
true;
3620 if (FoundNonParen) {
3623 IsCXXInstanceMethod =
3628 IsCXXInstanceMethod =
true;
3635 IsCXXInstanceMethod =
3643 IsCXXInstanceMethod);
3651 if (AL.getKind() == ParsedAttr::AT_OpenCLKernel) {
3673 switch (nullability) {
3675 if (!Ident__Nonnull)
3676 Ident__Nonnull = PP.getIdentifierInfo(
"_Nonnull");
3677 return Ident__Nonnull;
3680 if (!Ident__Nullable)
3681 Ident__Nullable = PP.getIdentifierInfo(
"_Nullable");
3682 return Ident__Nullable;
3685 if (!Ident__Null_unspecified)
3686 Ident__Null_unspecified = PP.getIdentifierInfo(
"_Null_unspecified");
3687 return Ident__Null_unspecified;
3689 llvm_unreachable(
"Unknown nullability kind.");
3695 Ident_NSError = PP.getIdentifierInfo(
"NSError");
3697 return Ident_NSError;
3704 if (AL.getKind() == ParsedAttr::AT_TypeNonNull ||
3705 AL.getKind() == ParsedAttr::AT_TypeNullable ||
3706 AL.getKind() == ParsedAttr::AT_TypeNullUnspecified)
3723 MaybePointerToCFRef,
3727 NSErrorPointerPointer,
3750 unsigned numNormalPointers = 0;
3754 return PointerDeclaratorKind::NonPointer;
3759 switch (chunk.
Kind) {
3761 if (numNormalPointers == 0)
3762 wrappingKind = PointerWrappingDeclaratorKind::Array;
3771 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3772 : PointerDeclaratorKind::SingleLevelPointer;
3778 if (numNormalPointers == 0)
3779 wrappingKind = PointerWrappingDeclaratorKind::Reference;
3783 ++numNormalPointers;
3784 if (numNormalPointers > 2)
3785 return PointerDeclaratorKind::MultiLevelPointer;
3791 unsigned numTypeSpecifierPointers = 0;
3795 ++numNormalPointers;
3797 if (numNormalPointers > 2)
3798 return PointerDeclaratorKind::MultiLevelPointer;
3801 ++numTypeSpecifierPointers;
3807 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3808 : PointerDeclaratorKind::SingleLevelPointer;
3813 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3814 : PointerDeclaratorKind::SingleLevelPointer;
3819 ++numNormalPointers;
3820 ++numTypeSpecifierPointers;
3823 if (
auto objcClassDecl = objcObjectPtr->getInterfaceDecl()) {
3825 numNormalPointers == 2 && numTypeSpecifierPointers < 2) {
3826 return PointerDeclaratorKind::NSErrorPointerPointer;
3835 if (objcClass->getInterface()->getIdentifier() == S.
getNSErrorIdent()) {
3836 if (numNormalPointers == 2 && numTypeSpecifierPointers < 2)
3837 return PointerDeclaratorKind::NSErrorPointerPointer;
3844 if (numNormalPointers == 0)
3845 return PointerDeclaratorKind::NonPointer;
3850 bool isCFError =
false;
3861 if (
auto bridgeAttr = recordDecl->
getAttr<ObjCBridgeAttr>())
3862 bridgedType = bridgeAttr->getBridgedType();
3863 else if (
auto bridgeAttr =
3864 recordDecl->
getAttr<ObjCBridgeMutableAttr>())
3865 bridgedType = bridgeAttr->getBridgedType();
3875 if (isCFError && numNormalPointers == 2 && numTypeSpecifierPointers < 2) {
3876 return PointerDeclaratorKind::CFErrorRefPointer;
3884 switch (numNormalPointers) {
3886 return PointerDeclaratorKind::NonPointer;
3889 return PointerDeclaratorKind::SingleLevelPointer;
3892 return PointerDeclaratorKind::MaybePointerToCFRef;
3895 return PointerDeclaratorKind::MultiLevelPointer;
3904 if (ctx->isFunctionOrMethod())
3907 if (ctx->isFileContext())
3918 bool invalid =
false;
3920 if (invalid || !sloc.
isFile())
3946 if (!FixItLoc.
isValid() || FixItLoc == PointerLoc)
3955 InsertionTextBuf +=
" ";
3956 StringRef InsertionText = InsertionTextBuf.str();
3959 InsertionText = InsertionText.drop_back();
3960 }
else if (NextChar[-1] ==
'[') {
3961 if (NextChar[0] ==
']')
3962 InsertionText = InsertionText.drop_back().drop_front();
3964 InsertionText = InsertionText.drop_front();
3967 InsertionText = InsertionText.drop_back().drop_front();
3979 if (PointerKind == SimplePointerKind::Array) {
3980 S.
Diag(PointerLoc, diag::warn_nullability_missing_array);
3982 S.
Diag(PointerLoc, diag::warn_nullability_missing)
3983 <<
static_cast<unsigned>(PointerKind);
3986 auto FixItLoc = PointerEndLoc.
isValid() ? PointerEndLoc : PointerLoc;
3987 if (FixItLoc.isMacroID())
3991 auto Diag = S.
Diag(FixItLoc, diag::note_nullability_fix_it);
3993 Diag << static_cast<unsigned>(PointerKind);
4022 if (pointerKind == SimplePointerKind::Array)
4023 diagKind = diag::warn_nullability_missing_array;
4025 diagKind = diag::warn_nullability_missing;
4031 fileNullability.
PointerKind =
static_cast<unsigned>(pointerKind);
4078 unsigned i = endIndex;
4106 template<
typename AttrT>
4109 return ::new (Ctx) AttrT(Ctx, AL);
4116 return createSimpleAttr<TypeNonNullAttr>(Ctx, Attr);
4119 return createSimpleAttr<TypeNullableAttr>(Ctx, Attr);
4122 return createSimpleAttr<TypeNullUnspecifiedAttr>(Ctx, Attr);
4124 llvm_unreachable(
"unknown NullabilityKind");
4135 if (ASOld != ASNew) {
4136 S.
Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers);
4141 diag::warn_attribute_address_multiple_identical_qualifiers);
4153 Sema &S = state.getSema();
4163 bool IsTypedefName =
4179 bool IsClassTemplateDeduction = isa<DeducedTemplateSpecializationType>(DT);
4182 unsigned Index = E - I - 1;
4184 unsigned DiagId = IsClassTemplateDeduction
4185 ? diag::err_deduced_class_template_compound_type
4186 : diag::err_decltype_auto_compound_type;
4187 unsigned DiagKind = 0;
4188 switch (DeclChunk.
Kind) {
4191 if (IsClassTemplateDeduction) {
4197 if (IsClassTemplateDeduction) {
4205 DiagId = diag::err_decltype_auto_function_declarator_not_declaration;
4223 S.
Diag(DeclChunk.
Loc, DiagId) << DiagKind;
4232 bool inferNullabilityCS =
false;
4233 bool inferNullabilityInnerOnly =
false;
4234 bool inferNullabilityInnerOnlyComplete =
false;
4237 bool inAssumeNonNullRegion =
false;
4239 if (assumeNonNullLoc.
isValid()) {
4240 inAssumeNonNullRegion =
true;
4254 } complainAboutMissingNullability = CAMN_No;
4255 unsigned NumPointersRemaining = 0;
4258 if (IsTypedefName) {
4262 complainAboutMissingNullability = CAMN_InnerPointers;
4267 ++NumPointersRemaining;
4272 switch (chunk.
Kind) {
4280 ++NumPointersRemaining;
4288 ++NumPointersRemaining;
4294 switch (
auto context = state.getDeclarator().getContext()) {
4300 isFunctionOrMethod =
true;
4305 complainAboutMissingNullability = CAMN_No;
4310 if (state.getDeclarator().isObjCWeakProperty() && inAssumeNonNullRegion) {
4319 complainAboutMissingNullability = CAMN_Yes;
4324 case PointerDeclaratorKind::NonPointer:
4325 case PointerDeclaratorKind::MultiLevelPointer:
4329 case PointerDeclaratorKind::SingleLevelPointer:
4331 if (inAssumeNonNullRegion) {
4332 complainAboutInferringWithinChunk = wrappingKind;
4334 inferNullabilityCS =
4340 case PointerDeclaratorKind::CFErrorRefPointer:
4341 case PointerDeclaratorKind::NSErrorPointerPointer:
4344 if (isFunctionOrMethod && inAssumeNonNullRegion)
4348 case PointerDeclaratorKind::MaybePointerToCFRef:
4349 if (isFunctionOrMethod) {
4353 auto hasCFReturnsAttr =
4355 return AttrList.hasAttribute(ParsedAttr::AT_CFReturnsRetained) ||
4356 AttrList.hasAttribute(ParsedAttr::AT_CFReturnsNotRetained);
4360 hasCFReturnsAttr(InnermostChunk->getAttrs()) ||
4363 inferNullabilityInnerOnly =
true;
4373 complainAboutMissingNullability = CAMN_Yes;
4400 auto isVaList = [&S](
QualType T) ->
bool {
4406 if (typedefTy->getDecl() == vaListTypedef)
4408 if (
auto *
name = typedefTy->getDecl()->getIdentifier())
4409 if (
name->isStr(
"va_list"))
4411 typedefTy = typedefTy->desugar()->getAs<
TypedefType>();
4412 }
while (typedefTy);
4418 auto inferPointerNullability =
4423 if (NumPointersRemaining > 0)
4424 --NumPointersRemaining;
4431 if (inferNullability && !inferNullabilityInnerOnlyComplete) {
4439 attrs.addAtEnd(nullabilityAttr);
4441 if (inferNullabilityCS) {
4442 state.getDeclarator().getMutableDeclSpec().getObjCQualifiers()
4446 if (pointerLoc.isValid() &&
4447 complainAboutInferringWithinChunk !=
4450 S.
Diag(pointerLoc, diag::warn_nullability_inferred_on_nested_type);
4451 Diag << static_cast<int>(complainAboutInferringWithinChunk);
4455 if (inferNullabilityInnerOnly)
4456 inferNullabilityInnerOnlyComplete =
true;
4457 return nullabilityAttr;
4462 switch (complainAboutMissingNullability) {
4466 case CAMN_InnerPointers:
4467 if (NumPointersRemaining == 0)
4484 if (NumPointersRemaining > 0)
4485 --NumPointersRemaining;
4489 pointerKind = SimplePointerKind::BlockPointer;
4491 pointerKind = SimplePointerKind::MemberPointer;
4493 if (
auto *attr = inferPointerNullability(
4498 T = state.getAttributedType(
4504 if (complainAboutMissingNullability == CAMN_Yes &&
4513 bool ExpectNoDerefChunk =
4514 state.getCurrentAttributes().hasAttribute(ParsedAttr::AT_NoDeref);
4520 unsigned chunkIndex = e - i - 1;
4521 state.setCurrentChunkIndex(chunkIndex);
4524 switch (DeclType.
Kind) {
4532 if (!LangOpts.Blocks)
4533 S.
Diag(DeclType.
Loc, diag::err_blocks_disable) << LangOpts.OpenCL;
4536 inferPointerNullability(SimplePointerKind::BlockPointer, DeclType.
Loc,
4538 state.getDeclarator().getAttributePool());
4544 if (LangOpts.OpenCL)
4559 inferPointerNullability(SimplePointerKind::Pointer, DeclType.
Loc,
4561 state.getDeclarator().getAttributePool());
4573 if (LangOpts.OpenCL) {
4574 if (T->isImageType() || T->isSamplerT() || T->isPipeType() ||
4575 T->isBlockPointerType()) {
4620 S.
Diag(DeclType.
Loc, diag::err_array_star_outside_prototype);
4631 S.
Diag(DeclType.
Loc, diag::err_array_static_outside_prototype) <<
4643 S.
Diag(DeclType.
Loc, diag::err_array_static_not_outermost) <<
4658 S.
Diag(DeclType.
Loc, diag::err_illegal_decl_array_of_auto)
4666 if (complainAboutMissingNullability == CAMN_Yes &&
4683 IsQualifiedFunction =
4696 ? diag::err_auto_missing_trailing_return
4697 : diag::err_deduced_return_type);
4702 diag::warn_cxx11_compat_deduced_return_type);
4706 if (isa<ParenType>(T)) {
4714 diag::err_deduction_guide_with_complex_decl)
4719 (T.hasQualifiers() || !isa<AutoType>(T) ||
4720 cast<AutoType>(T)->getKeyword() !=
4722 cast<AutoType>(T)->isConstrained())) {
4724 diag::err_trailing_return_without_auto)
4747 if (!D.
isInvalidType() && (T->isArrayType() || T->isFunctionType()) &&
4750 unsigned diagID = diag::err_func_returning_array_function;
4753 if (chunkIndex == 0 &&
4755 diagID = diag::err_block_returning_array_function;
4756 S.
Diag(DeclType.
Loc, diagID) << T->isFunctionType() << T;
4763 if (T->isHalfType()) {
4772 diag::err_parameters_retval_cannot_have_fp16_type) << 1;
4777 if (LangOpts.OpenCL) {
4780 if (T->isBlockPointerType() || T->isImageType() || T->isSamplerT() ||
4792 (LangOpts.OpenCLCPlusPlus || LangOpts.OpenCLVersion >= 120)) ||
4801 if (T->isObjCObjectType()) {
4810 S.
Diag(DiagLoc, diag::err_object_cannot_be_passed_returned_by_value)
4828 if ((T.getCVRQualifiers() || T->isAtomicType()) &&
4830 (T->isDependentType() || T->isRecordType()))) {
4831 if (T->isVoidType() && !S.
getLangOpts().CPlusPlus &&
4836 S.
Diag(DeclType.
Loc, diag::err_func_returning_qualified_void) << T;
4842 if (T.isVolatileQualified() && S.
getLangOpts().CPlusPlus2a)
4843 S.
Diag(DeclType.
Loc, diag::warn_deprecated_volatile_return) << T;
4849 if (T.getQualifiers().hasObjCLifetime()) {
4854 if (AL.getKind() == ParsedAttr::AT_ObjCOwnership) {
4855 AttrLoc = AL.getLoc();
4862 if (AL.getKind() == ParsedAttr::AT_ObjCOwnership) {
4863 AttrLoc = AL.getLoc();
4877 S.
Diag(AttrLoc, diag::warn_arc_lifetime_result_type)
4878 << T.getQualifiers().getObjCLifetime();
4894 diag::err_exception_spec_in_typedef)
4907 && !LangOpts.OpenCL) {
4922 diag::err_ident_list_in_fn_declaration);
4948 bool HasAnyInterestingExtParameterInfos =
false;
4950 for (
unsigned i = 0, e = FTI.
NumParams; i != e; ++i) {
4953 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
4958 if (ParamTy->isVoidType()) {
4963 S.
Diag(DeclType.
Loc, diag::err_void_only_param);
4964 ParamTy = Context.
IntTy;
4969 ParamTy = Context.
IntTy;
4973 if (ParamTy.hasQualifiers())
4974 S.
Diag(DeclType.
Loc, diag::err_void_param_qualified);
4979 }
else if (ParamTy->isHalfType()) {
4985 diag::err_opencl_half_param) << ParamTy;
4991 diag::err_parameters_retval_cannot_have_fp16_type) << 0;
4995 if (ParamTy->isPromotableIntegerType()) {
4999 if (BTy->getKind() == BuiltinType::Float) {
5006 if (LangOpts.ObjCAutoRefCount && Param->
hasAttr<NSConsumedAttr>()) {
5007 ExtParameterInfos[i] = ExtParameterInfos[i].withIsConsumed(
true);
5008 HasAnyInterestingExtParameterInfos =
true;
5012 ExtParameterInfos[i] =
5013 ExtParameterInfos[i].withABI(attr->getABI());
5014 HasAnyInterestingExtParameterInfos =
true;
5017 if (Param->
hasAttr<PassObjectSizeAttr>()) {
5018 ExtParameterInfos[i] = ExtParameterInfos[i].withHasPassObjectSize();
5019 HasAnyInterestingExtParameterInfos =
true;
5022 if (Param->
hasAttr<NoEscapeAttr>()) {
5023 ExtParameterInfos[i] = ExtParameterInfos[i].withIsNoEscape(
true);
5024 HasAnyInterestingExtParameterInfos =
true;
5027 ParamTys.push_back(ParamTy);
5030 if (HasAnyInterestingExtParameterInfos) {
5039 Expr *NoexceptExpr =
nullptr;
5045 DynamicExceptions.reserve(N);
5046 DynamicExceptionRanges.reserve(N);
5047 for (
unsigned I = 0; I != N; ++I) {
5058 DynamicExceptionRanges,
5065 auto IsClassMember = [&]() {
5066 return (!state.getDeclarator().getCXXScopeSpec().isEmpty() &&
5067 state.getDeclarator()
5071 state.getDeclarator().getContext() ==
5073 state.getDeclarator().getContext() ==
5077 if (state.getSema().getLangOpts().OpenCLCPlusPlus && IsClassMember()) {
5083 LangAS ASIdxNew = attr.asOpenCLLangAS();
5107 inferPointerNullability(SimplePointerKind::MemberPointer, DeclType.
Loc,
5109 state.getDeclarator().getAttributePool());
5128 llvm_unreachable(
"Nested-name-specifier must name a type");
5138 if (NNSPrefix && isa<TemplateSpecializationType>(NNS->
getAsType()))
5144 diag::err_illegal_decl_mempointer_in_nonclass)
5180 S.
Diag(DeclType.
Loc, diag::warn_noderef_on_non_pointer_or_array);
5182 ExpectNoDerefChunk = state.didParseNoDeref();
5186 if (ExpectNoDerefChunk)
5187 S.
Diag(state.getDeclarator().getBeginLoc(),
5188 diag::warn_noderef_on_non_pointer_or_array);
5199 bool IsBlock =
false;
5201 switch (DeclType.Kind) {
5211 S.
Diag(DeclType.Loc, diag::warn_strict_prototypes)
5223 assert(!T.
isNull() &&
"T must not be null after this point");
5227 assert(FnTy &&
"Why oh why is there not a FunctionProtoType here?");
5237 enum { NonMember, Member, DeductionGuide }
Kind = NonMember;
5239 Kind = DeductionGuide;
5267 if (IsQualifiedFunction &&
5289 if (!RemovalLocs.empty()) {
5290 llvm::sort(RemovalLocs,
5292 RemovalRange =
SourceRange(RemovalLocs.front(), RemovalLocs.back());
5293 Loc = RemovalLocs.front();
5297 S.
Diag(Loc, diag::err_invalid_qualified_function_type)
5322 state.diagnoseIgnoredTypeAttrs(T);
5361 diag::err_function_parameter_pack_without_parameter_packs)
5381 LangOpts.CPlusPlus11
5382 ? diag::warn_cxx98_compat_variadic_templates
5383 : diag::ext_variadic_templates);
5414 diag::err_ellipsis_in_declarator_not_parameter);
5420 assert(!T.
isNull() &&
"T must not be null at the end of this function");
5436 TypeProcessingState
state(*
this, D);
5459 unsigned chunkIndex) {
5460 Sema &S = state.getSema();
5468 const char *attrStr =
nullptr;
5469 switch (ownership) {
5497 Sema &S = state.getSema();
5501 bool hasIndirection =
false;
5504 switch (chunk.
Kind) {
5513 hasIndirection =
true;
5546 TypeProcessingState
state(*
this, D);
5551 if (getLangOpts().
ObjC) {
5561 TypeProcessingState &State) {
5566 class TypeSpecLocFiller :
public TypeLocVisitor<TypeSpecLocFiller> {
5569 TypeProcessingState &
State;
5573 TypeSpecLocFiller(
Sema &S,
ASTContext &Context, TypeProcessingState &State,
5575 : SemaRef(S), Context(Context),
State(State), DS(DS) {}
5584 State.getExpansionLocForMacroQualifiedType(TL.
getTypePtr()));
5694 void VisitDependentTemplateSpecializationTypeLoc(
5728 for (
unsigned I = 0; I < TemplateId->
NumArgs; ++I)
5761 void VisitTypeLoc(
TypeLoc TL) {
5767 class DeclaratorLocFiller :
public TypeLocVisitor<DeclaratorLocFiller> {
5769 TypeProcessingState &
State;
5773 DeclaratorLocFiller(
ASTContext &Context, TypeProcessingState &State,
5775 : Context(Context),
State(State), Chunk(Chunk) {}
5778 llvm_unreachable(
"qualified type locs not expected here!");
5781 llvm_unreachable(
"decayed type locs not expected here!");
5814 assert(isa<DependentNameType>(ClsTy) &&
"Unexpected TypeLoc");
5825 if (isa<ElaboratedType>(ClsTy)) {
5840 llvm_unreachable(
"Nested-name-specifier must name a type");
5872 for (
unsigned i = 0, e = TL.
getNumParams(), tpi = 0; i != e; ++i) {
5891 void VisitTypeLoc(
TypeLoc TL) {
5892 llvm_unreachable(
"unsupported TypeLoc kind in declarator!");
5899 switch (Chunk.
Kind) {
5904 llvm_unreachable(
"cannot be _Atomic qualified");
5925 if (AL.getKind() == ParsedAttr::AT_AddressSpace) {
5934 "no address_space attribute found at the expected location!");
5948 Sema &S = State.getSema();
5955 if (isa<PackExpansionType>(T)) {
5970 State.getExpansionLocForMacroQualifiedType(TL.getTypePtr()));
5995 if (ReturnTypeInfo) {
6015 "LocInfoType's TypeClass conflicts with an existing Type class");
6021 llvm_unreachable(
"LocInfoType leaked into the type system; an opaque TypeTy*" 6022 " was used directly instead of getting the QualType through" 6023 " GetTypeFromParser");
6030 "Type name should have no identifier!");
6045 checkUnusedDeclAttributes(D);
6047 if (getLangOpts().CPlusPlus) {
6049 CheckExtraCXXDefaultArguments(D);
6052 return CreateParsedType(T, TInfo);
6058 return CreateParsedType(T, TInfo);
6069 const Expr *AddrSpace,
6074 S.
Diag(AttrLoc, diag::err_attribute_argument_type)
6081 if (addrSpace.isSigned()) {
6082 if (addrSpace.isNegative()) {
6083 S.
Diag(AttrLoc, diag::err_attribute_address_space_negative)
6087 addrSpace.setIsSigned(
false);
6093 if (addrSpace > max) {
6094 S.
Diag(AttrLoc, diag::err_attribute_address_space_too_high)
6129 Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers);
6141 return BuildAddressSpaceAttr(T, ASIdx, AddrSpace, AttrLoc);
6149 TypeProcessingState &State) {
6150 Sema &S = State.getSema();
6155 S.
Diag(Attr.
getLoc(), diag::err_attribute_address_function_type);
6161 if (Attr.
getKind() == ParsedAttr::AT_AddressSpace) {
6165 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments) << Attr
6185 ASArgExpr =
static_cast<Expr *
>(AddrSpace.
get());
6198 ::new (Ctx) AddressSpaceAttr(Ctx, Attr, static_cast<unsigned>(ASIdx));
6210 if (EquivType.
isNull()) {
6214 T = State.getAttributedType(ASAttr, Type, EquivType);
6216 T = State.getAttributedType(ASAttr, Type, Type);
6228 llvm_unreachable(
"Invalid address space");
6246 bool NonObjCPointer =
false;
6256 NonObjCPointer =
true;
6263 if (state.isProcessingDeclSpec()) {
6271 Sema &S = state.getSema();
6278 S.
Diag(AttrLoc, diag::err_attribute_argument_type) << attr
6286 if (II->
isStr(
"none"))
6288 else if (II->
isStr(
"strong"))
6290 else if (II->
isStr(
"weak"))
6292 else if (II->
isStr(
"autoreleasing"))
6295 S.
Diag(AttrLoc, diag::warn_attribute_type_not_supported) << attr << II;
6315 S.
Diag(AttrLoc, diag::err_attr_objc_ownership_redundant)
6322 if (previousLifetime != lifetime) {
6325 const Type *prevTy =
nullptr;
6326 while (!prevTy || prevTy != underlyingType.
Ty) {
6327 prevTy = underlyingType.
Ty;
6336 if (NonObjCPointer) {
6346 S.
Diag(AttrLoc, diag::warn_type_attribute_wrong_type) << name
6363 type = state.getAttributedType(
6364 createSimpleAttr<ObjCInertUnsafeUnretainedAttr>(S.
Context, attr),
6370 if (!NonObjCPointer)
6376 type = state.getAttributedType(::
new (S.
Context)
6377 ObjCOwnershipAttr(S.
Context, attr, II),
6387 diagnostic,
type, 0));
6389 S.
Diag(loc, diagnostic);
6398 unsigned diagnostic =
6399 (S.
getLangOpts().ObjCWeakRuntime ? diag::err_arc_weak_disabled
6400 : diag::err_arc_weak_no_runtime);
6403 diagnoseOrDelay(S, AttrLoc, diagnostic, type);
6415 if (Class->isArcWeakrefUnavailable()) {
6416 S.
Diag(AttrLoc, diag::err_arc_unsupported_weak_class);
6417 S.
Diag(ObjT->getInterfaceDecl()->getLocation(),
6418 diag::note_class_declared);
6433 Sema &S = state.getSema();
6442 S.
Diag(attr.
getLoc(), diag::err_attribute_multiple_objc_gc);
6449 S.
Diag(attr.
getLoc(), diag::err_attribute_argument_type)
6456 S.
Diag(attr.
getLoc(), diag::err_attribute_wrong_number_arguments) << attr
6463 if (II->
isStr(
"weak"))
6465 else if (II->
isStr(
"strong"))
6468 S.
Diag(attr.
getLoc(), diag::warn_attribute_type_not_supported)
6479 type = state.getAttributedType(
6480 ::new (S.
Context) ObjCGCAttr(S.
Context, attr, II), origType, type);
6496 struct FunctionTypeUnwrapper {
6512 FunctionTypeUnwrapper(
Sema &S,
QualType T) : Original(T) {
6515 if (isa<FunctionType>(Ty)) {
6516 Fn = cast<FunctionType>(Ty);
6518 }
else if (isa<ParenType>(Ty)) {
6519 T = cast<ParenType>(Ty)->getInnerType();
6520 Stack.push_back(Parens);
6521 }
else if (isa<PointerType>(Ty)) {
6522 T = cast<PointerType>(Ty)->getPointeeType();
6524 }
else if (isa<BlockPointerType>(Ty)) {
6525 T = cast<BlockPointerType>(Ty)->getPointeeType();
6526 Stack.push_back(BlockPointer);
6527 }
else if (isa<MemberPointerType>(Ty)) {
6528 T = cast<MemberPointerType>(Ty)->getPointeeType();
6529 Stack.push_back(MemberPointer);
6530 }
else if (isa<ReferenceType>(Ty)) {
6531 T = cast<ReferenceType>(Ty)->getPointeeType();
6532 Stack.push_back(Reference);
6533 }
else if (isa<AttributedType>(Ty)) {
6534 T = cast<AttributedType>(Ty)->getEquivalentType();
6535 Stack.push_back(Attributed);
6536 }
else if (isa<MacroQualifiedType>(Ty)) {
6538 Stack.push_back(MacroQualified);
6552 bool isFunctionType()
const {
return (Fn !=
nullptr); }
6557 if (New ==
get())
return Original;
6560 return wrap(S.
Context, Original, 0);
6565 if (I == Stack.size())
6574 return wrap(C, SplitOld.
Ty, I);
6579 if (I == Stack.size())
return QualType(Fn, 0);
6581 switch (static_cast<WrapKind>(Stack[I++])) {
6588 return wrap(C, cast<AttributedType>(Old)->getEquivalentType(), I);
6591 QualType New = wrap(C, cast<ParenType>(Old)->getInnerType(), I);
6595 case MacroQualified:
6599 QualType New = wrap(C, cast<PointerType>(Old)->getPointeeType(), I);
6603 case BlockPointer: {
6604 QualType New = wrap(C, cast<BlockPointerType>(Old)->getPointeeType(),I);
6608 case MemberPointer: {
6617 if (isa<LValueReferenceType>(OldRef))
6624 llvm_unreachable(
"unknown wrapping kind");
6631 Sema &S = State.getSema();
6635 default: llvm_unreachable(
"Unknown attribute kind");
6636 case ParsedAttr::AT_Ptr32:
6637 A = createSimpleAttr<Ptr32Attr>(S.
Context, PAttr);
6639 case ParsedAttr::AT_Ptr64:
6640 A = createSimpleAttr<Ptr64Attr>(S.
Context, PAttr);
6642 case ParsedAttr::AT_SPtr:
6643 A = createSimpleAttr<SPtrAttr>(S.
Context, PAttr);
6645 case ParsedAttr::AT_UPtr:
6646 A = createSimpleAttr<UPtrAttr>(S.
Context, PAttr);
6650 llvm::SmallSet<attr::Kind, 2> Attrs;
6662 if (Attrs.count(NewAttrKind)) {
6663 S.
Diag(PAttr.
getLoc(), diag::warn_duplicate_attribute_exact) << PAttr;
6666 Attrs.insert(NewAttrKind);
6670 if (Attrs.count(attr::Ptr32) && Attrs.count(attr::Ptr64)) {
6671 S.
Diag(PAttr.
getLoc(), diag::err_attributes_are_not_compatible)
6675 }
else if (Attrs.count(attr::SPtr) && Attrs.count(attr::UPtr)) {
6676 S.
Diag(PAttr.
getLoc(), diag::err_attributes_are_not_compatible)
6689 if (!isa<PointerType>(Desugared)) {
6691 S.
Diag(PAttr.
getLoc(), diag::err_attribute_no_member_pointers) << PAttr;
6693 S.
Diag(PAttr.
getLoc(), diag::err_attribute_pointers_only) << PAttr << 0;
6700 if (PtrWidth == 32) {
6701 if (Attrs.count(attr::Ptr64))
6703 else if (Attrs.count(attr::UPtr))
6705 }
else if (PtrWidth == 64 && Attrs.count(attr::Ptr32)) {
6706 if (Attrs.count(attr::UPtr))
6723 case ParsedAttr::AT_TypeNonNull:
6726 case ParsedAttr::AT_TypeNullable:
6729 case ParsedAttr::AT_TypeNullUnspecified:
6733 llvm_unreachable(
"not a nullability attribute kind");
6753 bool allowOnArrayType) {
6754 Sema &S = state.getSema();
6764 while (
auto attributed = dyn_cast<AttributedType>(desugared.
getTypePtr())) {
6766 if (
auto existingNullability = attributed->getImmediateNullability()) {
6768 if (nullability == *existingNullability) {
6769 S.
Diag(nullabilityLoc, diag::warn_nullability_duplicate)
6777 S.
Diag(nullabilityLoc, diag::err_nullability_conflicting)
6783 desugared = attributed->getModifiedType();
6791 if (nullability != *existingNullability) {
6792 S.
Diag(nullabilityLoc, diag::err_nullability_conflicting)
6800 if (
auto typedefNullability
6802 if (*typedefNullability == *existingNullability) {
6815 !(allowOnArrayType && desugared->
isArrayType())) {
6816 S.
Diag(nullabilityLoc, diag::err_nullability_nonpointer)
6823 if (isContextSensitive) {
6825 const Type *pointeeType;
6834 S.
Diag(nullabilityLoc, diag::err_nullability_cs_multilevel)
6837 S.
Diag(nullabilityLoc, diag::note_nullability_type_specifier)
6847 type = state.getAttributedType(
6856 Sema &S = state.getSema();
6858 if (isa<ObjCTypeParamType>(type)) {
6860 type = state.getAttributedType(
6861 createSimpleAttr<ObjCKindOfAttr>(S.
Context, attr), type, type);
6873 S.
Diag(attr.
getLoc(), diag::err_objc_kindof_nonobject)
6882 objType->getBaseType(), objType->getTypeArgsAsWritten(),
6883 objType->getProtocols(),
6884 objType->isObjCUnqualifiedId() ?
false :
true);
6893 "multiple spellings for __kindof?");
6895 A->setImplicit(
true);
6896 equivType = state.getAttributedType(A, equivType, equivType);
6901 type = state.getAttributedType(
6902 createSimpleAttr<ObjCKindOfAttr>(S.
Context, attr), type, equivType);
6914 Declarator &declarator = state.getDeclarator();
6917 auto moveToChunk = [&](
DeclaratorChunk &chunk,
bool inFunction) ->
bool {
6930 PK_MemberFunctionPointer,
6935 : inFunction? PK_MemberFunctionPointer : PK_MemberPointer;
6937 auto diag = state.getSema().Diag(attr.
getLoc(),
6938 diag::warn_nullability_declspec)
6942 << static_cast<unsigned>(pointerKind);
6948 state.getSema().getPreprocessor().getLocForEndOfToken(
6960 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
6962 switch (chunk.
Kind) {
6966 return moveToChunk(chunk,
false);
6978 return moveToChunk(*dest,
true);
6997 llvm_unreachable(
"not a calling convention attribute");
6998 case ParsedAttr::AT_CDecl:
6999 return createSimpleAttr<CDeclAttr>(Ctx, Attr);
7000 case ParsedAttr::AT_FastCall:
7001 return createSimpleAttr<FastCallAttr>(Ctx, Attr);
7002 case ParsedAttr::AT_StdCall:
7003 return createSimpleAttr<StdCallAttr>(Ctx, Attr);
7004 case ParsedAttr::AT_ThisCall:
7005 return createSimpleAttr<ThisCallAttr>(Ctx, Attr);
7006 case ParsedAttr::AT_RegCall:
7007 return createSimpleAttr<RegCallAttr>(Ctx, Attr);
7008 case ParsedAttr::AT_Pascal:
7009 return createSimpleAttr<PascalAttr>(Ctx, Attr);
7010 case ParsedAttr::AT_SwiftCall:
7011 return createSimpleAttr<SwiftCallAttr>(Ctx, Attr);
7012 case ParsedAttr::AT_VectorCall:
7013 return createSimpleAttr<VectorCallAttr>(Ctx, Attr);
7014 case ParsedAttr::AT_AArch64VectorPcs:
7015 return createSimpleAttr<AArch64VectorPcsAttr>(Ctx, Attr);
7016 case ParsedAttr::AT_Pcs: {
7022 Str = cast<StringLiteral>(Attr.
getArgAsExpr(0))->getString();
7025 PcsAttr::PCSType
Type;
7026 if (!PcsAttr::ConvertStrToPCSType(Str, Type))
7027 llvm_unreachable(
"already validated the attribute");
7028 return ::new (Ctx) PcsAttr(Ctx, Attr, Type);
7030 case ParsedAttr::AT_IntelOclBicc:
7031 return createSimpleAttr<IntelOclBiccAttr>(Ctx, Attr);
7032 case ParsedAttr::AT_MSABI:
7033 return createSimpleAttr<MSABIAttr>(Ctx, Attr);
7034 case ParsedAttr::AT_SysVABI:
7035 return createSimpleAttr<SysVABIAttr>(Ctx, Attr);
7036 case ParsedAttr::AT_PreserveMost:
7037 return createSimpleAttr<PreserveMostAttr>(Ctx, Attr);
7038 case ParsedAttr::AT_PreserveAll:
7039 return createSimpleAttr<PreserveAllAttr>(Ctx, Attr);
7041 llvm_unreachable(
"unexpected attribute kind!");
7048 Sema &S = state.getSema();
7050 FunctionTypeUnwrapper unwrapped(S, type);
7052 if (attr.
getKind() == ParsedAttr::AT_NoReturn) {
7057 if (!unwrapped.isFunctionType())
7068 if (attr.
getKind() == ParsedAttr::AT_NSReturnsRetained) {
7072 if (!unwrapped.isFunctionType())
7077 unwrapped.get()->getReturnType()))
7082 if (state.getSema().getLangOpts().ObjCAutoRefCount) {
7084 = unwrapped.get()->getExtInfo().withProducesResult(
true);
7087 type = state.getAttributedType(
7088 createSimpleAttr<NSReturnsRetainedAttr>(S.
Context, attr),
7093 if (attr.
getKind() == ParsedAttr::AT_AnyX86NoCallerSavedRegisters) {
7098 if (!unwrapped.isFunctionType())
7102 unwrapped.get()->getExtInfo().withNoCallerSavedRegs(
true);
7107 if (attr.
getKind() == ParsedAttr::AT_AnyX86NoCfCheck) {
7109 S.
Diag(attr.
getLoc(), diag::warn_nocf_check_attribute_ignored);
7119 if (!unwrapped.isFunctionType())
7123 unwrapped.get()->getExtInfo().withNoCfCheck(
true);
7128 if (attr.
getKind() == ParsedAttr::AT_Regparm) {
7134 if (!unwrapped.isFunctionType())
7141 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
7149 unwrapped.get()->getExtInfo().withRegParm(value);
7154 if (attr.
getKind() == ParsedAttr::AT_NoThrow) {
7156 if (!unwrapped.isFunctionType())
7169 if (Proto->hasExceptionSpec()) {
7170 switch (Proto->getExceptionSpecType()) {
7172 llvm_unreachable(
"This doesn't have an exception spec!");
7190 S.
Diag(attr.
getLoc(), diag::warn_nothrow_attribute_ignored);
7196 type = unwrapped.wrap(
7206 if (!unwrapped.isFunctionType())
return false;
7221 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
7242 return S.
Diag(attr.
getLoc(), diag::warn_cconv_unsupported)
7247 return S.
Diag(attr.
getLoc(), diag::err_cconv_varargs)
7254 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
7267 auto EI = unwrapped.get()->getExtInfo().withCallingConv(CC);
7271 type = state.getAttributedType(CCAttr, type, Equivalent);
7291 FunctionTypeUnwrapper Unwrapped(*
this, T);
7293 bool IsVariadic = (isa<FunctionProtoType>(FT) &&
7294 cast<FunctionProtoType>(FT)->isVariadic());
7307 Diag(Loc, diag::warn_cconv_unsupported)
7318 if (CurCC != DefaultCC || DefaultCC == ToCC)
7321 if (hasExplicitCallingConv(T))
7326 QualType Wrapped = Unwrapped.wrap(*
this, FT);
7341 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments) << Attr
7361 SizeExpr = Size.
get();
7379 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments) << Attr
7399 sizeExpr = Size.
get();
7420 bool IsPolyUnsigned = Triple.getArch() == llvm::Triple::aarch64 ||
7421 Triple.getArch() == llvm::Triple::aarch64_32 ||
7422 Triple.getArch() == llvm::Triple::aarch64_be;
7424 if (IsPolyUnsigned) {
7426 return BTy->
getKind() == BuiltinType::UChar ||
7427 BTy->
getKind() == BuiltinType::UShort ||
7428 BTy->
getKind() == BuiltinType::ULong ||
7429 BTy->
getKind() == BuiltinType::ULongLong;
7432 return BTy->
getKind() == BuiltinType::SChar ||
7433 BTy->
getKind() == BuiltinType::Short;
7439 if ((Triple.isArch64Bit() || Triple.getArch() == llvm::Triple::aarch64_32) &&
7440 BTy->
getKind() == BuiltinType::Double)
7443 return BTy->
getKind() == BuiltinType::SChar ||
7444 BTy->
getKind() == BuiltinType::UChar ||
7445 BTy->
getKind() == BuiltinType::Short ||
7446 BTy->
getKind() == BuiltinType::UShort ||
7447 BTy->
getKind() == BuiltinType::Int ||
7448 BTy->
getKind() == BuiltinType::UInt ||
7449 BTy->
getKind() == BuiltinType::Long ||
7450 BTy->
getKind() == BuiltinType::ULong ||
7451 BTy->
getKind() == BuiltinType::LongLong ||
7452 BTy->
getKind() == BuiltinType::ULongLong ||
7453 BTy->
getKind() == BuiltinType::Float ||
7454 BTy->
getKind() == BuiltinType::Half;
7470 S.
Diag(Attr.
getLoc(), diag::err_attribute_unsupported) << Attr;
7476 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments) << Attr
7486 S.
Diag(Attr.
getLoc(), diag::err_attribute_argument_type)
7494 S.
Diag(Attr.
getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
7501 unsigned numElts =
static_cast<unsigned>(numEltsInt.getZExtValue());
7502 unsigned vecSize = typeSize * numElts;
7503 if (vecSize != 64 && vecSize != 128) {
7504 S.
Diag(Attr.
getLoc(), diag::err_attribute_bad_neon_vector_size) << CurType;
7517 S.
Diag(Attr.
getLoc(), diag::err_opencl_invalid_access_qualifier);
7523 QualType BaseTy = TypedefTy->desugar();
7525 std::string PrevAccessQual;
7527 if (TypedefTy->getDecl()->hasAttr<OpenCLAccessAttr>()) {
7528 OpenCLAccessAttr *Attr =
7529 TypedefTy->getDecl()->getAttr<OpenCLAccessAttr>();
7530 PrevAccessQual = Attr->getSpelling();
7532 PrevAccessQual =
"read_only";
7536 switch (ImgType->getKind()) {
7537 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 7538 case BuiltinType::Id: \ 7539 PrevAccessQual = #Access; \ 7541 #include "clang/Basic/OpenCLImageTypes.def" 7543 llvm_unreachable(
"Unable to find corresponding image type.");
7546 llvm_unreachable(
"unexpected type");
7549 if (PrevAccessQual == AttrName.ltrim(
"_")) {
7551 S.
Diag(Attr.
getLoc(), diag::warn_duplicate_declspec)
7555 S.
Diag(Attr.
getLoc(), diag::err_opencl_multiple_access_qualifiers);
7558 S.
Diag(TypedefTy->getDecl()->getBeginLoc(),
7559 diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
7571 if (State.getDeclarator().isDeclarationOfFunction()) {
7572 CurType = State.getAttributedType(
7573 createSimpleAttr<LifetimeBoundAttr>(State.getSema().Context, Attr),
7581 auto attrKind = attr.
getKind();
7583 return attrKind == ParsedAttr::AT_AddressSpace ||
7584 attrKind == ParsedAttr::AT_OpenCLPrivateAddressSpace ||
7585 attrKind == ParsedAttr::AT_OpenCLGlobalAddressSpace ||
7586 attrKind == ParsedAttr::AT_OpenCLLocalAddressSpace ||
7587 attrKind == ParsedAttr::AT_OpenCLConstantAddressSpace ||
7588 attrKind == ParsedAttr::AT_OpenCLGenericAddressSpace;
7604 state.setParsedNoDeref(
false);
7609 if (attr.isInvalid())
7612 if (attr.isCXX11Attribute()) {
7617 if (attr.isGNUScope()) {
7618 bool IsTypeAttr = attr.isTypeAttr();
7620 state.getSema().Diag(attr.getLoc(),
7622 ? diag::warn_gcc_ignores_type_attr
7623 : diag::warn_cxx11_gnu_attribute_on_type)
7639 switch (attr.getKind()) {
7643 state.getSema().Diag(attr.getLoc(), diag::err_attribute_not_type_attr)
7645 attr.setUsedAsTypeAttr();
7651 state.getSema().Diag(attr.getLoc(),
7652 diag::warn_unknown_attribute_ignored)
7659 case ParsedAttr::AT_MayAlias:
7662 attr.setUsedAsTypeAttr();
7664 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
7665 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
7666 case ParsedAttr::AT_OpenCLLocalAddressSpace:
7667 case ParsedAttr::AT_OpenCLConstantAddressSpace:
7668 case ParsedAttr::AT_OpenCLGenericAddressSpace:
7669 case ParsedAttr::AT_AddressSpace:
7671 attr.setUsedAsTypeAttr();
7676 attr.setUsedAsTypeAttr();
7678 case ParsedAttr::AT_VectorSize:
7680 attr.setUsedAsTypeAttr();
7682 case ParsedAttr::AT_ExtVectorType:
7684 attr.setUsedAsTypeAttr();
7686 case ParsedAttr::AT_NeonVectorType:
7689 attr.setUsedAsTypeAttr();
7691 case ParsedAttr::AT_NeonPolyVectorType:
7694 attr.setUsedAsTypeAttr();
7696 case ParsedAttr::AT_OpenCLAccess:
7698 attr.setUsedAsTypeAttr();
7700 case ParsedAttr::AT_LifetimeBound:
7705 case ParsedAttr::AT_NoDeref: {
7707 type = state.getAttributedType(createSimpleAttr<NoDerefAttr>(Ctx, attr),
7709 attr.setUsedAsTypeAttr();
7710 state.setParsedNoDeref(
true);
7716 attr.setUsedAsTypeAttr();
7729 endIndex = state.getCurrentChunkIndex();
7731 endIndex = state.getDeclarator().getNumTypeObjects();
7732 bool allowOnArrayType =
7733 state.getDeclarator().isPrototypeContext() &&
7739 allowOnArrayType)) {
7743 attr.setUsedAsTypeAttr();
7747 case ParsedAttr::AT_ObjCKindOf:
7755 state.getSema().Diag(attr.getLoc(),
7756 diag::err_objc_kindof_wrong_position)
7759 state.getDeclarator().getDeclSpec().getBeginLoc(),
7769 case ParsedAttr::AT_NoThrow:
7772 if (!state.getSema().getLangOpts().CPlusPlus)
7776 attr.setUsedAsTypeAttr();
7787 case ParsedAttr::AT_AcquireHandle: {
7790 StringRef HandleType;
7791 if (!state.getSema().checkStringLiteralArgumentAttr(attr, 0, HandleType))
7793 type = state.getAttributedType(
7796 attr.setUsedAsTypeAttr();
7803 if (isa<AttributedType>(type) && attr.hasMacroIdentifier() &&
7806 attr.getKind() != ParsedAttr::AT_ObjCGC &&
7807 attr.getKind() != ParsedAttr::AT_ObjCOwnership) {
7809 type = state.getSema().Context.getMacroQualifiedType(type, MacroII);
7810 state.setExpansionLocForMacroQualifiedType(
7812 attr.getMacroExpansionLoc());
7816 if (!state.getSema().getLangOpts().OpenCL ||
7823 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
7825 auto *Def = Var->getDefinition();
7829 InstantiateVariableDefinition(PointOfInstantiation, Var);
7831 Def = Var->getDefinition();
7838 if (Var->getPointOfInstantiation().isInvalid() && Def) {
7839 assert(Var->getTemplateSpecializationKind() ==
7841 "explicit instantiation with no point of instantiation");
7842 Var->setTemplateSpecializationKind(
7843 Var->getTemplateSpecializationKind(), PointOfInstantiation);
7887 completeExprArrayBound(E);
7894 return RequireCompleteType(E->
getExprLoc(), T, Diagnoser);
7899 return RequireCompleteExprType(E, Diagnoser);
7921 if (RequireCompleteTypeImpl(Loc, T, &Diagnoser))
7924 if (!Tag->getDecl()->isCompleteDefinitionRequired()) {
7925 Tag->getDecl()->setCompleteDefinitionRequired();
7926 Consumer.HandleTagDeclRequiredDefinition(Tag->getDecl());
7957 bool OnlyNeedComplete) {
7959 if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility)
7964 if (isa<TagDecl>(D) && cast<TagDecl>(D)->isBeingDefined()) {
7968 }
else if (
auto *RD = dyn_cast<CXXRecordDecl>(D)) {
7969 if (
auto *Pattern = RD->getTemplateInstantiationPattern())
7971 D = RD->getDefinition();
7972 }
else if (
auto *ED = dyn_cast<EnumDecl>(D)) {
7973 if (
auto *Pattern = ED->getTemplateInstantiationPattern())
7975 if (OnlyNeedComplete && ED->isFixed()) {
7979 *Suggested =
nullptr;
7980 for (
auto *Redecl : ED->redecls()) {
7981 if (isVisible(Redecl))
7983 if (Redecl->isThisDeclarationADefinition() ||
7984 (Redecl->isCanonicalDecl() && !*Suggested))
7985 *Suggested = Redecl;
7989 D = ED->getDefinition();
7990 }
else if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
7991 if (
auto *Pattern = FD->getTemplateInstantiationPattern())
7993 D = FD->getDefinition();
7994 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
7995 if (
auto *Pattern = VD->getTemplateInstantiationPattern())
7997 D = VD->getDefinition();
7999 assert(D &&
"missing definition for pattern of instantiated definition");
8003 auto DefinitionIsVisible = [&] {
8010 : hasVisibleMergedDefinition(D)) {
8011 if (CodeSynthesisContexts.empty() &&
8012 !getLangOpts().ModulesLocalVisibility) {
8023 if (DefinitionIsVisible())
8029 Source->CompleteRedeclChain(D);
8030 return DefinitionIsVisible();
8039 if (!RD->
hasAttr<MSInheritanceAttr>()) {
8041 bool BestCase =
false;
8061 RD->
addAttr(MSInheritanceAttr::CreateImplicit(
8063 MSInheritanceAttr::Spelling(IM)));
8070 TypeDiagnoser *Diagnoser) {
8080 if (!MPTy->getClass()->isDependentType()) {
8081 if (getLangOpts().CompleteMemberPointers &&
8082 !MPTy->getClass()->getAsCXXRecordDecl()->isBeingDefined() &&
8083 RequireCompleteType(Loc,
QualType(MPTy->getClass(), 0),
8084 diag::err_memptr_incomplete))
8090 (void)isCompleteType(Loc,
QualType(MPTy->getClass(), 0));
8101 if (Def && !isa<EnumDecl>(Def))
8102 checkSpecializationVisibility(Loc, Def);
8109 !hasVisibleDefinition(Def, &SuggestedDef,
true)) {
8112 bool TreatAsComplete = Diagnoser && !isSFINAEContext();
8113 if (Diagnoser && SuggestedDef)
8114 diagnoseMissingImport(Loc, SuggestedDef, MissingImportKind::Definition,
8116 return !TreatAsComplete;
8117 }
else if (Def && !TemplateInstCallbacks.empty()) {
8118 CodeSynthesisContext TempInst;
8119 TempInst.Kind = CodeSynthesisContext::Memoization;
8120 TempInst.Template = Def;
8121 TempInst.Entity = Def;
8122 TempInst.PointOfInstantiation = Loc;
8130 TagDecl *Tag = dyn_cast_or_null<TagDecl>(Def);
8139 if (Def->isInvalidDecl())
8145 Source->CompleteType(Tag);
8146 if (IFace && IFace->hasExternalLexicalStorage())
8147 Source->CompleteType(IFace);
8151 return RequireCompleteTypeImpl(Loc, T, Diagnoser);
8158 if (
auto *RD = dyn_cast_or_null<CXXRecordDecl>(Tag)) {
8159 bool Instantiated =
false;
8160 bool Diagnosed =
false;
8161 if (RD->isDependentContext()) {
8165 }
else if (
auto *ClassTemplateSpec =
8166 dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
8167 if (ClassTemplateSpec->getSpecializationKind() ==
TSK_Undeclared) {
8169 Diagnosed = InstantiateClassTemplateSpecialization(
8173 Instantiated =
true;
8177 if (!RD->isBeingDefined() && Pattern) {
8179 assert(MSI &&
"Missing member specialization information?");
8184 Diagnosed = InstantiateClass(Loc, RD, Pattern,
8185 getTemplateInstantiationArgs(RD),
8189 Instantiated =
true;
8197 if (Diagnoser && Diagnosed)
8203 return RequireCompleteTypeImpl(Loc, T, Diagnoser);
8213 Diagnoser->diagnose(*
this, Loc, T);
8220 : diag::note_forward_declaration)
8224 if (IFace && !IFace->isInvalidDecl())
8225 Diag(IFace->getLocation(), diag::note_forward_class);
8230 ExternalSource->MaybeDiagnoseMissingCompleteType(Loc, T);
8238 return RequireCompleteType(Loc, T, Diagnoser);
8251 default: llvm_unreachable(
"Invalid tag kind for literal type diagnostic!");
8278 if ((isCompleteType(Loc, ElemType) || ElemType->isVoidType()) &&
8296 if (RequireCompleteType(Loc, ElemType, diag::note_non_literal_incomplete, T))
8301 if (RD->
isLambda() && !getLangOpts().CPlusPlus17) {
8313 for (
const auto &I : RD->
vbases())
8314 Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here)
8315 << I.getSourceRange();
8318 Diag(RD->
getLocation(), diag::note_non_literal_no_constexpr_ctors) << RD;
8320 for (
const auto &I : RD->
bases()) {
8321 if (!I.getType()->isLiteralType(Context)) {
8322 Diag(I.getBeginLoc(), diag::note_non_literal_base_class)
8327 for (
const auto *I : RD->
fields()) {
8328 if (!I->getType()->isLiteralType(Context) ||
8329 I->getType().isVolatileQualified()) {
8330 Diag(I->getLocation(), diag::note_non_literal_field)
8331 << RD << I << I->getType()
8332 << I->getType().isVolatileQualified();
8342 assert(Dtor &&
"class has literal fields and bases but no dtor?");
8351 ? diag::note_non_literal_user_provided_dtor
8352 : diag::note_non_literal_nontrivial_dtor)
8355 SpecialMemberIsTrivial(Dtor, CXXDestructor, TAH_IgnoreTrivialABI,
8365 return RequireLiteralType(Loc, T, Diagnoser);
8391 Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield) << 2;
8396 DiagnoseUseOfDecl(TT->getDecl(), E->
getExprLoc());
8420 }
else if (
const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
8421 if (
const ValueDecl *VD = ME->getMemberDecl())
8422 if (isa<FieldDecl>(VD) || isa<VarDecl>(VD))
8423 return VD->getType();
8424 }
else if (
const ObjCIvarRefExpr *IR = dyn_cast<ObjCIvarRefExpr>(E)) {
8425 return IR->getDecl()->getType();
8427 if (PR->isExplicitProperty())
8428 return PR->getExplicitProperty()->getType();
8429 }
else if (
auto *PE = dyn_cast<PredefinedExpr>(E)) {
8430 return PE->getType();
8440 using namespace sema;
8442 if (isa<ParenExpr>(E)) {
8444 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
8472 bool AsUnevaluated) {
8475 if (AsUnevaluated && CodeSynthesisContexts.empty() &&
8479 Diag(E->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
8491 Diag(Loc, diag::err_only_enums_have_underlying_types);
8500 Diag(Loc, diag::err_underlying_type_of_incomplete_enum) << BaseType;
8501 Diag(FwdDecl->
getLocation(), diag::note_forward_declaration) << FwdDecl;
8506 assert(ED &&
"EnumType has no EnumDecl");
8508 DiagnoseUseOfDecl(ED, Loc);
8511 assert(!Underlying.
isNull());
8517 llvm_unreachable(
"unknown unary transform type");
8524 if (RequireCompleteType(Loc, T, diag::err_atomic_specifier_bad_type, 0))
8527 int DisallowedKind = -1;
8542 if (DisallowedKind != -1) {
8543 Diag(Loc, diag::err_atomic_specifier_bad_type) << DisallowedKind << T;
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Abstract class used to diagnose incomplete types.
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
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 (...
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
AttributePool & getAttributePool() const
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
TypeLoc getValueLoc() const
unsigned UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
const Type * Ty
The locally-unqualified type.
bool hasConstexprDestructor() const
Determine whether this class has a constexpr destructor.
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
static unsigned getLiteralDiagFromTagKind(TagTypeKind Tag)
Get diagnostic select index for tag kind for literal type diagnostic message.
void setImplicit(bool I=true)
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl *> Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
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.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
static bool isOmittedBlockReturnType(const Declarator &D)
isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a ...
no exception specification
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
This is a discriminated union of FileInfo and ExpansionInfo.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
PointerType - C99 6.7.5.1 - Pointer Declarators.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
A (possibly-)qualified type.
bool isBlockPointerType() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...
bool isMemberPointerType() const
void setStarLoc(SourceLocation Loc)
Wrapper for source info for tag types.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
static const TSS TSS_unsigned
static bool hasNullabilityAttr(const ParsedAttributesView &attrs)
Check whether there is a nullability attribute of any kind in the given attribute list...
const TypeClass * getTypePtr() const
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
static bool DiagnoseMultipleAddrSpaceAttributes(Sema &S, LangAS ASOld, LangAS ASNew, SourceLocation AttrLoc)
__auto_type (GNU extension)
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
unsigned getNumArgs() const
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
void setNameEndLoc(SourceLocation Loc)
static const TST TST_wchar
void takeOneFrom(ParsedAttributes &Attrs, ParsedAttr *PA)
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
SourceLocation getLoc() const
#define CALLING_CONV_ATTRS_CASELIST
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
void setKWLoc(SourceLocation Loc)
The attribute is immediately after the declaration's name.
void setRParenLoc(SourceLocation Loc)
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
void setStarLoc(SourceLocation Loc)
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
NullabilityKind
Describes the nullability of a particular type.
void setExceptionSpecRange(SourceRange R)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl *> Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C object pointer type.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
TypeLoc getValueLoc() const
void setConceptNameLoc(SourceLocation Loc)
bool isRealFloatingType() const
Floating point categories.
void setEmbeddedInDeclarator(bool isInDeclarator)
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
void addConst()
Add the const type qualifier to this QualType.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool isRecordType() const
bool isDecltypeAuto() const
static const TST TST_typeofExpr
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, Optional< unsigned > NumExpanded=None)
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
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...
const Type * getTypeForDecl() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
static const TST TST_char16
Decl - This represents one declaration (or definition), e.g.
static void diagnoseBadTypeAttribute(Sema &S, const ParsedAttr &attr, QualType type)
diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type...
bool isVariadic() const
Whether this function prototype is variadic.
Syntax
The style used to specify an attribute.
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
static QualType ConvertConstrainedAutoDeclSpecToType(Sema &S, DeclSpec &DS, AutoTypeKeyword AutoKW)
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
const char * getCharacterData(SourceLocation SL, bool *Invalid=nullptr) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer...
A constructor named via a template-id.
Expr * getArgAsExpr(unsigned Arg) const
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorType::VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type...
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
SourceLocation getLParenLoc() const
The base class of the type hierarchy.
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
DiagnosticsEngine & getDiagnostics() const
SourceLocation getBeginLoc() const LLVM_READONLY
One instance of this struct is used for each type in a declarator that is parsed. ...
void setLAngleLoc(SourceLocation Loc)
QualType getCorrespondingUnsignedType(QualType T) const
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
Wrapper for source info for typedefs.
static void fillAtomicQualLoc(AtomicTypeLoc ATL, const DeclaratorChunk &Chunk)
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
SourceLocation getEndLoc() const LLVM_READONLY
bool isTypeSpecSat() const
const TargetInfo & getTargetInfo() const
The attribute is part of a DeclaratorChunk.
RefQualifierKind RefQualifier
A container of type source information.
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template...
bool getHasRegParm() const
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, unsigned &TypeQuals, QualType TypeSoFar, unsigned RemoveTQs, unsigned DiagID)
static void fillDependentAddressSpaceTypeLoc(DependentAddressSpaceTypeLoc DASTL, const ParsedAttributesView &Attrs)
static void transferARCOwnership(TypeProcessingState &state, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
Used for transferring ownership in casts resulting in l-values.
SourceLocation EllipsisLoc
An overloaded operator name, e.g., operator+.
bool getSuppressSystemWarnings() const
Wrapper for source info for pointers decayed from arrays and functions.
Abstract base class used for diagnosing integer constant expression violations.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
SourceLocation getEllipsisLoc() const
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
SourceLocation getEndLoc() const
Get the end source location.
#define NULLABILITY_TYPE_ATTRS_CASELIST
const ParsedAttributes & getAttributes() const
unsigned RestrictQualLoc
The location of the restrict-qualifier, if any.
bool hasAttribute(ParsedAttr::Kind K) const
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
void setParensRange(SourceRange range)
An identifier, stored as an IdentifierInfo*.
void setRAngleLoc(SourceLocation Loc)
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
Represents a variable declaration or definition.
static bool handleObjCPointerTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static OpenCLAccessAttr::Spelling getImageAccess(const ParsedAttributesView &Attrs)
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
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 const TST TST_underlyingType
Information about one declarator, including the parsed type information and the identifier.
void removeObjCLifetime()
LangAS getLangASFromTargetAS(unsigned TargetAS)
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
DiagnosticsEngine & Diags
Wrapper for source info for member pointers.
bool isEnumeralType() const
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
const T * getAs() const
Member-template getAs<specific type>'.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
Extra information about a function prototype.
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Represents a C++17 deduced template specialization type.
The "__interface" keyword.
static const TST TST_interface
static const TST TST_char
A namespace, stored as a NamespaceDecl*.
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 ...
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
TypeLoc getNamedTypeLoc() const
bool isInvalidDecl() const
void setAttrOperandParensRange(SourceRange range)
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
bool isCallingConv() const
Describes how types, statements, expressions, and declarations should be printed. ...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
bool hasDefinition() const
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Represents a parameter to a function.
OpenCLOptions & getOpenCLOptions()
ConceptDecl * getNamedConcept() const
noexcept(expression), value-dependent
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
The collection of all-type qualifiers we support.
bool isVariableArrayType() const
Information about a template-id annotation token.
bool needsExtraLocalData() const
SourceRange getTypeSpecWidthRange() const
void setParensRange(SourceRange Range)
static const TST TST_unknown_anytype
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type.
Base wrapper for a particular "section" of type source info.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
const AstTypeMatcher< RecordType > recordType
Matches record types (e.g.
Represents a struct/union/class.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
TypeSpecifierSign getWrittenSignSpec() const
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
void setLocalRangeEnd(SourceLocation L)
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 hasOuterPointerLikeChunk(const Declarator &D, unsigned endIndex)
Returns true if any of the declarator chunks before endIndex include a level of indirection: array...
SourceLocation getExceptionSpecLocBeg() const
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
SourceLocation getBegin() const
static const TST TST_decimal32
MSInheritanceModel calculateInheritanceModel() const
Calculate what the inheritance model would be for this class.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
Represents a class type in Objective C.
static const TST TST_char8
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
bool hasExplicitCallingConv(QualType T)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
ArrayRef< QualType > getParamTypes() const
SourceLocation getTypeSpecTypeLoc() const
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
QualType BuildParenType(QualType T)
Build a paren type including T.
void setBuiltinLoc(SourceLocation Loc)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
bool isSpelledAsLValue() const
field_range fields() const
void setRBracketLoc(SourceLocation Loc)
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
static void HandleVectorSizeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
SourceLocation getBeginLoc() const LLVM_READONLY
static const TST TST_class
NameKind getNameKind() const
Determine what kind of name this is.
static void fillAttributedTypeLoc(AttributedTypeLoc TL, TypeProcessingState &State)
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...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
static AttrT * createSimpleAttr(ASTContext &Ctx, ParsedAttr &AL)
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
static const TST TST_double
bool hasAutoTypeSpec() const
bool isReferenceType() const
void setElaboratedKeywordLoc(SourceLocation Loc)
static bool IsNoDerefableChunk(DeclaratorChunk Chunk)
static std::string getPrintableNameForEntity(DeclarationName Entity)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
static const TST TST_error
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6...
static const TST TST_enum
static void maybeSynthesizeBlockSignature(TypeProcessingState &state, QualType declSpecType)
Add a synthetic '()' to a block-literal declarator if it is required, given the return type...
TypeLoc getNextTypeLoc() const
static const TSW TSW_unspecified
void copy(DependentTemplateSpecializationTypeLoc Loc)
__DEVICE__ int max(int __a, int __b)
bool hasTagDefinition() const
TSC getTypeSpecComplex() const
Wrapper of type source information for a type with no direct qualifiers.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
static const TST TST_accum
A user-defined literal name, e.g., operator "" _i.
DeclarationNameInfo getConceptNameInfo() const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
bool isInvalidType() const
Values of this type can be null.
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...
bool getProducesResult() const
static void HandleLifetimeBoundAttr(TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
AttributeCommonInfo::Kind getKind() const
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly...
TypeSpecifierWidth getWrittenWidthSpec() const
This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment...
Represents a C++ unqualified-id that has been parsed.
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
void setNameLoc(SourceLocation Loc)
void setAttr(const Attr *A)
static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, TypeSourceInfo *&ReturnTypeInfo)
Represents the results of name lookup.
An lvalue ref-qualifier was provided (&).
unsigned ConstQualLoc
The location of the const-qualifier, if any.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
void setExpansionLoc(SourceLocation Loc)
static void fixItNullability(Sema &S, DiagnosticBuilder &Diag, SourceLocation PointerLoc, NullabilityKind Nullability)
Creates a fix-it to insert a C-style nullability keyword at pointerLoc, taking into account whitespac...
LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t', '\f', '\v', '\n', '\r'.
void setCaretLoc(SourceLocation Loc)
TagKind getTagKind() const
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 ...
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
const FileInfo & getFile() const
bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T)
Check if type T corresponding to declaration specifier DS is disabled due to required OpenCL extensio...
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
bool isTypeSpecPipe() const
const Type * getClass() const
Wrapper for source info for functions.
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
Whether values of this type can be null is (explicitly) unspecified.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, QualType &declSpecType)
Given that there are attributes written on the declarator itself, try to distribute any type attribut...
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool isConstrained() const
__ptr16, alignas(...), etc.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
const clang::PrintingPolicy & getPrintingPolicy() const
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType)
void addCVRQualifiers(unsigned mask)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
const Type * getClass() const
void expandBuiltinRange(SourceRange Range)
TSS getTypeSpecSign() const
void setUsedAsTypeAttr(bool Used=true)
bool isLambda() const
Determine whether this class describes a lambda function object.
Values of this type can never be null.
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope...
Scope - A scope is a transient data structure that is used while parsing the program.
Wrapper for source info for ObjC interfaces.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
Represents a C++ nested-name-specifier or a global scope specifier.
Represents an Objective-C protocol declaration.
#define MS_TYPE_ATTRS_CASELIST
void setUnaligned(bool flag)
static void distributeFunctionTypeAttrFromDeclarator(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
A function type attribute was written on the declarator.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
static FileID getNullabilityCompletenessCheckFileID(Sema &S, SourceLocation loc)
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
const LangOptions & getLangOpts() const
SourceLocation getConstSpecLoc() const
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
void addCVRUQualifiers(unsigned mask)
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
void setLocalRangeBegin(SourceLocation L)
void addAtEnd(ParsedAttr *newAttr)
static void transferARCOwnershipToDeclSpec(Sema &S, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
Represents an ObjC class declaration.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
void copy(ElaboratedTypeLoc Loc)
SourceLocation getIncludeLoc() const
const IdentifierInfo * getAttrName() const
SourceRange getSourceRange() const LLVM_READONLY
static bool handleObjCGCTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type...
is ARM Neon polynomial vector
static NullabilityKind mapNullabilityAttrKind(ParsedAttr::Kind kind)
Map a nullability attribute kind to a nullability kind.
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...
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
IdentifierInfo * getIdentifier() const
CanQualType UnsignedCharTy
void setAttrNameLoc(SourceLocation loc)
const LangOptions & LangOpts
static std::string getFunctionQualifiersAsString(const FunctionProtoType *FnTy)
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
uint8_t PointerKind
Which kind of pointer declarator we saw.
This object can be modified without requiring retains or releases.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
static const TST TST_float
CXXRecordDecl * getMostRecentNonInjectedDecl()
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void setInvalid(bool b=true) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool isExpressionContext() const
Determine whether this declaration appears in a context where an expression could appear...
ExtInfo withCallingConv(CallingConv cc) const
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
void * getOpaqueData() const
Get the pointer where source information is stored.
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl *> Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
llvm::StringRef getParameterABISpelling(ParameterABI kind)
unsigned AutoTemplateParameterDepth
If this is a generic lambda or abbreviated function template, use this as the depth of each 'auto' pa...
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
QualType getCorrespondingSaturatedType(QualType Ty) const
Sema - This implements semantic analysis and AST building for C.
static const TSW TSW_long
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(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
A little helper class used to produce diagnostics.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
SourceLocation getUnalignedSpecLoc() const
Represents a prototype with parameter type info, e.g.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
static void checkExtParameterInfos(Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
Check the extended parameter information.
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
The maximum supported address space number.
ArraySizeModifier
Capture whether this is a normal array (e.g.
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
void addObjCLifetime(ObjCLifetime type)
static QualType ConvertDeclSpecToType(TypeProcessingState &state)
Convert the specified declspec to the appropriate type object.
bool isEnabled(llvm::StringRef Ext) const
void setSizeExpr(Expr *Size)
A conversion function name, e.g., operator int.
SourceRange getRange() const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
TST getTypeSpecType() const
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
Scope * getCurScope() const
Retrieve the parser's current scope.
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
void runWithSufficientStackSpace(llvm::function_ref< void()> Diag, llvm::function_ref< void()> Fn)
Run a given function on a stack with "sufficient" space.
unsigned hasStatic
True if this dimension included the 'static' keyword.
SourceLocation getBeginLoc() const
Get the begin source location.
Type source information for an attributed type.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
QualType getPointeeType() const
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
Declaration of a template type parameter.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
unsigned VolatileQualLoc
The location of the volatile-qualifier, if any.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
SourceLocation getLAngleLoc() const
This file defines the classes used to store parsed information about declaration-specifiers and decla...
const T * castAs() const
Member-template castAs<specific type>.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
bool isObjCRetainableType() const
QualType getTypeOfExprType(Expr *e) const
GCC extension.
bool isContextSensitiveKeywordAttribute() const
void setFoundDecl(NamedDecl *D)
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Represents a C++ destructor within a class.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
QualType getParenType(QualType NamedType) const
static void HandleExtVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
Process the OpenCL-like ext_vector_type attribute when it occurs on a type.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
std::string getAsString() const
Retrieve the human-readable string for this name.
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl *> protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
SourceLocation getVolatileSpecLoc() const
QualType BuildAtomicType(QualType T, SourceLocation Loc)
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
Defines the clang::Preprocessor interface.
static DelayedDiagnostic makeForbiddenType(SourceLocation loc, unsigned diagnostic, QualType type, unsigned argument)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold=true)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
void completeExprArrayBound(Expr *E)
ObjCLifetime getObjCLifetime() const
bool supportsVariadicCall(CallingConv CC)
Checks whether the given calling convention supports variadic calls.
SourceLocation getBeginLoc() const
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
virtual void AssignInheritanceModel(CXXRecordDecl *RD)
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
void setTemplateKWLoc(SourceLocation Loc)
Represents a C++ template name within the type system.
static const TST TST_decimal64
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Defines the clang::TypeLoc interface and its subclasses.
static void warnAboutRedundantParens(Sema &S, Declarator &D, QualType T)
Produce an appropriate diagnostic for a declarator with top-level parentheses.
A namespace alias, stored as a NamespaceAliasDecl*.
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
static void CopyTypeConstraintFromAutoType(Sema &SemaRef, const AutoType *Auto, AutoTypeLoc AutoLoc, TemplateTypeParmDecl *TP, SourceLocation EllipsisLoc)
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
static QualType getDecltypeForExpr(Sema &S, Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
CanQualType UnsignedInt128Ty
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
void setNameLoc(SourceLocation Loc)
bool isFunctionOrMethod() const
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
CharSourceRange getImmediateExpansionRange(SourceLocation Loc) const
Return the start/end of the expansion information for an expansion location.
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
SourceLocation Loc
Loc - The place where this type was defined.
Qualifiers Quals
The local qualifiers.
void setAttrExprOperand(Expr *e)
DeclContext * getParent()
getParent - Returns the containing DeclContext.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
void setNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
void setHasBaseTypeAsWritten(bool HasBaseType)
void setEllipsisLoc(SourceLocation EL)
static QualType inferARCLifetimeForPointee(Sema &S, QualType type, SourceLocation loc, bool isReference)
Given that we're building a pointer or reference to the given.
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
Get a function type and produce the equivalent function type with the specified exception specificati...
SourceLocation getEnd() const
Compare two source locations.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
static const TST TST_half
An lvalue reference type, per C++11 [dcl.ref].
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
bool isFriendSpecified() const
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
TypeLoc getInnerLoc() const
Wraps an identifier and optional source location for the identifier.
static void moveAttrFromListToList(ParsedAttr &attr, ParsedAttributesView &fromList, ParsedAttributesView &toList)
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
SourceLocation getCommaLoc() const
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
static const TSW TSW_short
void removeCVRQualifiers(unsigned mask)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
bool isFirstDeclarator() const
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType)
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
bool isConstQualified() const
Determine whether this type is const-qualified.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
RecordDecl * getDecl() const
ConstexprSpecKind getConstexprSpecifier() const
static bool checkOmittedBlockReturnType(Sema &S, Declarator &declarator, QualType Result)
Return true if this is omitted block return type.
void setStarLoc(SourceLocation Loc)
static const TST TST_char32
noexcept(expression), evals to 'false'
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
static const TST TST_fract
void setTypeofLoc(SourceLocation Loc)
static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type...
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy, Declarator &D, unsigned FunctionChunkIndex)
A parameter attribute which changes the argument-passing ABI rule for the parameter.
Wrapper for source info for arrays.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
There is no lifetime qualification on this type.
Information about a FileID, basically just the logical file that it represents and include stack info...
is AltiVec 'vector Pixel'
static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type, ArrayRef< TypeSourceInfo *> typeArgs, SourceRange typeArgsRange, bool failOnError=false)
Apply Objective-C type arguments to the given type.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
Assigning into this object requires the old value to be released and the new value to be retained...
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
The attribute is in the decl-specifier-seq.
ExtProtoInfo getExtProtoInfo() const
SCS getStorageClassSpec() const
void setKNRPromoted(bool promoted)
ASTContext & getASTContext() const
SourceLocation getRParenLoc() const
static bool isPermittedNeonBaseType(QualType &Ty, VectorType::VectorKind VecKind, Sema &S)
static const TST TST_float16
static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
Process an individual function attribute.
const ExtParameterInfo * ExtParameterInfos
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...
Encodes a location in the source.
bool isTypeSpecOwned() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
QualType getReturnType() const
static const TST TST_auto_type
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
LangAS getAddressSpace() const
Return the address space of this type.
static void distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
Distribute an objc_gc type attribute that was written on the declarator.
PointerDeclaratorKind
Describes the kind of a pointer a declarator describes.
Interfaces are the core concept in Objective-C for object oriented design.
FunctionDefinitionKind getFunctionDefinitionKind() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword...
enum clang::DeclaratorChunk::@219 Kind
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
ParameterABI getABI() const
Return the ABI treatment of this parameter.
Represents the declaration of a struct/union/class/enum.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state, Qualifiers::ObjCLifetime ownership, unsigned chunkIndex)
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 ...
ASTContext & getASTContext() const LLVM_READONLY
SourceLocation getEndLoc() const LLVM_READONLY
static const TST TST_union
CallingConv getCC() const
static QualType getUnderlyingType(const SubRegion *R)
ParsedAttr - Represents a syntactic attribute.
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
static const TSS TSS_signed
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isFunctionDeclarationScope() const
isFunctionDeclarationScope - Return true if this scope is a function prototype scope.
MemberPointerTypeInfo Mem
Qualifiers getMethodQuals() const
SimplePointerKind
A simple notion of pointer kinds, which matches up with the various pointer declarators.
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.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
SourceLocation getRAngleLoc() const
void remove(ParsedAttr *ToBeRemoved)
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
static bool distributeFunctionTypeAttrToInnermost(TypeProcessingState &state, ParsedAttr &attr, ParsedAttributesView &attrList, QualType &declSpecType)
Try to distribute a function type attribute to the innermost function chunk or type.
bool isArgExpr(unsigned Arg) const
Decl * getRepAsDecl() const
static bool isBlockPointer(Expr *Arg)
is AltiVec 'vector bool ...'
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SourceRange getRange() const
static bool isAddressSpaceKind(const ParsedAttr &attr)
bool isFunctionProtoType() const
static const TST TST_typeofType
void setAmpLoc(SourceLocation Loc)
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
void setLBracketLoc(SourceLocation Loc)
AutoTypeKeyword getKeyword() const
TypeClass getTypeClass() const
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
SourceLocation getRAngleLoc() const
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
static bool isVectorSizeTooLarge(unsigned NumElements)
static Attr * createNullabilityAttr(ASTContext &Ctx, ParsedAttr &Attr, NullabilityKind NK)
SourceLocation getPragmaAssumeNonNullLoc() const
The location of the currently-active #pragma clang assume_nonnull begin.
bool isStaticMember()
Returns true if this declares a static member.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
void setLAngleLoc(SourceLocation Loc)
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isVLASupported() const
Whether target supports variable-length arrays.
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
static void recordNullabilitySeen(Sema &S, SourceLocation loc)
Marks that a nullability feature has been used in the file containing loc.
void addArgument(const TemplateArgumentLoc &Loc)
std::string getAsString() const
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;...
Represents a pack expansion of types.
static bool checkNullabilityTypeSpecifier(TypeProcessingState &state, QualType &type, ParsedAttr &attr, bool allowOnArrayType)
Applies a nullability type specifier to the given type, if possible.
static QualType InventTemplateParameter(TypeProcessingState &state, QualType T, TypeSourceInfo *TSI, AutoType *Auto, InventedTemplateParameterInfo &Info)
bool isUndeducedAutoType() const
void setLParenLoc(SourceLocation Loc)
StringRef getName() const
Return the actual identifier string.
static bool checkObjCKindOfType(TypeProcessingState &state, QualType &type, ParsedAttr &attr)
Check the application of the Objective-C '__kindof' qualifier to the given type.
void setTypeArgsLAngleLoc(SourceLocation Loc)
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
CanQualType UnsignedShortTy
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
Base class for declarations which introduce a typedef-name.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
TSW getTypeSpecWidth() const
static const TST TST_decltype_auto
void setClassTInfo(TypeSourceInfo *TI)
TagTypeKind
The kind of a tag type.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
CanQualType ObjCBuiltinIdTy
Dataflow Directional Tag Classes.
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
static const TSS TSS_unspecified
SourceLocation getTypeSpecWidthLoc() const
ExtInfo getExtInfo() const
not evaluated yet, for special member function
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void setAmpAmpLoc(SourceLocation Loc)
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
static const TST TST_decltype
static const TST TST_auto
static const TST TST_void
static TypeSourceInfo * GetTypeSourceInfoForDeclarator(TypeProcessingState &State, QualType T, TypeSourceInfo *ReturnTypeInfo)
Create and instantiate a TypeSourceInfo with type source information.
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk...
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
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 const TST TST_int128
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
QualType getUnderlyingType() const
CanQualType UnsignedLongLongTy
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
static Attr * getCCTypeAttr(ASTContext &Ctx, ParsedAttr &Attr)
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
The name of a declaration.
Represents the declaration of an Objective-C type parameter.
bool isBooleanType() const
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
LLVM_READONLY bool isIdentifierBody(unsigned char c, bool AllowDollar=false)
Returns true if this is a body character of a C identifier, which is [a-zA-Z0-9_].
SourceLocation getTypeSpecSignLoc() const
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
#define FUNCTION_TYPE_ATTRS_CASELIST
static bool isArraySizeVLA(Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal)
Check whether the specified array size makes the array type a VLA.
bool isCXX11Attribute() const
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
bool hasObjCLifetime() const
static void processTypeAttrs(TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, ParsedAttributesView &attrs)
SplitQualType getSingleStepDesugaredType() const
TypeLoc getModifiedLoc() const
The modified type, which is generally canonically different from the attribute type.
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
static void HandleOpenCLAccessAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S)
Handle OpenCL Access Qualifier Attribute.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
A type that was preceded by the 'template' keyword, stored as a Type*.
static const TST TST_unspecified
SourceLocation getBeginLoc() const LLVM_READONLY
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool isValid() const
A scope specifier is present, and it refers to a real scope.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
QualType getModifiedType() const
unsigned getNumParams() const
void setNameLoc(SourceLocation Loc)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
Represents a pointer to an Objective C object.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
bool IsEquivalent(Decl *D1, Decl *D2)
Determine whether the two declarations are structurally equivalent.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::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...
static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, Sema &S, VectorType::VectorKind VecKind)
HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to c...
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
static const TST TST_decimal128
static void distributeFunctionTypeAttrFromDeclSpec(TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
A function type attribute was written in the decl spec.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
This template specialization was declared or defined by an explicit specialization (C++ [temp...
#define OBJC_POINTER_TYPE_ATTRS_CASELIST
CanQualType UnsignedLongTy
static bool isFunctionOrMethod(const Decl *D)
isFunctionOrMethod - Return true if the given decl has function type (function or function-typed vari...
TemplateIdAnnotation * getRepAsTemplateId() const
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
bool isAtomicType() const
bool isFunctionType() const
static const TST TST_typename
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
Base for LValueReferenceType and RValueReferenceType.
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
void copy(TemplateSpecializationTypeLoc Loc)
Wraps an ObjCPointerType with source location information.
Holds information about the various types of exception specification.
unsigned AtomicQualLoc
The location of the _Atomic-qualifier, if any.
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
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.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
SourceLocation getTypeSpecTypeNameLoc() const
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
CXXScopeSpec & getTypeSpecScope()
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
SourceRange getExceptionSpecRange() const
bool isObjectType() const
Determine whether this type is an object type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
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...
bool isObjCObjectType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool hasObjCGCAttr() const
Describes whether we've seen any nullability information for the given file.
UnqualTypeLoc getUnqualifiedLoc() const
SourceLocation getIdentifierLoc() const
void setRAngleLoc(SourceLocation Loc)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isSet() const
Deprecated.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
PointerWrappingDeclaratorKind
Describes a declarator chunk wrapping a pointer that marks inference as unexpected.
void setInvalidType(bool Val=true)
Reading or writing from this object requires a barrier call.
An attributed type is a type to which a type attribute has been applied.
LangAS asOpenCLLangAS() const
If this is an OpenCL addr space attribute returns its representation in LangAS, otherwise returns def...
void setKWLoc(SourceLocation Loc)
unsigned TypeQuals
For now, sema will catch these as invalid.
TranslationUnitDecl * getTranslationUnitDecl() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
CallingConv getCallConv() const
Captures information about "declaration specifiers".
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SourceLocation getRestrictSpecLoc() const
Represents a C++ struct/union/class.
SourceLocation getEllipsisLoc() const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
bool hasExplicitTemplateArgs() const
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
unsigned getAttributeSpellingListIndex() const
void setParam(unsigned i, ParmVarDecl *VD)
Provides information a specialization of a member of a class template, which may be a member function...
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
static const TST TST_float128
void atTemplateEnd(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, const Sema::CodeSynthesisContext &Inst)
void setLParenLoc(SourceLocation Loc)
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
static const TST TST_bool
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
static void assignInheritanceModel(Sema &S, CXXRecordDecl *RD)
Locks in the inheritance model for the given class and all of its bases.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
This class is used for builtin types like 'int'.
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
SourceManager & getSourceManager() const
A template-id, e.g., f<int>.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
ParsedType getRepAsType() const
Defines the clang::TargetInfo interface.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
A SourceLocation and its associated SourceManager.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
SourceLocation getAtomicSpecLoc() const
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
static Qualifiers fromCVRMask(unsigned CVR)
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
static const TSW TSW_longlong
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
static OpaquePtr make(QualType P)
Microsoft __declspec(nothrow) extension.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
static void emitNullabilityConsistencyWarning(Sema &S, SimplePointerKind PointerKind, SourceLocation PointerLoc, SourceLocation PointerEndLoc)
Context-sensitive version of a keyword attribute.
A reference to a declared variable, function, enum, etc.
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
Represents an extended address space qualifier where the input address space value is dependent...
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
void copy(TypeLoc other)
Copies the other type loc into this one.
static const TST TST_atomic
bool isPointerType() const
TemplateArgumentLoc getArgLoc(unsigned i) const
SourceManager & SourceMgr
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
void addAddressSpace(LangAS space)
static const TST TST_struct
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
void initializeFullCopy(TypeLoc Other)
Initializes this by copying its information from another TypeLoc of the same type.
DeclaratorContext getContext() const
static StringRef getNameForCallConv(CallingConv CC)
Wrapper for source info for builtin types.
An l-value expression is a reference to an object with independent storage.
void setRParenLoc(SourceLocation Loc)
bool isArgIdent(unsigned Arg) const
A trivial tuple used to represent a source range.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &state, ParsedAttr &attr, QualType &type)
This represents a decl that may have a name.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
bool isConstrainedAuto() const
void copy(DependentNameTypeLoc Loc)
Expr * getRepAsExpr() const
QualifiedFunctionKind
Kinds of declarator that cannot contain a qualified function type.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
No keyword precedes the qualified type name.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
static void HandleAddressSpaceTypeAttribute(QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type...
TypeAttrLocation
The location of a type attribute.
static TypeSourceInfo * GetFullTypeForDeclarator(TypeProcessingState &state, QualType declSpecType, TypeSourceInfo *TInfo)
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
attr::Kind getKind() const
unsigned NumArgs
NumArgs - The number of template arguments.
bool isFirstDeclarationOfMember()
Returns true if this declares a real member and not a friend.
llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)
Retrieve the spelling of the given nullability kind.
The global specifier '::'. There is no stored value.
bool isPrototypeContext() const
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
void setType(QualType newType)
AttributePool & getAttributePool() const
Wrapper for source info for pointers.
SourceLocation getBegin() const
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
Wrapper for source info for block pointers.
unsigned size() const
Determine the number of type parameters in this list.
An implicit 'self' parameter.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
base_class_range vbases()
ExceptionSpecInfo ExceptionSpec
A deduction-guide name (a template-name)
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
IdentifierLoc * getArgAsIdent(unsigned Arg) const
A class which abstracts out some details necessary for making a call.
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
void setElaboratedKeywordLoc(SourceLocation Loc)
Attr - This represents one attribute.
ParsedAttributes & getAttributes()
SourceLocation getLocation() const
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...
SourceRange getTypeofParensRange() const
QualType getPointeeType() const
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
QualType getType() const
Return the type wrapped by this type source info.
bool isBeingDefined() const
Return true if this decl is currently being defined.
This parameter (which must have pointer type) is a Swift indirect result parameter.
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
void setUnderlyingTInfo(TypeSourceInfo *TI) const
noexcept(expression), evals to 'true'
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
CanQualType UnsignedIntTy
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?