34 #include "llvm/ADT/SmallPtrSet.h"
35 #include "llvm/ADT/SmallString.h"
36 #include "llvm/ADT/StringSwitch.h"
37 #include "llvm/Support/ErrorHandling.h"
39 using namespace clang;
69 bool useExpansionLoc =
true;
71 case AttributeList::AT_ObjCGC: WhichType =
TDS_Pointer;
break;
76 useExpansionLoc =
false;
86 if (useExpansionLoc && loc.
isMacroID() && II) {
87 if (II->
isStr(
"strong")) {
89 }
else if (II->
isStr(
"weak")) {
94 S.
Diag(loc, diag::warn_type_attribute_wrong_type) << name << WhichType
100 #define OBJC_POINTER_TYPE_ATTRS_CASELIST \
101 case AttributeList::AT_ObjCGC: \
102 case AttributeList::AT_ObjCOwnership
105 #define CALLING_CONV_ATTRS_CASELIST \
106 case AttributeList::AT_CDecl: \
107 case AttributeList::AT_FastCall: \
108 case AttributeList::AT_StdCall: \
109 case AttributeList::AT_ThisCall: \
110 case AttributeList::AT_RegCall: \
111 case AttributeList::AT_Pascal: \
112 case AttributeList::AT_SwiftCall: \
113 case AttributeList::AT_VectorCall: \
114 case AttributeList::AT_MSABI: \
115 case AttributeList::AT_SysVABI: \
116 case AttributeList::AT_Pcs: \
117 case AttributeList::AT_IntelOclBicc: \
118 case AttributeList::AT_PreserveMost: \
119 case AttributeList::AT_PreserveAll
122 #define FUNCTION_TYPE_ATTRS_CASELIST \
123 case AttributeList::AT_NSReturnsRetained: \
124 case AttributeList::AT_NoReturn: \
125 case AttributeList::AT_Regparm: \
126 case AttributeList::AT_AnyX86NoCallerSavedRegisters: \
127 CALLING_CONV_ATTRS_CASELIST
130 #define MS_TYPE_ATTRS_CASELIST \
131 case AttributeList::AT_Ptr32: \
132 case AttributeList::AT_Ptr64: \
133 case AttributeList::AT_SPtr: \
134 case AttributeList::AT_UPtr
137 #define NULLABILITY_TYPE_ATTRS_CASELIST \
138 case AttributeList::AT_TypeNonNull: \
139 case AttributeList::AT_TypeNullable: \
140 case AttributeList::AT_TypeNullUnspecified
145 class TypeProcessingState {
171 : sema(sema), declarator(declarator),
173 trivial(
true), hasSavedAttrs(
false) {}
175 Sema &getSema()
const {
183 bool isProcessingDeclSpec()
const {
187 unsigned getCurrentChunkIndex()
const {
191 void setCurrentChunkIndex(
unsigned idx) {
197 if (isProcessingDeclSpec())
198 return getMutableDeclSpec().getAttributes().getListRef();
203 void saveDeclSpecAttrs() {
205 if (hasSavedAttrs)
return;
207 DeclSpec &spec = getMutableDeclSpec();
210 savedAttrs.push_back(attr);
211 trivial &= savedAttrs.empty();
212 hasSavedAttrs =
true;
218 ignoredTypeAttrs.push_back(&attr);
224 for (
auto *
Attr : ignoredTypeAttrs)
228 ~TypeProcessingState() {
231 restoreDeclSpecAttrs();
235 DeclSpec &getMutableDeclSpec()
const {
239 void restoreDeclSpecAttrs() {
240 assert(hasSavedAttrs);
242 if (savedAttrs.empty()) {
243 getMutableDeclSpec().getAttributes().set(
nullptr);
247 getMutableDeclSpec().getAttributes().set(savedAttrs[0]);
248 for (
unsigned i = 0, e = savedAttrs.size() - 1; i != e; ++i)
249 savedAttrs[i]->setNext(savedAttrs[i+1]);
250 savedAttrs.back()->setNext(
nullptr);
268 assert(cur && cur->
getNext() &&
"ran out of attrs?");
314 if (attr.
getKind() == AttributeList::AT_ObjCGC)
316 assert(attr.
getKind() == AttributeList::AT_ObjCOwnership);
331 bool onlyBlockPointers) {
337 for (; i != 0; --i) {
339 switch (fnChunk.
Kind) {
355 for (--i; i != 0; --i) {
357 switch (ptrChunk.
Kind) {
367 if (onlyBlockPointers)
376 llvm_unreachable(
"bad declarator chunk kind");
382 llvm_unreachable(
"bad declarator chunk kind");
400 Declarator &declarator = state.getDeclarator();
403 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
405 switch (chunk.
Kind) {
411 if (state.isProcessingDeclSpec() &&
412 attr.
getKind() == AttributeList::AT_ObjCOwnership)
415 if (!destChunk) destChunk = &chunk;
428 if (state.isProcessingDeclSpec() &&
429 attr.
getKind() == AttributeList::AT_ObjCOwnership) {
434 dest->getAttrListRef());
458 Declarator &declarator = state.getDeclarator();
462 unsigned innermost = -1U;
463 bool considerDeclSpec =
true;
466 switch (chunk.
Kind) {
480 considerDeclSpec =
false;
488 if (considerDeclSpec) {
493 state.saveDeclSpecAttrs();
502 if (innermost != -1U) {
510 state.addIgnoredTypeAttr(attr);
520 Declarator &declarator = state.getDeclarator();
524 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
526 switch (chunk.
Kind) {
554 Declarator &declarator = state.getDeclarator();
574 state.saveDeclSpecAttrs();
581 state.getDeclarator().getAttrListRef());
587 state.getCurrentAttrListRef(),
593 state.addIgnoredTypeAttr(attr);
602 Declarator &declarator = state.getDeclarator();
613 state.addIgnoredTypeAttr(attr);
628 assert(state.getDeclarator().getAttributes() &&
"declarator has no attrs!");
636 if (attr->isCXX11Attribute())
639 switch (attr->getKind()) {
656 case AttributeList::AT_ObjCKindOf:
662 }
while ((attr = next));
669 Declarator &declarator = state.getDeclarator();
720 loc, loc, declarator));
735 typedef std::pair<DeclSpec::TQ, SourceLocation> QualLoc;
740 if (!(RemoveTQs & Qual.first))
744 if (TypeQuals & Qual.first)
745 S.
Diag(Qual.second, DiagID)
750 TypeQuals &= ~Qual.first;
774 diag::warn_block_literal_attributes_on_omitted_return_type)
789 diag::warn_block_literal_qualifiers_on_omitted_return_type);
799 bool failOnError =
false) {
802 if (!objcObjectType || !objcObjectType->getInterface()) {
803 S.
Diag(loc, diag::err_objc_type_args_non_class)
816 S.
Diag(loc, diag::err_objc_type_args_non_parameterized_class)
827 if (objcObjectType->isSpecialized()) {
828 S.
Diag(loc, diag::err_objc_type_args_specialized_class)
840 unsigned numTypeParams = typeParams->
size();
841 bool anyPackExpansions =
false;
842 for (
unsigned i = 0, n = typeArgs.size(); i != n; ++i) {
850 bool diagnosed =
false;
853 rangeToRemove = attr.getLocalSourceRange();
854 if (attr.getTypePtr()->getImmediateNullability()) {
855 typeArg = attr.
getTypePtr()->getModifiedType();
856 S.
Diag(attr.getLocStart(),
857 diag::err_objc_type_arg_explicit_nullability)
864 S.
Diag(qual.getLocStart(), diag::err_objc_type_arg_qualified)
873 finalTypeArgs.push_back(typeArg);
876 anyPackExpansions =
true;
880 if (!anyPackExpansions) {
881 if (i < numTypeParams) {
882 typeParam = typeParams->
begin()[i];
885 S.
Diag(loc, diag::err_objc_type_args_wrong_arity)
906 assert(anyPackExpansions &&
"Too many arguments?");
915 if (typeArgObjC->isObjCIdType()) {
918 if (boundObjC->isObjCIdType())
927 diag::err_objc_type_arg_does_not_match_bound)
944 assert(anyPackExpansions &&
"Too many arguments?");
955 diag::err_objc_type_arg_does_not_match_bound)
973 diag::err_objc_type_arg_not_id_compatible)
984 if (!anyPackExpansions && finalTypeArgs.size() != numTypeParams) {
985 S.
Diag(loc, diag::err_objc_type_args_wrong_arity)
986 << (typeArgs.size() < typeParams->
size())
1010 if (!Protocols.empty()) {
1016 <<
SourceRange(ProtocolLAngleLoc, ProtocolRAngleLoc);
1017 if (FailOnError) Result =
QualType();
1019 if (FailOnError && Result.
isNull())
1037 if (!TypeArgs.empty()) {
1042 if (FailOnError && Result.
isNull())
1046 if (!Protocols.empty()) {
1051 Diag(Loc, diag::err_invalid_protocol_qualifiers)
1052 <<
SourceRange(ProtocolLAngleLoc, ProtocolRAngleLoc);
1053 if (FailOnError) Result =
QualType();
1055 if (FailOnError && Result.
isNull())
1082 auto ObjCObjectTL = ObjCObjectPointerTL.getPointeeLoc()
1092 ObjCObjectTL.setProtocolLAngleLoc(lAngleLoc);
1093 ObjCObjectTL.setProtocolRAngleLoc(rAngleLoc);
1094 for (
unsigned i = 0, n = protocols.size(); i != n; ++i)
1095 ObjCObjectTL.setProtocolLoc(i, protocolLocs[i]);
1098 return CreateParsedType(Result, ResultTInfo);
1123 for (
unsigned i = 0, n = TypeArgs.size(); i != n; ++i) {
1127 ActualTypeArgInfos.clear();
1131 assert(TypeArgInfo &&
"No type source info?");
1132 ActualTypeArgInfos.push_back(TypeArgInfo);
1138 TypeArgsLAngleLoc, ActualTypeArgInfos, TypeArgsRAngleLoc,
1142 ProtocolLocs, ProtocolRAngleLoc,
1157 ResultTL = ObjCObjectPointerTL.getPointeeLoc();
1162 if (OTPTL.getNumProtocols() > 0) {
1163 assert(OTPTL.getNumProtocols() == Protocols.size());
1164 OTPTL.setProtocolLAngleLoc(ProtocolLAngleLoc);
1165 OTPTL.setProtocolRAngleLoc(ProtocolRAngleLoc);
1166 for (
unsigned i = 0, n = Protocols.size(); i != n; ++i)
1167 OTPTL.setProtocolLoc(i, ProtocolLocs[i]);
1177 if (ObjCObjectTL.getNumTypeArgs() > 0) {
1178 assert(ObjCObjectTL.getNumTypeArgs() == ActualTypeArgInfos.size());
1180 ObjCObjectTL.setTypeArgsRAngleLoc(TypeArgsRAngleLoc);
1181 for (
unsigned i = 0, n = ActualTypeArgInfos.size(); i != n; ++i)
1182 ObjCObjectTL.setTypeArgTInfo(i, ActualTypeArgInfos[i]);
1189 if (ObjCObjectTL.getNumProtocols() > 0) {
1190 assert(ObjCObjectTL.getNumProtocols() == Protocols.size());
1191 ObjCObjectTL.setProtocolLAngleLoc(ProtocolLAngleLoc);
1192 ObjCObjectTL.setProtocolRAngleLoc(ProtocolRAngleLoc);
1193 for (
unsigned i = 0, n = Protocols.size(); i != n; ++i)
1194 ObjCObjectTL.setProtocolLoc(i, ProtocolLocs[i]);
1201 ObjCObjectTL.setHasBaseTypeAsWritten(
true);
1202 if (ObjCObjectTL.getType() == T)
1203 ObjCObjectTL.getBaseLoc().initializeFullCopy(BaseTypeInfo->
getTypeLoc());
1205 ObjCObjectTL.getBaseLoc().initialize(
Context, Loc);
1217 if (Attr.
getKind() == AttributeList::AT_OpenCLAccess) {
1218 return static_cast<OpenCLAccessAttr::Spelling
>(
1223 return OpenCLAccessAttr::Keyword_read_only;
1236 Sema &S = state.getSema();
1237 Declarator &declarator = state.getDeclarator();
1257 "Unknown TSS value");
1271 "Unknown TSS value");
1280 "Unknown TSS value");
1285 "Unknown TSS value");
1316 S.
Diag(DeclLoc, diag::ext_missing_declspec)
1326 S.
Diag(DeclLoc, diag::err_missing_type_specifier)
1334 S.
Diag(DeclLoc, diag::err_missing_actual_pipe_type)
1338 S.
Diag(DeclLoc, diag::ext_missing_type_specifier)
1358 diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1377 diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
1415 Result = Context.
IntTy;
1426 Result = Context.
IntTy;
1449 "Can't handle qualifiers on typedef names yet!");
1451 if (Result.isNull()) {
1461 assert(!Result.isNull() &&
"Didn't get a type for typeof?");
1462 if (!Result->isDependentType())
1470 assert(E &&
"Didn't get an expression for typeof?");
1473 if (Result.isNull()) {
1474 Result = Context.
IntTy;
1481 assert(E &&
"Didn't get an expression for decltype?");
1484 if (Result.isNull()) {
1485 Result = Context.
IntTy;
1492 assert(!Result.isNull() &&
"Didn't get a type for __underlying_type?");
1496 if (Result.isNull()) {
1497 Result = Context.
IntTy;
1521 assert(!Result.isNull() &&
"Didn't get a type for _Atomic?");
1523 if (Result.isNull()) {
1524 Result = Context.
IntTy;
1529 #define GENERIC_IMAGE_TYPE(ImgType, Id) \
1530 case DeclSpec::TST_##ImgType##_t: \
1531 switch (getImageAccess(DS.getAttributes().getList())) { \
1532 case OpenCLAccessAttr::Keyword_write_only: \
1533 Result = Context.Id##WOTy; break; \
1534 case OpenCLAccessAttr::Keyword_read_write: \
1535 Result = Context.Id##RWTy; break; \
1536 case OpenCLAccessAttr::Keyword_read_only: \
1537 Result = Context.Id##ROTy; break; \
1540 #include "clang/Basic/OpenCLImageTypes.def"
1543 Result = Context.
IntTy;
1550 declarator.setInvalidType(
true);
1559 assert(typeSize > 0 &&
"type size for vector must be greater than 0 bits");
1594 if (TypeQuals &&
Result->isFunctionType()) {
1598 ? diag::warn_typecheck_function_qualifiers_ignored
1599 : diag::warn_typecheck_function_qualifiers_unspecified);
1612 if (TypeQuals &&
Result->isReferenceType()) {
1614 S, DS, TypeQuals, Result,
1616 diag::warn_typecheck_reference_qualifiers);
1623 && TypeQuals &
Result.getCVRQualifiers()) {
1642 declarator.setInvalidType(
true);
1647 assert(!
Result.isNull() &&
"This function should not return a null type");
1672 unsigned DiagID = 0;
1688 DiagID = diag::err_typecheck_invalid_restrict_invalid_pointee;
1692 DiagID = diag::err_typecheck_invalid_restrict_not_pointer;
1706 unsigned CVRAU,
const DeclSpec *DS) {
1793 diag::err_arc_indirect_no_ownership, type, isReference));
1795 S.
Diag(loc, diag::err_arc_indirect_no_ownership) << type << isReference;
1799 assert(implicitLifetime &&
"didn't infer any lifetime!");
1853 S.
Diag(Loc, diag::err_compound_qualified_function_type)
1876 Diag(Loc, diag::err_illegal_decl_pointer_to_reference)
1882 Diag(Loc, diag::err_opencl_function_pointer);
1916 "Unresolved overloaded function type");
1944 Diag(Loc, diag::err_reference_to_void);
1998 S.
Diag(Loc, diag::ext_vla_folded_to_constant) << SR;
2023 Expr *ArraySize,
unsigned Quals,
2040 Diag(Loc, diag::err_illegal_decl_array_of_references)
2046 Diag(Loc, diag::err_illegal_decl_array_incomplete_type) << T;
2051 diag::err_array_of_abstract_type))
2058 if (!MPTy->getClass()->isDependentType())
2065 diag::err_illegal_decl_array_incomplete_type))
2070 Diag(Loc, diag::err_illegal_decl_array_of_functions)
2078 if (EltTy->getDecl()->hasFlexibleArrayMember())
2079 Diag(Loc, diag::ext_flexible_array_in_array) << T;
2081 Diag(Loc, diag::err_objc_array_of_interfaces) << T;
2089 ArraySize = Result.
get();
2093 if (ArraySize && !ArraySize->
isRValue()) {
2098 ArraySize = Result.
get();
2138 if (ConstVal.isSigned() && ConstVal.isNegative()) {
2143 Diag(ArraySize->
getLocStart(), diag::err_typecheck_negative_array_size)
2147 if (ConstVal == 0) {
2152 : diag::ext_typecheck_zero_array_size)
2157 diag::warn_typecheck_zero_static_array_size)
2164 unsigned ActiveSizeBits
2168 << ConstVal.toString(10)
2179 Diag(Loc, diag::err_opencl_vla);
2191 Diag(Loc, diag::err_vla_in_sfinae);
2196 Diag(Loc, diag::ext_vla);
2200 : diag::ext_c99_array_usage) << ASM;
2205 Diag(Loc, diag::warn_vla_used);
2215 Diag(Loc, diag::err_opencl_invalid_type_array) << ArrType;
2238 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T;
2243 llvm::APSInt vecSize(32);
2245 Diag(AttrLoc, diag::err_attribute_argument_type)
2253 unsigned vectorSize =
static_cast<unsigned>(vecSize.getZExtValue());
2255 if (vectorSize == 0) {
2256 Diag(AttrLoc, diag::err_attribute_zero_size)
2262 Diag(AttrLoc, diag::err_attribute_size_too_large)
2275 Diag(Loc, diag::err_func_returning_array_function)
2282 Diag(Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 1 <<
2290 Diag(Loc, diag::err_object_cannot_be_passed_returned_by_value)
2306 bool hasCheckedSwiftCall =
false;
2307 auto checkForSwiftCC = [&](
unsigned paramIndex) {
2309 if (hasCheckedSwiftCall)
return;
2310 hasCheckedSwiftCall =
true;
2312 S.
Diag(getParamLoc(paramIndex), diag::err_swift_param_attr_not_swiftcall)
2316 for (
size_t paramIndex = 0, numParams = paramTypes.size();
2317 paramIndex != numParams; ++paramIndex) {
2326 checkForSwiftCC(paramIndex);
2327 if (paramIndex != 0 &&
2330 S.
Diag(getParamLoc(paramIndex),
2331 diag::err_swift_indirect_result_not_first);
2336 checkForSwiftCC(paramIndex);
2341 checkForSwiftCC(paramIndex);
2342 if (paramIndex == 0 ||
2345 S.
Diag(getParamLoc(paramIndex),
2346 diag::err_swift_error_result_not_after_swift_context);
2350 llvm_unreachable(
"bad ABI kind");
2358 bool Invalid =
false;
2362 for (
unsigned Idx = 0, Cnt = ParamTypes.size(); Idx < Cnt; ++Idx) {
2366 Diag(Loc, diag::err_param_with_void_type);
2370 Diag(Loc, diag::err_parameters_retval_cannot_have_fp16_type) << 0 <<
2375 ParamTypes[Idx] = ParamType;
2380 [=](
unsigned i) {
return Loc; });
2409 Diag(Loc, diag::err_distant_exception_spec);
2416 Diag(Loc, diag::err_illegal_decl_mempointer_to_reference)
2422 Diag(Loc, diag::err_illegal_decl_mempointer_to_void)
2428 Diag(Loc, diag::err_mempointer_in_nonclass_type) << Class;
2458 Diag(Loc, diag::err_nonfunction_block_type);
2471 if (TInfo) *TInfo =
nullptr;
2476 if (
const LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
2477 QT = LIT->getType();
2478 DI = LIT->getTypeSourceInfo();
2481 if (TInfo) *TInfo = DI;
2487 unsigned chunkIndex);
2494 Sema &S = state.getSema();
2495 Declarator &declarator = state.getDeclarator();
2501 unsigned outermostPointerIndex = 0;
2503 unsigned numPointers = 0;
2505 unsigned chunkIndex = i;
2507 switch (chunk.
Kind) {
2517 outermostPointerIndex = chunkIndex;
2525 if (numPointers != 1)
return;
2527 outermostPointerIndex = chunkIndex;
2528 isBlockPointer =
true;
2545 if (numPointers == 1) {
2563 }
else if (numPointers == 2) {
2577 if (attr->getKind() == AttributeList::AT_ObjCOwnership)
2581 outermostPointerIndex);
2603 }
const QualKinds[5] = {
2612 unsigned NumQuals = 0;
2617 for (
auto &
E : QualKinds) {
2618 if (Quals &
E.Mask) {
2619 if (!QualStr.empty()) QualStr +=
' ';
2636 << QualStr << NumQuals << FixIts[0] << FixIts[1] << FixIts[2] << FixIts[3];
2642 unsigned FunctionChunkIndex) {
2652 for (
unsigned OuterChunkIndex = FunctionChunkIndex + 1,
2654 OuterChunkIndex !=
End; ++OuterChunkIndex) {
2656 switch (OuterChunk.
Kind) {
2663 diag::warn_qual_return_type,
2689 llvm_unreachable(
"unknown declarator chunk kind");
2712 Sema &SemaRef = state.getSema();
2715 ReturnTypeInfo =
nullptr;
2718 TagDecl *OwnedTagDecl =
nullptr;
2769 bool IsCXXAutoType =
2791 assert(LSI &&
"No LambdaScopeInfo on the stack!");
2803 TemplateParameterDepth, AutoParameterPosition,
2804 nullptr,
false, IsParameterPack);
2819 switch (cast<TagDecl>(SemaRef.
CurContext)->getTagKind()) {
2820 case TTK_Enum: llvm_unreachable(
"unhandled tag kind");
2822 case TTK_Union: Error = Cxx ? 3 : 4;
break;
2835 if (isa<DeducedTemplateSpecializationType>(Deduced))
2851 if (!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
2855 if (!SemaRef.
getLangOpts().CPlusPlus14 || !IsCXXAutoType)
2859 if (isa<DeducedTemplateSpecializationType>(Deduced))
2877 if (!IsCXXAutoType && !isa<DeducedTemplateSpecializationType>(Deduced))
2891 (!SemaRef.
getLangOpts().CPlusPlus11 || !IsCXXAutoType))
2894 bool HaveTrailing =
false;
2902 if (SemaRef.
getLangOpts().CPlusPlus11 && IsCXXAutoType &&
2904 HaveTrailing =
true;
2921 assert(isa<DeducedTemplateSpecializationType>(Deduced) &&
2922 "unknown auto type");
2929 SemaRef.
Diag(AutoRange.
getBegin(), diag::err_auto_not_allowed)
2931 <<
QualType(Deduced, 0) << AutoRange;
2932 if (
auto *TD = TN.getAsTemplateDecl())
2933 SemaRef.
Diag(TD->getLocation(), diag::note_template_decl_here);
2937 }
else if (!HaveTrailing) {
2941 diag::warn_cxx98_compat_auto_type_specifier)
2950 unsigned DiagID = 0;
2955 llvm_unreachable(
"parser should not have allowed this");
2971 DiagID = diag::err_type_defined_in_alias_template;
2981 DiagID = diag::err_type_defined_in_type_specifier;
2990 DiagID = diag::err_type_defined_in_param_type;
2996 DiagID = diag::err_type_defined_in_condition;
3007 assert(!T.
isNull() &&
"This function should not return a null type");
3016 assert(FTI.
isAmbiguous &&
"no direct-initializer / function ambiguity");
3047 FTI.
NumParams ? diag::warn_parens_disambiguated_as_function_declaration
3048 : diag::warn_empty_parens_are_function_decl)
3059 if (
Comma.getFileID() !=
Name.getFileID() ||
3060 Comma.getSpellingLineNumber() !=
Name.getSpellingLineNumber()) {
3079 S.
Diag(B, diag::note_additional_parens_for_variable_declaration)
3094 S.
Diag(DeclType.
Loc, diag::note_empty_parens_default_ctor)
3099 if (Init.empty() && S.
LangOpts.CPlusPlus11)
3102 S.
Diag(DeclType.
Loc, diag::note_empty_parens_zero_initialize)
3115 unsigned ChunkIndex) {
3138 bool IsCXXInstanceMethod =
false;
3144 unsigned I = ChunkIndex;
3145 bool FoundNonParen =
false;
3146 while (I && !FoundNonParen) {
3149 FoundNonParen =
true;
3152 if (FoundNonParen) {
3155 IsCXXInstanceMethod =
3160 IsCXXInstanceMethod =
true;
3167 IsCXXInstanceMethod =
3175 IsCXXInstanceMethod);
3184 if (
Attr->
getKind() == AttributeList::AT_OpenCLKernel) {
3206 switch (nullability) {
3208 if (!Ident__Nonnull)
3210 return Ident__Nonnull;
3213 if (!Ident__Nullable)
3215 return Ident__Nullable;
3218 if (!Ident__Null_unspecified)
3220 return Ident__Null_unspecified;
3222 llvm_unreachable(
"Unknown nullability kind.");
3230 return Ident_NSError;
3238 if (attr->getKind() == AttributeList::AT_TypeNonNull ||
3239 attr->getKind() == AttributeList::AT_TypeNullable ||
3240 attr->getKind() == AttributeList::AT_TypeNullUnspecified)
3257 MaybePointerToCFRef,
3261 NSErrorPointerPointer,
3284 unsigned numNormalPointers = 0;
3288 return PointerDeclaratorKind::NonPointer;
3293 switch (chunk.
Kind) {
3295 if (numNormalPointers == 0)
3296 wrappingKind = PointerWrappingDeclaratorKind::Array;
3305 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3306 : PointerDeclaratorKind::SingleLevelPointer;
3312 if (numNormalPointers == 0)
3313 wrappingKind = PointerWrappingDeclaratorKind::Reference;
3317 ++numNormalPointers;
3318 if (numNormalPointers > 2)
3319 return PointerDeclaratorKind::MultiLevelPointer;
3325 unsigned numTypeSpecifierPointers = 0;
3329 ++numNormalPointers;
3331 if (numNormalPointers > 2)
3332 return PointerDeclaratorKind::MultiLevelPointer;
3335 ++numTypeSpecifierPointers;
3341 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3342 : PointerDeclaratorKind::SingleLevelPointer;
3347 return numNormalPointers > 0 ? PointerDeclaratorKind::MultiLevelPointer
3348 : PointerDeclaratorKind::SingleLevelPointer;
3353 ++numNormalPointers;
3354 ++numTypeSpecifierPointers;
3357 if (
auto objcClassDecl = objcObjectPtr->getInterfaceDecl()) {
3359 numNormalPointers == 2 && numTypeSpecifierPointers < 2) {
3360 return PointerDeclaratorKind::NSErrorPointerPointer;
3369 if (objcClass->getInterface()->getIdentifier() == S.
getNSErrorIdent()) {
3370 if (numNormalPointers == 2 && numTypeSpecifierPointers < 2)
3371 return PointerDeclaratorKind::NSErrorPointerPointer;
3378 if (numNormalPointers == 0)
3379 return PointerDeclaratorKind::NonPointer;
3384 bool isCFError =
false;
3392 if (
auto bridgeAttr = recordDecl->
getAttr<ObjCBridgeAttr>()) {
3402 if (isCFError && numNormalPointers == 2 && numTypeSpecifierPointers < 2) {
3403 return PointerDeclaratorKind::CFErrorRefPointer;
3411 switch (numNormalPointers) {
3413 return PointerDeclaratorKind::NonPointer;
3416 return PointerDeclaratorKind::SingleLevelPointer;
3419 return PointerDeclaratorKind::MaybePointerToCFRef;
3422 return PointerDeclaratorKind::MultiLevelPointer;
3431 if (ctx->isFunctionOrMethod())
3434 if (ctx->isFileContext())
3445 bool invalid =
false;
3447 if (invalid || !sloc.
isFile())
3473 if (!FixItLoc.
isValid() || FixItLoc == PointerLoc)
3482 InsertionTextBuf +=
" ";
3483 StringRef InsertionText = InsertionTextBuf.str();
3486 InsertionText = InsertionText.drop_back();
3487 }
else if (NextChar[-1] ==
'[') {
3488 if (NextChar[0] ==
']')
3489 InsertionText = InsertionText.drop_back().drop_front();
3491 InsertionText = InsertionText.drop_front();
3494 InsertionText = InsertionText.drop_back().drop_front();
3505 if (PointerKind == SimplePointerKind::Array) {
3506 S.
Diag(PointerLoc, diag::warn_nullability_missing_array);
3508 S.
Diag(PointerLoc, diag::warn_nullability_missing)
3509 <<
static_cast<unsigned>(PointerKind);
3516 auto Diag = S.
Diag(PointerLoc, diag::note_nullability_fix_it);
3518 Diag << static_cast<unsigned>(PointerKind);
3546 if (pointerKind == SimplePointerKind::Array)
3547 diagKind = diag::warn_nullability_missing_array;
3549 diagKind = diag::warn_nullability_missing;
3554 fileNullability.
PointerKind =
static_cast<unsigned>(pointerKind);
3600 unsigned i = endIndex;
3630 Sema &S = state.getSema();
3640 bool IsTypedefName =
3656 bool IsClassTemplateDeduction = isa<DeducedTemplateSpecializationType>(DT);
3659 unsigned Index =
E -
I - 1;
3661 unsigned DiagId = IsClassTemplateDeduction
3662 ? diag::err_deduced_class_template_compound_type
3663 : diag::err_decltype_auto_compound_type;
3664 unsigned DiagKind = 0;
3665 switch (DeclChunk.
Kind) {
3668 if (IsClassTemplateDeduction) {
3674 if (IsClassTemplateDeduction) {
3682 DiagId = diag::err_decltype_auto_function_declarator_not_declaration;
3700 S.
Diag(DeclChunk.
Loc, DiagId) << DiagKind;
3709 bool inferNullabilityCS =
false;
3710 bool inferNullabilityInnerOnly =
false;
3711 bool inferNullabilityInnerOnlyComplete =
false;
3714 bool inAssumeNonNullRegion =
false;
3716 if (assumeNonNullLoc.
isValid()) {
3717 inAssumeNonNullRegion =
true;
3731 } complainAboutMissingNullability = CAMN_No;
3732 unsigned NumPointersRemaining = 0;
3735 if (IsTypedefName) {
3739 complainAboutMissingNullability = CAMN_InnerPointers;
3744 ++NumPointersRemaining;
3749 switch (chunk.
Kind) {
3757 ++NumPointersRemaining;
3765 ++NumPointersRemaining;
3771 switch (
auto context = state.getDeclarator().getContext()) {
3776 isFunctionOrMethod =
true;
3781 complainAboutMissingNullability = CAMN_No;
3786 if (state.getDeclarator().isObjCWeakProperty() && inAssumeNonNullRegion) {
3795 complainAboutMissingNullability = CAMN_Yes;
3800 case PointerDeclaratorKind::NonPointer:
3801 case PointerDeclaratorKind::MultiLevelPointer:
3805 case PointerDeclaratorKind::SingleLevelPointer:
3807 if (inAssumeNonNullRegion) {
3808 complainAboutInferringWithinChunk = wrappingKind;
3815 case PointerDeclaratorKind::CFErrorRefPointer:
3816 case PointerDeclaratorKind::NSErrorPointerPointer:
3819 if (isFunctionOrMethod && inAssumeNonNullRegion)
3823 case PointerDeclaratorKind::MaybePointerToCFRef:
3824 if (isFunctionOrMethod) {
3828 auto hasCFReturnsAttr = [](
const AttributeList *NextAttr) ->
bool {
3830 if (NextAttr->getKind() == AttributeList::AT_CFReturnsRetained ||
3831 NextAttr->getKind() == AttributeList::AT_CFReturnsNotRetained)
3833 NextAttr = NextAttr->getNext();
3839 hasCFReturnsAttr(InnermostChunk->getAttrs()) ||
3842 inferNullabilityInnerOnly =
true;
3852 complainAboutMissingNullability = CAMN_Yes;
3877 auto isVaList = [&
S](
QualType T) ->
bool {
3883 if (typedefTy->getDecl() == vaListTypedef)
3885 if (
auto *name = typedefTy->getDecl()->getIdentifier())
3886 if (name->isStr(
"va_list"))
3888 typedefTy = typedefTy->desugar()->getAs<
TypedefType>();
3889 }
while (typedefTy);
3899 if (NumPointersRemaining > 0)
3900 --NumPointersRemaining;
3907 if (inferNullability && !inferNullabilityInnerOnlyComplete) {
3911 AttributeList *nullabilityAttr = state.getDeclarator().getAttributePool()
3917 nullptr, 0, syntax);
3921 if (inferNullabilityCS) {
3922 state.getDeclarator().getMutableDeclSpec().getObjCQualifiers()
3926 if (pointerLoc.isValid() &&
3927 complainAboutInferringWithinChunk !=
3930 S.
Diag(pointerLoc, diag::warn_nullability_inferred_on_nested_type);
3931 Diag << static_cast<int>(complainAboutInferringWithinChunk);
3935 if (inferNullabilityInnerOnly)
3936 inferNullabilityInnerOnlyComplete =
true;
3937 return nullabilityAttr;
3942 switch (complainAboutMissingNullability) {
3946 case CAMN_InnerPointers:
3947 if (NumPointersRemaining == 0)
3964 if (NumPointersRemaining > 0)
3965 --NumPointersRemaining;
3969 pointerKind = SimplePointerKind::BlockPointer;
3971 pointerKind = SimplePointerKind::MemberPointer;
3973 if (
auto *attr = inferPointerNullability(
3978 attr->setUsedAsTypeAttr();
3983 if (complainAboutMissingNullability == CAMN_Yes &&
3996 unsigned chunkIndex = e - i - 1;
3997 state.setCurrentChunkIndex(chunkIndex);
4000 switch (DeclType.
Kind) {
4006 if (!LangOpts.Blocks)
4007 S.
Diag(DeclType.
Loc, diag::err_blocks_disable) << LangOpts.OpenCL;
4010 inferPointerNullability(SimplePointerKind::BlockPointer,
4017 if (LangOpts.OpenCL)
4032 inferPointerNullability(SimplePointerKind::Pointer, DeclType.
Loc,
4045 if (LangOpts.OpenCL) {
4046 if (T->isImageType() || T->isSamplerT() || T->isPipeType() ||
4047 T->isBlockPointerType()) {
4092 S.
Diag(DeclType.
Loc, diag::err_array_star_outside_prototype);
4103 S.
Diag(DeclType.
Loc, diag::err_array_static_outside_prototype) <<
4115 S.
Diag(DeclType.
Loc, diag::err_array_static_not_outermost) <<
4129 S.
Diag(DeclType.
Loc, diag::err_illegal_decl_array_of_auto)
4137 if (complainAboutMissingNullability == CAMN_Yes &&
4166 ? diag::err_auto_missing_trailing_return
4167 : diag::err_deduced_return_type);
4172 if (isa<ParenType>(T)) {
4174 diag::err_trailing_return_in_parens)
4181 diag::err_deduction_guide_with_complex_decl)
4186 (T.hasQualifiers() || !isa<AutoType>(T) ||
4187 cast<AutoType>(T)->getKeyword() !=
4190 diag::err_trailing_return_without_auto)
4205 if (!D.
isInvalidType() && (T->isArrayType() || T->isFunctionType()) &&
4207 unsigned diagID = diag::err_func_returning_array_function;
4210 if (chunkIndex == 0 &&
4212 diagID = diag::err_block_returning_array_function;
4213 S.
Diag(DeclType.
Loc, diagID) << T->isFunctionType() << T;
4220 if (T->isHalfType()) {
4229 diag::err_parameters_retval_cannot_have_fp16_type) << 1;
4234 if (LangOpts.OpenCL) {
4237 if (T->isBlockPointerType() || T->isImageType() || T->isSamplerT() ||
4249 LangOpts.OpenCLVersion >= 120) ||
4258 if (T->isObjCObjectType()) {
4267 S.
Diag(DiagLoc, diag::err_object_cannot_be_passed_returned_by_value)
4285 if ((T.getCVRQualifiers() || T->isAtomicType()) &&
4287 (T->isDependentType() || T->isRecordType()))) {
4288 if (T->isVoidType() && !S.
getLangOpts().CPlusPlus &&
4293 S.
Diag(DeclType.
Loc, diag::err_func_returning_qualified_void) << T;
4301 if (T.getQualifiers().hasObjCLifetime()) {
4307 if (
Attr->
getKind() == AttributeList::AT_ObjCOwnership) {
4308 AttrLoc =
Attr->getLoc();
4317 if (
Attr->
getKind() == AttributeList::AT_ObjCOwnership) {
4318 AttrLoc =
Attr->getLoc();
4331 S.
Diag(AttrLoc, diag::warn_arc_lifetime_result_type)
4332 << T.getQualifiers().getObjCLifetime();
4348 diag::err_exception_spec_in_typedef)
4367 bool Overloadable =
false;
4369 Attrs; Attrs = Attrs->
getNext()) {
4370 if (Attrs->getKind() == AttributeList::AT_Overloadable) {
4371 Overloadable =
true;
4384 diag::err_ident_list_in_fn_declaration);
4407 bool HasAnyInterestingExtParameterInfos =
false;
4409 for (
unsigned i = 0, e = FTI.
NumParams; i != e; ++i) {
4412 assert(!ParamTy.isNull() &&
"Couldn't parse type?");
4417 if (ParamTy->isVoidType()) {
4422 S.
Diag(DeclType.
Loc, diag::err_void_only_param);
4423 ParamTy = Context.
IntTy;
4428 ParamTy = Context.
IntTy;
4432 if (ParamTy.hasQualifiers())
4433 S.
Diag(DeclType.
Loc, diag::err_void_param_qualified);
4438 }
else if (ParamTy->isHalfType()) {
4444 diag::err_opencl_half_param) << ParamTy;
4450 diag::err_parameters_retval_cannot_have_fp16_type) << 0;
4454 if (ParamTy->isPromotableIntegerType()) {
4458 if (BTy->getKind() == BuiltinType::Float) {
4465 if (LangOpts.ObjCAutoRefCount && Param->
hasAttr<NSConsumedAttr>()) {
4466 ExtParameterInfos[i] = ExtParameterInfos[i].withIsConsumed(
true);
4467 HasAnyInterestingExtParameterInfos =
true;
4471 ExtParameterInfos[i] =
4472 ExtParameterInfos[i].withABI(attr->getABI());
4473 HasAnyInterestingExtParameterInfos =
true;
4476 if (Param->
hasAttr<PassObjectSizeAttr>()) {
4477 ExtParameterInfos[i] = ExtParameterInfos[i].withHasPassObjectSize();
4478 HasAnyInterestingExtParameterInfos =
true;
4481 ParamTys.push_back(ParamTy);
4484 if (HasAnyInterestingExtParameterInfos) {
4493 Expr *NoexceptExpr =
nullptr;
4499 DynamicExceptions.reserve(N);
4500 DynamicExceptionRanges.reserve(N);
4501 for (
unsigned I = 0;
I != N; ++
I) {
4512 DynamicExceptionRanges,
4527 inferPointerNullability(SimplePointerKind::MemberPointer,
4547 llvm_unreachable(
"Nested-name-specifier must name a type");
4557 if (NNSPrefix && isa<TemplateSpecializationType>(NNS->
getAsType()))
4563 diag::err_illegal_decl_mempointer_in_nonclass)
4596 const_cast<AttributeList *>(DeclType.
getAttrs()));
4608 bool IsBlock =
false;
4610 switch (DeclType.Kind) {
4617 S.
Diag(DeclType.Loc, diag::warn_strict_prototypes)
4629 assert(!T.
isNull() &&
"T must not be null after this point");
4633 assert(FnTy &&
"Why oh why is there not a FunctionProtoType here?");
4643 enum { NonMember, Member, DeductionGuide }
Kind = NonMember;
4645 Kind = DeductionGuide;
4673 if (IsQualifiedFunction &&
4693 if (!RemovalLocs.empty()) {
4694 std::sort(RemovalLocs.begin(), RemovalLocs.end(),
4696 RemovalRange =
SourceRange(RemovalLocs.front(), RemovalLocs.back());
4697 Loc = RemovalLocs.front();
4701 S.
Diag(Loc, diag::err_invalid_qualified_function_type)
4726 state.diagnoseIgnoredTypeAttrs(T);
4756 diag::err_function_parameter_pack_without_parameter_packs)
4776 LangOpts.CPlusPlus11
4777 ? diag::warn_cxx98_compat_variadic_templates
4778 : diag::ext_variadic_templates);
4805 diag::err_ellipsis_in_declarator_not_parameter);
4811 assert(!T.
isNull() &&
"T must not be null at the end of this function");
4827 TypeProcessingState
state(*
this, D);
4851 unsigned chunkIndex) {
4852 Sema &S = state.getSema();
4859 if (attr->getKind() == AttributeList::AT_ObjCOwnership)
4862 const char *attrStr =
nullptr;
4863 switch (ownership) {
4892 Sema &S = state.getSema();
4896 bool hasIndirection =
false;
4899 switch (chunk.
Kind) {
4908 hasIndirection =
true;
4941 TypeProcessingState
state(*
this, D);
4959 return AttributeList::AT_AddressSpace;
4961 return AttributeList::AT_Regparm;
4963 return AttributeList::AT_VectorSize;
4965 return AttributeList::AT_NeonVectorType;
4967 return AttributeList::AT_NeonPolyVectorType;
4969 return AttributeList::AT_ObjCGC;
4972 return AttributeList::AT_ObjCOwnership;
4974 return AttributeList::AT_NoReturn;
4976 return AttributeList::AT_CDecl;
4978 return AttributeList::AT_FastCall;
4980 return AttributeList::AT_StdCall;
4982 return AttributeList::AT_ThisCall;
4984 return AttributeList::AT_RegCall;
4986 return AttributeList::AT_Pascal;
4988 return AttributeList::AT_SwiftCall;
4990 return AttributeList::AT_VectorCall;
4993 return AttributeList::AT_Pcs;
4995 return AttributeList::AT_IntelOclBicc;
4997 return AttributeList::AT_MSABI;
4999 return AttributeList::AT_SysVABI;
5001 return AttributeList::AT_PreserveMost;
5003 return AttributeList::AT_PreserveAll;
5005 return AttributeList::AT_Ptr32;
5007 return AttributeList::AT_Ptr64;
5009 return AttributeList::AT_SPtr;
5011 return AttributeList::AT_UPtr;
5013 return AttributeList::AT_TypeNonNull;
5015 return AttributeList::AT_TypeNullable;
5017 return AttributeList::AT_TypeNullUnspecified;
5019 return AttributeList::AT_ObjCKindOf;
5021 return AttributeList::AT_NSReturnsRetained;
5023 llvm_unreachable(
"unexpected attribute kind!");
5030 assert((attrs || DeclAttrs) &&
5031 "no type attributes in the expected location!");
5035 while (attrs && attrs->
getKind() != parsedKind)
5040 while (DeclAttrs && (!DeclAttrs->isCXX11Attribute() ||
5041 DeclAttrs->getKind() != parsedKind))
5042 DeclAttrs = DeclAttrs->
getNext();
5046 assert(attrs &&
"no matching type attribute in expected location!");
5048 TL.setAttrNameLoc(attrs->
getLoc());
5050 assert(attrs->
isArgExpr(0) &&
"mismatched attribute operand kind");
5054 "unexpected attribute operand kind");
5067 class TypeSpecLocFiller :
public TypeLocVisitor<TypeSpecLocFiller> {
5073 : Context(Context), DS(DS) {}
5077 Visit(TL.getModifiedLoc());
5187 void VisitDependentTemplateSpecializationTypeLoc(
5226 void VisitTypeLoc(
TypeLoc TL) {
5232 class DeclaratorLocFiller :
public TypeLocVisitor<DeclaratorLocFiller> {
5238 : Context(Context), Chunk(Chunk) {}
5241 llvm_unreachable(
"qualified type locs not expected here!");
5244 llvm_unreachable(
"decayed type locs not expected here!");
5277 assert(isa<DependentNameType>(ClsTy) &&
"Unexpected TypeLoc");
5288 if (isa<ElaboratedType>(ClsTy)) {
5303 llvm_unreachable(
"Nested-name-specifier must name a type");
5318 assert(!Chunk.Ref.LValueRef);
5325 TL.
setSizeExpr(static_cast<Expr*>(Chunk.Arr.NumElts));
5335 for (
unsigned i = 0, e = TL.
getNumParams(), tpi = 0; i != e; ++i) {
5351 void VisitTypeLoc(
TypeLoc TL) {
5352 llvm_unreachable(
"unsupported TypeLoc kind in declarator!");
5359 switch (Chunk.
Kind) {
5364 llvm_unreachable(
"cannot be _Atomic qualified");
5397 if (isa<PackExpansionType>(T)) {
5425 if (ReturnTypeInfo) {
5445 "LocInfoType's TypeClass conflicts with an existing Type class");
5451 llvm_unreachable(
"LocInfoType leaked into the type system; an opaque TypeTy*"
5452 " was used directly instead of getting the QualType through"
5453 " GetTypeFromParser");
5460 "Type name should have no identifier!");
5505 S.
Diag(Attr.
getLoc(), diag::err_attribute_address_multiple_qualifiers);
5513 S.
Diag(Attr.
getLoc(), diag::err_attribute_address_function_type);
5519 if (Attr.
getKind() == AttributeList::AT_AddressSpace) {
5522 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
5528 llvm::APSInt addrSpace(32);
5531 S.
Diag(Attr.
getLoc(), diag::err_attribute_argument_type)
5539 if (addrSpace.isSigned()) {
5540 if (addrSpace.isNegative()) {
5541 S.
Diag(Attr.
getLoc(), diag::err_attribute_address_space_negative)
5546 addrSpace.setIsSigned(
false);
5548 llvm::APSInt
max(addrSpace.getBitWidth());
5550 if (addrSpace > max) {
5551 S.
Diag(Attr.
getLoc(), diag::err_attribute_address_space_too_high)
5556 ASIdx =
static_cast<unsigned>(addrSpace.getZExtValue()) +
5557 LangAS::FirstTargetAddressSpace;
5561 case AttributeList::AT_OpenCLGlobalAddressSpace:
5563 case AttributeList::AT_OpenCLLocalAddressSpace:
5565 case AttributeList::AT_OpenCLConstantAddressSpace:
5567 case AttributeList::AT_OpenCLGenericAddressSpace:
5570 assert(Attr.
getKind() == AttributeList::AT_OpenCLPrivateAddressSpace);
5587 if (
const AttributedType *attr = dyn_cast<AttributedType>(type)) {
5591 type = attr->getModifiedType();
5594 }
else if (
const ParenType *paren = dyn_cast<ParenType>(type)) {
5595 type = paren->getInnerType();
5615 bool NonObjCPointer =
false;
5625 NonObjCPointer =
true;
5632 if (state.isProcessingDeclSpec()) {
5640 Sema &S = state.getSema();
5646 S.
Diag(AttrLoc, diag::err_attribute_argument_type)
5654 if (II->
isStr(
"none"))
5656 else if (II->
isStr(
"strong"))
5658 else if (II->
isStr(
"weak"))
5660 else if (II->
isStr(
"autoreleasing"))
5663 S.
Diag(AttrLoc, diag::warn_attribute_type_not_supported)
5684 S.
Diag(AttrLoc, diag::err_attr_objc_ownership_redundant)
5691 if (previousLifetime != lifetime) {
5694 const Type *prevTy =
nullptr;
5695 while (!prevTy || prevTy != underlyingType.
Ty) {
5696 prevTy = underlyingType.
Ty;
5705 if (NonObjCPointer) {
5715 S.
Diag(AttrLoc, diag::warn_type_attribute_wrong_type) << name
5739 if (!NonObjCPointer)
5754 diagnostic,
type, 0));
5756 S.
Diag(loc, diagnostic);
5765 unsigned diagnostic =
5766 (S.
getLangOpts().ObjCWeakRuntime ? diag::err_arc_weak_disabled
5767 : diag::err_arc_weak_no_runtime);
5770 diagnoseOrDelay(S, AttrLoc, diagnostic, type);
5782 if (Class->isArcWeakrefUnavailable()) {
5783 S.
Diag(AttrLoc, diag::err_arc_unsupported_weak_class);
5784 S.
Diag(ObjT->getInterfaceDecl()->getLocation(),
5785 diag::note_class_declared);
5801 Sema &S = state.getSema();
5810 S.
Diag(attr.
getLoc(), diag::err_attribute_multiple_objc_gc);
5817 S.
Diag(attr.
getLoc(), diag::err_attribute_argument_type)
5824 S.
Diag(attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
5831 if (II->
isStr(
"weak"))
5833 else if (II->
isStr(
"strong"))
5836 S.
Diag(attr.
getLoc(), diag::warn_attribute_type_not_supported)
5864 struct FunctionTypeUnwrapper {
5879 FunctionTypeUnwrapper(
Sema &S,
QualType T) : Original(T) {
5882 if (isa<FunctionType>(Ty)) {
5883 Fn = cast<FunctionType>(Ty);
5885 }
else if (isa<ParenType>(Ty)) {
5886 T = cast<ParenType>(Ty)->getInnerType();
5887 Stack.push_back(Parens);
5888 }
else if (isa<PointerType>(Ty)) {
5889 T = cast<PointerType>(Ty)->getPointeeType();
5890 Stack.push_back(Pointer);
5891 }
else if (isa<BlockPointerType>(Ty)) {
5892 T = cast<BlockPointerType>(Ty)->getPointeeType();
5893 Stack.push_back(BlockPointer);
5894 }
else if (isa<MemberPointerType>(Ty)) {
5895 T = cast<MemberPointerType>(Ty)->getPointeeType();
5896 Stack.push_back(MemberPointer);
5897 }
else if (isa<ReferenceType>(Ty)) {
5898 T = cast<ReferenceType>(Ty)->getPointeeType();
5899 Stack.push_back(Reference);
5900 }
else if (isa<AttributedType>(Ty)) {
5901 T = cast<AttributedType>(Ty)->getEquivalentType();
5902 Stack.push_back(Attributed);
5916 bool isFunctionType()
const {
return (Fn !=
nullptr); }
5921 if (New ==
get())
return Original;
5924 return wrap(S.
Context, Original, 0);
5929 if (I ==
Stack.size())
5938 return wrap(C, SplitOld.
Ty, I);
5945 switch (static_cast<WrapKind>(
Stack[I++])) {
5952 return wrap(C, cast<AttributedType>(Old)->getEquivalentType(), I);
5955 QualType New = wrap(C, cast<ParenType>(Old)->getInnerType(), I);
5960 QualType New = wrap(C, cast<PointerType>(Old)->getPointeeType(), I);
5964 case BlockPointer: {
5965 QualType New = wrap(C, cast<BlockPointerType>(Old)->getPointeeType(),I);
5969 case MemberPointer: {
5978 if (isa<LValueReferenceType>(OldRef))
5985 llvm_unreachable(
"unknown wrapping kind");
5993 Sema &S = State.getSema();
6004 S.
Diag(Attr.
getLoc(), diag::warn_duplicate_attribute_exact)
6012 Kind == AttributeList::AT_Ptr64) ||
6014 Kind == AttributeList::AT_Ptr32)) {
6015 S.
Diag(Attr.
getLoc(), diag::err_attributes_are_not_compatible)
6016 <<
"'__ptr32'" <<
"'__ptr64'";
6019 Kind == AttributeList::AT_UPtr) ||
6021 Kind == AttributeList::AT_SPtr)) {
6022 S.
Diag(Attr.
getLoc(), diag::err_attributes_are_not_compatible)
6023 <<
"'__sptr'" <<
"'__uptr'";
6033 if (!isa<PointerType>(Desugared)) {
6035 S.
Diag(Attr.
getLoc(), diag::err_attribute_no_member_pointers)
6038 S.
Diag(Attr.
getLoc(), diag::err_attribute_pointers_only)
6045 default: llvm_unreachable(
"Unknown attribute kind");
6059 bool isContextSensitive,
6060 bool allowOnArrayType) {
6065 while (
auto attributed = dyn_cast<AttributedType>(desugared.
getTypePtr())) {
6067 if (
auto existingNullability = attributed->getImmediateNullability()) {
6069 if (nullability == *existingNullability) {
6070 Diag(nullabilityLoc, diag::warn_nullability_duplicate)
6078 Diag(nullabilityLoc, diag::err_nullability_conflicting)
6084 desugared = attributed->getModifiedType();
6092 if (nullability != *existingNullability) {
6093 Diag(nullabilityLoc, diag::err_nullability_conflicting)
6101 if (
auto typedefNullability
6103 if (*typedefNullability == *existingNullability) {
6116 !(allowOnArrayType && desugared->
isArrayType())) {
6117 Diag(nullabilityLoc, diag::err_nullability_nonpointer)
6124 if (isContextSensitive) {
6126 const Type *pointeeType;
6135 Diag(nullabilityLoc, diag::err_nullability_cs_multilevel)
6138 Diag(nullabilityLoc, diag::note_nullability_type_specifier)
6154 if (isa<ObjCTypeParamType>(type)) {
6169 Diag(loc, diag::err_objc_kindof_nonobject)
6178 objType->getBaseType(), objType->getTypeArgsAsWritten(),
6179 objType->getProtocols(),
6180 objType->isObjCUnqualifiedId() ?
false :
true);
6202 case AttributeList::AT_TypeNonNull:
6205 case AttributeList::AT_TypeNullable:
6208 case AttributeList::AT_TypeNullUnspecified:
6212 llvm_unreachable(
"not a nullability attribute kind");
6225 Declarator &declarator = state.getDeclarator();
6228 auto moveToChunk = [&](
DeclaratorChunk &chunk,
bool inFunction) ->
bool {
6241 PK_MemberFunctionPointer,
6246 : inFunction? PK_MemberFunctionPointer : PK_MemberPointer;
6248 auto diag = state.getSema().Diag(attr.
getLoc(),
6249 diag::warn_nullability_declspec)
6253 << static_cast<unsigned>(pointerKind);
6259 state.getSema().getPreprocessor()
6260 .getLocForEndOfToken(chunk.
Loc),
6271 for (
unsigned i = state.getCurrentChunkIndex(); i != 0; --i) {
6273 switch (chunk.
Kind) {
6277 return moveToChunk(chunk,
false);
6289 return moveToChunk(*dest,
true);
6308 llvm_unreachable(
"not a calling convention attribute");
6309 case AttributeList::AT_CDecl:
6311 case AttributeList::AT_FastCall:
6313 case AttributeList::AT_StdCall:
6315 case AttributeList::AT_ThisCall:
6317 case AttributeList::AT_RegCall:
6319 case AttributeList::AT_Pascal:
6321 case AttributeList::AT_SwiftCall:
6323 case AttributeList::AT_VectorCall:
6325 case AttributeList::AT_Pcs: {
6331 Str = cast<StringLiteral>(Attr.
getArgAsExpr(0))->getString();
6334 return llvm::StringSwitch<AttributedType::Kind>(Str)
6338 case AttributeList::AT_IntelOclBicc:
6340 case AttributeList::AT_MSABI:
6342 case AttributeList::AT_SysVABI:
6344 case AttributeList::AT_PreserveMost:
6346 case AttributeList::AT_PreserveAll:
6349 llvm_unreachable(
"unexpected attribute kind!");
6357 Sema &S = state.getSema();
6359 FunctionTypeUnwrapper unwrapped(S, type);
6361 if (attr.
getKind() == AttributeList::AT_NoReturn) {
6366 if (!unwrapped.isFunctionType())
6377 if (attr.
getKind() == AttributeList::AT_NSReturnsRetained) {
6381 if (!unwrapped.isFunctionType())
6386 unwrapped.get()->getReturnType()))
6391 if (state.getSema().getLangOpts().ObjCAutoRefCount) {
6393 = unwrapped.get()->getExtInfo().withProducesResult(
true);
6401 if (attr.
getKind() == AttributeList::AT_AnyX86NoCallerSavedRegisters) {
6406 if (!unwrapped.isFunctionType())
6410 unwrapped.get()->getExtInfo().withNoCallerSavedRegs(
true);
6415 if (attr.
getKind() == AttributeList::AT_Regparm) {
6421 if (!unwrapped.isFunctionType())
6428 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
6436 unwrapped.get()->getExtInfo().withRegParm(value);
6442 if (!unwrapped.isFunctionType())
return false;
6458 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
6476 unsigned DiagID = diag::err_cconv_varargs;
6480 bool IsInvalid =
true;
6482 DiagID = diag::warn_cconv_varargs;
6494 S.
Diag(attr.
getLoc(), diag::err_attributes_are_not_compatible)
6507 auto EI = unwrapped.get()->getExtInfo().withCallingConv(CC);
6518 if (AT->isCallingConv())
6520 R = AT->getModifiedType().IgnoreParens();
6527 FunctionTypeUnwrapper Unwrapped(*
this, T);
6529 bool IsVariadic = (isa<FunctionProtoType>(FT) &&
6530 cast<FunctionProtoType>(FT)->isVariadic());
6543 Diag(Loc, diag::warn_cconv_structors)
6553 if (CurCC != DefaultCC || DefaultCC == ToCC)
6561 QualType Wrapped = Unwrapped.wrap(*
this, FT);
6576 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
6582 llvm::APSInt vecSize(32);
6585 S.
Diag(Attr.
getLoc(), diag::err_attribute_argument_type)
6595 S.
Diag(Attr.
getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
6601 unsigned vectorSize =
static_cast<unsigned>(vecSize.getZExtValue() * 8);
6604 if (vectorSize % typeSize) {
6605 S.
Diag(Attr.
getLoc(), diag::err_attribute_invalid_size)
6611 S.
Diag(Attr.
getLoc(), diag::err_attribute_size_too_large)
6616 if (vectorSize == 0) {
6617 S.
Diag(Attr.
getLoc(), diag::err_attribute_zero_size)
6636 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
6655 sizeExpr = Size.
get();
6676 bool IsPolyUnsigned = Triple.getArch() == llvm::Triple::aarch64 ||
6677 Triple.getArch() == llvm::Triple::aarch64_be;
6679 if (IsPolyUnsigned) {
6681 return BTy->
getKind() == BuiltinType::UChar ||
6682 BTy->
getKind() == BuiltinType::UShort ||
6683 BTy->
getKind() == BuiltinType::ULong ||
6684 BTy->
getKind() == BuiltinType::ULongLong;
6687 return BTy->
getKind() == BuiltinType::SChar ||
6688 BTy->
getKind() == BuiltinType::Short;
6694 bool Is64Bit = Triple.getArch() == llvm::Triple::aarch64 ||
6695 Triple.getArch() == llvm::Triple::aarch64_be;
6697 if (Is64Bit && BTy->
getKind() == BuiltinType::Double)
6700 return BTy->
getKind() == BuiltinType::SChar ||
6701 BTy->
getKind() == BuiltinType::UChar ||
6702 BTy->
getKind() == BuiltinType::Short ||
6703 BTy->
getKind() == BuiltinType::UShort ||
6704 BTy->
getKind() == BuiltinType::Int ||
6705 BTy->
getKind() == BuiltinType::UInt ||
6706 BTy->
getKind() == BuiltinType::Long ||
6707 BTy->
getKind() == BuiltinType::ULong ||
6708 BTy->
getKind() == BuiltinType::LongLong ||
6709 BTy->
getKind() == BuiltinType::ULongLong ||
6710 BTy->
getKind() == BuiltinType::Float ||
6711 BTy->
getKind() == BuiltinType::Half;
6732 S.
Diag(Attr.
getLoc(), diag::err_attribute_wrong_number_arguments)
6739 llvm::APSInt numEltsInt(32);
6742 S.
Diag(Attr.
getLoc(), diag::err_attribute_argument_type)
6750 S.
Diag(Attr.
getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
6757 unsigned numElts =
static_cast<unsigned>(numEltsInt.getZExtValue());
6758 unsigned vecSize = typeSize * numElts;
6759 if (vecSize != 64 && vecSize != 128) {
6760 S.
Diag(Attr.
getLoc(), diag::err_attribute_bad_neon_vector_size) << CurType;
6773 S.
Diag(Attr.
getLoc(), diag::err_opencl_invalid_access_qualifier);
6779 QualType PointeeTy = TypedefTy->desugar();
6780 S.
Diag(Attr.
getLoc(), diag::err_opencl_multiple_access_qualifiers);
6782 std::string PrevAccessQual;
6784 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
6785 case BuiltinType::Id: \
6786 PrevAccessQual = #Access; \
6788 #include "clang/Basic/OpenCLImageTypes.def"
6790 assert(0 &&
"Unable to find corresponding image type.");
6793 S.
Diag(TypedefTy->getDecl()->getLocStart(),
6794 diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
6810 bool hasOpenCLAddressSpace =
false;
6826 state.getSema().Diag(attr.
getLoc(),
6827 diag::warn_cxx11_gnu_attribute_on_type)
6844 state.getSema().Diag(attr.
getLoc(), diag::err_attribute_not_type_attr)
6852 state.getSema().Diag(attr.
getLoc(),
6853 diag::warn_unknown_attribute_ignored)
6860 case AttributeList::AT_MayAlias:
6865 case AttributeList::AT_OpenCLPrivateAddressSpace:
6866 case AttributeList::AT_OpenCLGlobalAddressSpace:
6867 case AttributeList::AT_OpenCLLocalAddressSpace:
6868 case AttributeList::AT_OpenCLConstantAddressSpace:
6869 case AttributeList::AT_OpenCLGenericAddressSpace:
6870 case AttributeList::AT_AddressSpace:
6873 hasOpenCLAddressSpace =
true;
6880 case AttributeList::AT_VectorSize:
6884 case AttributeList::AT_ExtVectorType:
6888 case AttributeList::AT_NeonVectorType:
6893 case AttributeList::AT_NeonPolyVectorType:
6898 case AttributeList::AT_OpenCLAccess:
6918 endIndex = state.getCurrentChunkIndex();
6920 endIndex = state.getDeclarator().getNumTypeObjects();
6921 bool allowOnArrayType =
6922 state.getDeclarator().isPrototypeContext() &&
6924 if (state.getSema().checkNullabilityTypeSpecifier(
6929 allowOnArrayType)) {
6937 case AttributeList::AT_ObjCKindOf:
6945 state.getSema().Diag(attr.
getLoc(),
6946 diag::err_objc_kindof_wrong_position)
6949 state.getDeclarator().getDeclSpec().getLocStart(),
"__kindof ");
6954 if (state.getSema().checkObjCKindOfType(type, attr.
getLoc()))
6983 if (state.getSema().getLangOpts().OpenCLVersion >= 200 &&
6987 if (state.getCurrentChunkIndex() > 0 &&
6992 type = state.getSema().Context.getAddrSpaceQualType(
6994 }
else if (state.getCurrentChunkIndex() == 0 &&
6999 type = state.getSema().Context.getAddrSpaceQualType(
7001 else if (state.getCurrentChunkIndex() == 0 &&
7004 type = state.getSema().Context.getAddrSpaceQualType(
7011 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
7016 Var->getMemberSpecializationInfo()) {
7018 if (MSInfo->getPointOfInstantiation().isInvalid()) {
7019 MSInfo->setPointOfInstantiation(PointOfInstantiation);
7024 L->StaticDataMemberInstantiated(Var);
7028 cast<VarTemplateSpecializationDecl>(Var);
7109 if (RequireCompleteTypeImpl(Loc, T, &Diagnoser))
7112 if (!Tag->getDecl()->isCompleteDefinitionRequired()) {
7113 Tag->getDecl()->setCompleteDefinitionRequired();
7144 bool OnlyNeedComplete) {
7151 if (isa<TagDecl>(D) && cast<TagDecl>(D)->isBeingDefined()) {
7155 }
else if (
auto *RD = dyn_cast<CXXRecordDecl>(D)) {
7156 if (
auto *Pattern = RD->getTemplateInstantiationPattern())
7158 D = RD->getDefinition();
7159 }
else if (
auto *ED = dyn_cast<EnumDecl>(D)) {
7160 if (
auto *Pattern = ED->getTemplateInstantiationPattern())
7162 if (OnlyNeedComplete && ED->isFixed()) {
7166 *Suggested =
nullptr;
7167 for (
auto *Redecl : ED->redecls()) {
7170 if (Redecl->isThisDeclarationADefinition() ||
7171 (Redecl->isCanonicalDecl() && !*Suggested))
7172 *Suggested = Redecl;
7176 D = ED->getDefinition();
7177 }
else if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
7178 if (
auto *Pattern = FD->getTemplateInstantiationPattern())
7180 D = FD->getDefinition();
7181 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
7182 if (
auto *Pattern = VD->getTemplateInstantiationPattern())
7184 D = VD->getDefinition();
7186 assert(D &&
"missing definition for pattern of instantiated definition");
7195 Source->CompleteRedeclChain(D);
7205 if (!RD->
hasAttr<MSInheritanceAttr>()) {
7206 MSInheritanceAttr::Spelling IM;
7213 IM = MSInheritanceAttr::Keyword_single_inheritance;
7216 IM = MSInheritanceAttr::Keyword_multiple_inheritance;
7219 IM = MSInheritanceAttr::Keyword_unspecified_inheritance;
7223 RD->
addAttr(MSInheritanceAttr::CreateImplicit(
7236 TypeDiagnoser *Diagnoser) {
7249 if (!MPTy->getClass()->isDependentType()) {
7261 if (Def && !isa<EnumDecl>(Def))
7276 return !TreatAsComplete;
7307 Source->CompleteType(Tag->
getDecl());
7309 Source->CompleteType(IFace->getDecl());
7314 return RequireCompleteTypeImpl(Loc, T, Diagnoser);
7324 MaybeTemplate = Array->getElementType();
7326 bool Instantiated =
false;
7327 bool Diagnosed =
false;
7329 = dyn_cast<ClassTemplateSpecializationDecl>(Record->getDecl())) {
7330 if (ClassTemplateSpec->getSpecializationKind() ==
TSK_Undeclared) {
7334 Instantiated =
true;
7337 = dyn_cast<CXXRecordDecl>(Record->getDecl())) {
7339 if (!Rec->isBeingDefined() && Pattern) {
7341 assert(MSI &&
"Missing member specialization information?");
7349 Instantiated =
true;
7357 if (Diagnoser && Diagnosed)
7363 return RequireCompleteTypeImpl(Loc, T, Diagnoser);
7373 Diagnoser->diagnose(*
this, Loc, T);
7380 : diag::note_forward_declaration)
7384 if (IFace && !IFace->getDecl()->isInvalidDecl())
7385 Diag(IFace->getDecl()->getLocation(), diag::note_forward_class);
7411 default: llvm_unreachable(
"Invalid tag kind for literal type diagnostic!");
7466 for (
const auto &I : RD->
vbases())
7467 Diag(I.getLocStart(), diag::note_constexpr_virtual_base_here)
7468 << I.getSourceRange();
7471 Diag(RD->
getLocation(), diag::note_non_literal_no_constexpr_ctors) << RD;
7473 for (
const auto &I : RD->
bases()) {
7474 if (!I.getType()->isLiteralType(
Context)) {
7475 Diag(I.getLocStart(),
7476 diag::note_non_literal_base_class)
7477 << RD << I.getType() << I.getSourceRange();
7481 for (
const auto *I : RD->
fields()) {
7482 if (!I->getType()->isLiteralType(
Context) ||
7483 I->getType().isVolatileQualified()) {
7484 Diag(I->getLocation(), diag::note_non_literal_field)
7485 << RD << I << I->getType()
7486 << I->getType().isVolatileQualified();
7494 assert(Dtor &&
"class has literal fields and bases but no dtor?");
7499 diag::note_non_literal_user_provided_dtor :
7500 diag::note_non_literal_nontrivial_dtor) << RD;
7536 Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield) << 2;
7563 if (
const ValueDecl *VD = dyn_cast<ValueDecl>(DRE->getDecl()))
7564 return VD->getType();
7565 }
else if (
const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
7566 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(ME->getMemberDecl()))
7567 return FD->getType();
7568 }
else if (
const ObjCIvarRefExpr *IR = dyn_cast<ObjCIvarRefExpr>(E)) {
7569 return IR->getDecl()->getType();
7571 if (PR->isExplicitProperty())
7572 return PR->getExplicitProperty()->getType();
7573 }
else if (
auto *PE = dyn_cast<PredefinedExpr>(E)) {
7574 return PE->getType();
7584 using namespace sema;
7586 if (isa<ParenExpr>(E)) {
7588 if (
VarDecl *Var = dyn_cast<VarDecl>(DRE->getDecl())) {
7616 bool AsUnevaluated) {
7625 Diag(E->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
7637 Diag(Loc, diag::err_only_enums_have_underlying_types);
7646 Diag(Loc, diag::err_underlying_type_of_incomplete_enum) << BaseType;
7647 Diag(FwdDecl->
getLocation(), diag::note_forward_declaration) << FwdDecl;
7652 assert(ED &&
"EnumType has no EnumDecl");
7657 assert(!Underlying.
isNull());
7663 llvm_unreachable(
"unknown unary transform type");
7673 int DisallowedKind = -1;
7688 if (DisallowedKind != -1) {
7689 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.
bool CheckNoCallerSavedRegsAttr(const AttributeList &attr)
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
static CallingConv getCCForDeclaratorChunk(Sema &S, Declarator &D, const DeclaratorChunk::FunctionTypeInfo &FTI, unsigned ChunkIndex)
Helper for figuring out the default CC for a function declarator type.
bool CheckNoReturnAttr(const AttributeList &attr)
unsigned getAddressSpace() const
Return the address space of this type.
static void HandleExtVectorTypeAttr(QualType &CurType, const AttributeList &Attr, Sema &S)
Process the OpenCL-like ext_vector_type attribute when it occurs on a type.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
Defines the clang::ASTContext interface.
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
SourceLocation getEnd() const
static bool handleObjCPointerTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType &type)
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
unsigned UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
const Type * Ty
The locally-unqualified type.
IdKind getKind() const
Determine what kind of name we have.
static unsigned getLiteralDiagFromTagKind(TagTypeKind Tag)
Get diagnostic select index for tag kind for literal type diagnostic message.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
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.
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.
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.
virtual bool hasFloat128Type() const
Determine whether the __float128 type is supported on this target.
PointerType - C99 6.7.5.1 - Pointer Declarators.
SourceLocation getRestrictSpecLoc() const
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
A (possibly-)qualified type.
const AttributeList * getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
void setStarLoc(SourceLocation Loc)
SourceLocation getConstSpecLoc() const
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.
Wrapper for source info for tag types.
ExtInfo withCallingConv(CallingConv cc) const
TSW getTypeSpecWidth() const
static void distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state, AttributeList &attr, QualType &declSpecType)
Distribute an objc_gc type attribute that was written on the declarator.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
static const TSS TSS_unsigned
bool isMemberPointerType() const
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
TheContext getContext() const
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
__auto_type (GNU extension)
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
void setNameEndLoc(SourceLocation Loc)
static const TST TST_wchar
static LLVM_READONLY bool isWhitespace(unsigned char c)
Return true if this character is horizontal or vertical ASCII whitespace: ' ', '\t', '\f', '\v', '\n', '\r'.
Decl * getRepAsDecl() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
#define CALLING_CONV_ATTRS_CASELIST
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
void setKWLoc(SourceLocation Loc)
The attribute is immediately after the declaration's name.
void setRParenLoc(SourceLocation Loc)
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration...
void setStarLoc(SourceLocation Loc)
NullabilityKind
Describes the nullability of a particular type.
void setExceptionSpecRange(SourceRange R)
FunctionType - C99 6.7.5.3 - Function Declarators.
TypeLoc getNamedTypeLoc() const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
void setEmbeddedInDeclarator(bool isInDeclarator)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
void addConst()
Add the const type qualifier to this QualType.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
A conversion function name, e.g., operator int.
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
bool isRecordType() const
static const TST TST_typeofExpr
QualType getUnderlyingType() 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 NullabilityKind mapNullabilityAttrKind(AttributeList::Kind kind)
Map a nullability attribute kind to a nullability kind.
const SrcMgr::SLocEntry & getSLocEntry(FileID FID, bool *Invalid=nullptr) const
const char * getCharacterData(SourceLocation SL, bool *Invalid=nullptr) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer...
bool isTypeAltiVecBool() const
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
AttributePool & getAttributePool() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
Defines the C++ template declaration subclasses.
static void processTypeAttrs(TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, AttributeList *attrs)
Represents a C++11 auto or C++14 decltype(auto) type.
bool hasAutoTypeSpec() const
bool isEnumeralType() const
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.
SCS getStorageClassSpec() const
bool hasDefinition() const
FunctionDefinitionKind getFunctionDefinitionKind() const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
QualType getPointeeType() const
The base class of the type hierarchy.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
One instance of this struct is used for each type in a declarator that is parsed. ...
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
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".
bool isDecltypeAuto() const
The attribute is part of a DeclaratorChunk.
bool isBooleanType() const
RefQualifierKind RefQualifier
A container of type source information.
static void diagnoseAndRemoveTypeQualifiers(Sema &S, const DeclSpec &DS, unsigned &TypeQuals, QualType TypeSoFar, unsigned RemoveTQs, unsigned DiagID)
static void transferARCOwnership(TypeProcessingState &state, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
Used for transferring ownership in casts resulting in l-values.
bool getHasRegParm() const
AttributeList *& getAttrListRef()
bool isBlockPointerType() const
Wrapper for source info for pointers decayed from arrays and functions.
bool hasAttrEnumOperand() const
Abstract base class used for diagnosing integer constant expression violations.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
TypeLoc getNextTypeLoc() const
bool isSpelledAsLValue() const
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
#define NULLABILITY_TYPE_ATTRS_CASELIST
unsigned RestrictQualLoc
The location of the restrict-qualifier, if any.
static AttributedType::Kind getCCTypeAttrKind(AttributeList &Attr)
bool checkObjCKindOfType(QualType &type, SourceLocation loc)
Check the application of the Objective-C '__kindof' qualifier to the given type.
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
void setParensRange(SourceRange range)
SourceLocation getIncludeLoc() const
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
An identifier, stored as an IdentifierInfo*.
SourceLocation getCommaLoc() const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
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
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
Information about one declarator, including the parsed type information and the identifier.
void removeObjCLifetime()
DiagnosticsEngine & Diags
Wrapper for source info for member pointers.
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
ObjCLifetime getObjCLifetime() const
bool hasAttrExprOperand() const
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
SourceLocation getEllipsisLoc() const
Extra information about a function prototype.
CallingConv getCallConv() const
std::string getAsString() const
AutoTypeKeyword getKeyword() const
Represents a C++17 deduced template specialization type.
The "__interface" keyword.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Represents a variable template specialization, which refers to a variable template with a given set o...
static const TST TST_interface
static const TST TST_char
A namespace, stored as a NamespaceDecl*.
Describes how types, statements, expressions, and declarations should be printed. ...
bool hasAttrOperand() const
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.
unsigned size() const
Determine the number of type parameters in this list.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isArgIdent(unsigned Arg) const
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
static bool handleFunctionTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType &type)
Process an individual function attribute.
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
OpenCLOptions & getOpenCLOptions()
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.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
The collection of all-type qualifiers we support.
void setParensRange(SourceRange Range)
static const TST TST_unknown_anytype
SourceLocation getPragmaAssumeNonNullLoc() const
The location of the currently-active #pragma clang assume_nonnull begin.
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::*.
RecordDecl - Represents a struct/union/class.
__ptr16, alignas(...), etc.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
FunctionType::ExtInfo ExtInfo
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
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...
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
ParameterABI getABI() const
Return the ABI treatment of this parameter.
static void distributeFunctionTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType type)
A function type attribute was written somewhere in a declaration other than on the declarator itself ...
static const TST TST_decimal32
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
Represents a class type in Objective C.
AttributeList * getList() const
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an AttributeList as an argument...
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.
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier, if any.
bool isTypeSpecPipe() const
ArrayRef< QualType > getParamTypes() const
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
QualType BuildParenType(QualType T)
Build a paren type including T.
void setBuiltinLoc(SourceLocation Loc)
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
SourceLocation getTypeSpecSignLoc() const
QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
TSS getTypeSpecSign() const
void setRBracketLoc(SourceLocation Loc)
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
bool isReferenceType() const
static bool distributeNullabilityTypeAttr(TypeProcessingState &state, QualType type, AttributeList &attr)
Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
static const TST TST_class
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...
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
bool isAnyPointerType() const
static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType &type)
handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type...
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned The qualifier bitmask values are the same as...
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
static const TST TST_double
static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, QualType type)
diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type...
void setElaboratedKeywordLoc(SourceLocation Loc)
static std::string getPrintableNameForEntity(DeclarationName Entity)
TagKind getTagKind() const
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
TypeLoc getValueLoc() const
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6...
virtual bool MaybeDiagnoseMissingCompleteType(SourceLocation Loc, QualType T)
Produces a diagnostic note if the external source contains a complete definition for T...
static const TST TST_enum
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes...
static void maybeSynthesizeBlockSignature(TypeProcessingState &state, QualType declSpecType)
Add a synthetic '()' to a block-literal declarator if it is required, given the return type...
SourceLocation getTypeSpecTypeLoc() const
SourceLocation getLocStart() const LLVM_READONLY
static const TSW TSW_unspecified
void copy(DependentTemplateSpecializationTypeLoc Loc)
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...
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
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
virtual void HandleTagDeclRequiredDefinition(const TagDecl *D)
This callback is invoked the first time each TagDecl is required to be complete.
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator, which is not a function declaration or definition and therefore is not permitted to have default arguments.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword...
llvm::BumpPtrAllocator BumpAlloc
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
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...
static void emitNullabilityConsistencyWarning(Sema &S, SimplePointerKind PointerKind, SourceLocation PointerLoc)
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
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...
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 isCompleteType(SourceLocation Loc, QualType T)
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
QualType getParenType(QualType NamedType) const
void setNameLoc(SourceLocation Loc)
static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, TypeSourceInfo *&ReturnTypeInfo)
Represents the results of name lookup.
const internal::VariadicDynCastAllOfMatcher< Decl, TypedefDecl > typedefDecl
Matches typedef declarations.
const TargetInfo & getTargetInfo() const
static void HandleVectorSizeAttr(QualType &CurType, const AttributeList &Attr, Sema &S)
HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars...
An lvalue ref-qualifier was provided (&).
unsigned ConstQualLoc
The location of the const-qualifier, if any.
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...
void setCaretLoc(SourceLocation Loc)
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
static void spliceAttrOutOfList(AttributeList &attr, AttributeList *&head)
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 ...
SourceLocation getRAngleLoc() const
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T)
Check if type T corresponding to declaration specifier DS is disabled due to required OpenCL extensio...
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
QualType getReturnType() const
Wrapper for source info for functions.
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &state, AttributeList &attr, QualType &type)
static bool hasDirectOwnershipQualifier(QualType type)
Does this type have a "direct" ownership qualifier? That is, is it written like "__strong id"...
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"...
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, QualType &declSpecType)
Given that there are attributes written on the declarator itself, try to distribute any type attribut...
field_range fields() const
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
bool hasNonLiteralTypeFieldsOrBases() const
Determine whether this class has a non-literal or/ volatile type non-static data member or base class...
void addCVRQualifiers(unsigned mask)
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
TypeDecl - Represents a declaration of a type.
An implicit 'self' parameter.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
bool needsExtraLocalData() const
RecordDecl * getDecl() const
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
void expandBuiltinRange(SourceRange Range)
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.
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
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.
TypeClass getTypeClass() const
enum clang::DeclaratorChunk::@196 Kind
Represents an Objective-C protocol declaration.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
#define MS_TYPE_ATTRS_CASELIST
void setUnaligned(bool flag)
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
static FileID getNullabilityCompletenessCheckFileID(Sema &S, SourceLocation loc)
static void checkNullabilityConsistency(Sema &S, SimplePointerKind pointerKind, SourceLocation pointerLoc)
Complains about missing nullability if the file containing pointerLoc has other uses of nullability (...
void setLocalRangeBegin(SourceLocation L)
static void transferARCOwnershipToDeclSpec(Sema &S, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
SourceRange getTypeSpecWidthRange() const
Represents an ObjC class declaration.
void copy(ElaboratedTypeLoc Loc)
SourceLocation getLocStart() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
void setInvalid(bool b=true) const
detail::InMemoryDirectory::const_iterator I
is ARM Neon polynomial vector
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
unsigned getNumParams() const
SmallVector< TemplateTypeParmDecl *, 4 > AutoTemplateParams
Store the list of the auto parameters for a generic lambda.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
CanQualType UnsignedCharTy
const LangOptions & LangOpts
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
static std::string getFunctionQualifiersAsString(const FunctionProtoType *FnTy)
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
uint8_t PointerKind
Which kind of pointer declarator we saw.
This object can be modified without requiring retains or releases.
SourceRange getRange() const
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5...
DiagnosticsEngine & getDiagnostics() const
static const TST TST_float
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void setUnderlyingTInfo(TypeSourceInfo *TI) const
bool IsStructurallyEquivalent(Decl *D1, Decl *D2)
Determine whether the two declarations are structurally equivalent.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
AttributedType::Kind getAttrKind() const
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
static OpenCLAccessAttr::Spelling getImageAccess(const AttributeList *Attrs)
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
SourceRange getTypeofParensRange() const
bool hasConstexprNonCopyMoveConstructor() const
Determine whether this class has at least one constexpr constructor other than the copy or move const...
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
static const TSW TSW_long
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
CXXRecordDecl * getMostRecentDecl()
static bool handleObjCGCTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType &type)
handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type...
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
A little helper class used to produce diagnostics.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
TST getTypeSpecType() const
Represents a prototype with parameter type info, e.g.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
static void checkExtParameterInfos(Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
Check the extended parameter information.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
ArraySizeModifier
Capture whether this is a normal array (e.g.
std::vector< bool > & Stack
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.
void setSizeExpr(Expr *Size)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
bool isRealFloatingType() const
Floating point categories.
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
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.
SourceLocation getLParenLoc() const
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
unsigned hasStatic
True if this dimension included the 'static' keyword.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier, if any.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Type source information for an attributed type.
const Type * getTypeForDecl() const
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Expr - This represents one expression.
MSInheritanceAttr::Spelling calculateInheritanceModel() const
Calculate what the inheritance model would be for this class.
StringRef getName() const
Return the actual identifier string.
SourceLocation getAtomicSpecLoc() const
void * getOpaqueData() const
Get the pointer where source information is stored.
SourceLocation getTypeSpecComplexLoc() const
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
Declaration of a template type parameter.
TypeSpecifierWidth getWrittenWidthSpec() const
bool isFunctionDefinition() const
static void HandleOpenCLAccessAttr(QualType &CurType, const AttributeList &Attr, Sema &S)
Handle OpenCL Access Qualifier Attribute.
unsigned VolatileQualLoc
The location of the volatile-qualifier, if any.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
bool isAtomicType() const
Represents a C++ destructor within a class.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
TranslationUnitDecl * getTranslationUnitDecl() const
QualType BuildAtomicType(QualType T, SourceLocation Loc)
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
bool isVariableArrayType() const
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 ...
ExtProtoInfo getExtProtoInfo() const
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
static void HandleNeonVectorTypeAttr(QualType &CurType, const AttributeList &Attr, Sema &S, VectorType::VectorKind VecKind)
HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used ...
void completeExprArrayBound(Expr *E)
SourceLocation getVolatileSpecLoc() const
bool supportsVariadicCall(CallingConv CC)
Checks whether the given calling convention supports variadic calls.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
virtual void AssignInheritanceModel(CXXRecordDecl *RD)
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
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.
A namespace alias, stored as a NamespaceAliasDecl*.
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
static QualType getDecltypeForExpr(Sema &S, Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
bool isConstexprSpecified() const
CanQualType UnsignedInt128Ty
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
void setNameLoc(SourceLocation Loc)
ASTMutationListener * getASTMutationListener() const
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
SourceLocation Loc
Loc - The place where this type was defined.
bool isFunctionOrMethod() const
Qualifiers Quals
The local qualifiers.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier, if any.
void setHasBaseTypeAsWritten(bool HasBaseType)
void setEllipsisLoc(SourceLocation EL)
static void distributeFunctionTypeAttrFromDeclSpec(TypeProcessingState &state, AttributeList &attr, QualType &declSpecType)
A function type attribute was written in the decl spec.
void setPointOfInstantiation(SourceLocation Loc)
static QualType inferARCLifetimeForPointee(Sema &S, QualType type, SourceLocation loc, bool isReference)
Given that we're building a pointer or reference to the given.
TypeSourceInfo * GetTypeSourceInfoForDeclarator(Declarator &D, QualType T, TypeSourceInfo *ReturnTypeInfo)
Create and instantiate a TypeSourceInfo with type source information.
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
Compare two source locations.
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].
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Wraps an identifier and optional source location for the identifier.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
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 getLocEnd() const LLVM_READONLY
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
A type, stored as a Type*.
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
static const TSW TSW_short
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
AttributeList * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, AttributeList::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
CallingConv
CallingConv - Specifies the calling convention that a function uses.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
const clang::PrintingPolicy & getPrintingPolicy() const
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
bool isObjectType() const
Determine whether this type is an object type.
bool hasObjCLifetime() const
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
bool getSuppressSystemWarnings() const
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
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
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
void setTypeofLoc(SourceLocation Loc)
Context-sensitive version of a keyword attribute.
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
bool isPrototypeContext() const
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.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
There is no lifetime qualification on this type.
Information about a FileID, basically just the logical file that it represents and include stack info...
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void setAttrOperandParensRange(SourceRange range)
is AltiVec 'vector Pixel'
Assigning into this object requires the old value to be released and the new value to be retained...
TypeLoc getValueLoc() const
not a target-specific vector type
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
The attribute is in the decl-specifier-seq.
void setKNRPromoted(bool promoted)
static bool distributeFunctionTypeAttrToInnermost(TypeProcessingState &state, AttributeList &attr, AttributeList *&attrList, QualType &declSpecType)
Try to distribute a function type attribute to the innermost function chunk or type.
static bool isPermittedNeonBaseType(QualType &Ty, VectorType::VectorKind VecKind, Sema &S)
const ExtParameterInfo * ExtParameterInfos
Encodes a location in the source.
Sugar for parentheses used when specifying types.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static const TST TST_auto_type
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
PointerDeclaratorKind
Describes the kind of a pointer a declarator describes.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Interfaces are the core concept in Objective-C for object oriented design.
An overloaded operator name, e.g., operator+.
Expr * getRepAsExpr() const
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
A deduction-guide name (a template-name)
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isValid() const
Return true if this is a valid SourceLocation object.
TagDecl - Represents the declaration of a struct/union/class/enum.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state, Qualifiers::ObjCLifetime ownership, unsigned chunkIndex)
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
ASTContext & getASTContext() const LLVM_READONLY
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.
ASTContext & getASTContext() const
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 const TST TST_union
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, unsigned TypeQuals, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation ConstQualifierLoc, SourceLocation VolatileQualifierLoc, SourceLocation RestrictQualifierLoc, 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())
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
ParsedType getRepAsType() const
static void moveAttrFromListToList(AttributeList &attr, AttributeList *&fromList, AttributeList *&toList)
TSC getTypeSpecComplex() const
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
static const TSS TSS_signed
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
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>::".
ExprResult DefaultLvalueConversion(Expr *E)
No ref-qualifier was provided.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T)
Retrieve a version of the type 'T' that is elaborated by Keyword and qualified by the nested-name-spe...
SourceRange getExceptionSpecRange() const
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
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...
bool isInvalid() const
An error occurred during parsing of the scope specifier.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
MemberPointerTypeInfo Mem
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...
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.
SimplePointerKind
A simple notion of pointer kinds, which matches up with the various pointer declarators.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk...
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
static bool isBlockPointer(Expr *Arg)
const FileInfo & getFile() const
is AltiVec 'vector bool ...'
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.
SourceLocation getUnalignedSpecLoc() const
static const TST TST_typeofType
SourceLocation getBegin() const
void setAmpLoc(SourceLocation Loc)
const T * castAs() const
Member-template castAs<specific type>.
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.
SourceLocation getBeginLoc() const
bool isArgExpr(unsigned Arg) const
void setLBracketLoc(SourceLocation Loc)
AttributeList *& getAttrListRef()
IdentifierInfo * getScopeName() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
static bool isVectorSizeTooLarge(unsigned NumElements)
IdentifierLoc * getArgAsIdent(unsigned Arg) const
bool isStaticMember()
Returns true if this declares a static member.
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
SourceLocation getExceptionSpecLocBeg() const
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
static void recordNullabilitySeen(Sema &S, SourceLocation loc)
Marks that a nullability feature has been used in the file containing loc.
QualType getType() const
Return the type wrapped by this type source info.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
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;...
bool isFunctionProtoType() const
A constructor named via a template-id.
Represents a pack expansion of types.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
void setLParenLoc(SourceLocation Loc)
void setTypeArgsLAngleLoc(SourceLocation Loc)
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
CanQualType UnsignedShortTy
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
Base class for declarations which introduce a typedef-name.
attr::Kind getKind() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
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 ...
static const TST TST_decltype_auto
void setClassTInfo(TypeSourceInfo *TI)
TagTypeKind
The kind of a tag type.
bool isEnabled(llvm::StringRef Ext) const
CanQualType ObjCBuiltinIdTy
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration...
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
static const TSS TSS_unspecified
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
bool isFriendSpecified() const
static const TST TST_void
CXXDestructorDecl * getDestructor() const
Returns the destructor decl for this class.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
SourceLocation getLocStart() const LLVM_READONLY
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)', this is true.
SourceLocation getTypeSpecTypeNameLoc() const
static const TST TST_int128
bool isInvalidDecl() const
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
bool getProducesResult() const
QualType getEquivalentType() const
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
CanQualType UnsignedLongLongTy
bool hasTagDefinition() const
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.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
std::pair< SourceLocation, SourceLocation > getImmediateExpansionRange(SourceLocation Loc) const
Return the start/end of the expansion information for an expansion location.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Expr * getArgAsExpr(unsigned Arg) const
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool hasTrivialDefaultConstructor() const
Determine whether this class has a trivial default constructor (C++11 [class.ctor]p5).
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
CallingConv getCC() const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
SourceLocation getLocEnd() const LLVM_READONLY
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
EnumDecl - Represents an enum.
#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.
detail::InMemoryDirectory::const_iterator E
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
The maximum supported address space number.
A pointer to member type per C++ 8.3.3 - Pointers to members.
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A type that was preceded by the 'template' keyword, stored as a Type*.
static const TST TST_unspecified
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
bool isFirstDeclarator() const
void setNameLoc(SourceLocation Loc)
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
Represents a pointer to an Objective C object.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
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.
Syntax
The style used to specify an attribute.
bool isObjCObjectType() const
void setAttrEnumOperandLoc(SourceLocation loc)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
TypeSpecifierSign getWrittenSignSpec() const
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
IdentifierInfo * getName() const
static const TST TST_decimal128
SourceManager & getSourceManager() const
const T * getAs() const
Member-template getAs<specific type>'.
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
unsigned getTypeQuals() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
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...
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void setNext(AttributeList *N)
UnqualTypeLoc getUnqualifiedLoc() const
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
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.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
llvm::StringRef getParameterABISpelling(ParameterABI kind)
void copy(TemplateSpecializationTypeLoc Loc)
Copy the location information from the given info.
Wraps an ObjCPointerType with source location information.
unsigned AtomicQualLoc
The location of the _Atomic-qualifier, if any.
SourceLocation getLoc() const
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...
A template-id, e.g., f<int>.
CXXScopeSpec & getTypeSpecScope()
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
QualType getPointeeType() 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...
IdentifierInfo * getIdentifier() const
static bool hasNullabilityAttr(const AttributeList *attrs)
Check whether there is a nullability attribute of any kind in the given attribute list...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, std::unique_ptr< CorrectionCandidateCallback > CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
Describes whether we've seen any nullability information for the given file.
bool CheckRegparmAttr(const AttributeList &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
static 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_].
bool isCXX11Attribute() const
const Type * getClass() const
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.
bool isContextSensitiveKeywordAttribute() const
unsigned AutoTemplateParameterDepth
If this is a generic lambda, use this as the depth of each 'auto' parameter, during initial AST const...
QualType getTypeOfExprType(Expr *e) const
GCC extension.
An attributed type is a type to which a type attribute has been applied.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
void setKWLoc(SourceLocation Loc)
unsigned TypeQuals
For now, sema will catch these as invalid.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
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...
Captures information about "declaration specifiers".
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
SourceLocation getIdentifierLoc() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
A user-defined literal name, e.g., operator "" _i.
bool isObjCObjectPointerType() const
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
bool checkNullabilityTypeSpecifier(QualType &type, NullabilityKind nullability, SourceLocation nullabilityLoc, bool isContextSensitive, bool allowArrayTypes)
Check whether a nullability type specifier can be added to the given type.
void setParam(unsigned i, ParmVarDecl *VD)
CallingConv getDefaultCallingConvention(bool isVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
Provides information a specialization of a member of a class template, which may be a member function...
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
static const TST TST_float128
void setLParenLoc(SourceLocation Loc)
static const TST TST_bool
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
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.
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.
SourceLocation getRParenLoc() const
static void HandleAddressSpaceTypeAttribute(QualType &Type, const AttributeList &Attr, Sema &S)
HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type...
bool isTypeSpecOwned() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Defines the clang::TargetInfo interface.
SourceLocation getTypeSpecWidthLoc() const
A SourceLocation and its associated SourceManager.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
static Qualifiers fromCVRMask(unsigned CVR)
static const TSW TSW_longlong
TagDecl * getDecl() const
bool isIncompleteArrayType() const
static Decl::Kind getKind(const Decl *D)
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
static OpaquePtr make(QualTypeP)
bool isTypeAltiVecVector() const
bool isValid() const
A scope specifier is present, and it refers to a real scope.
A reference to a declared variable, function, enum, etc.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
bool isSet() const
Deprecated.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
void copy(TypeLoc other)
Copies the other type loc into this one.
static const TST TST_atomic
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
bool hasQualifiers() const
Determine whether this type has any qualifiers.
SourceManager & SourceMgr
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
static const TST TST_struct
SplitQualType getSingleStepDesugaredType() const
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.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
AttributeList * getNext() 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)
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
NamedDecl - This represents a decl with a name.
bool isInvalidType() const
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
void copy(DependentNameTypeLoc Loc)
QualifiedFunctionKind
Kinds of declarator that cannot contain a qualified function type.
bool hasExplicitCallingConv(QualType &T)
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
No keyword precedes the qualified type name.
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
bool isConstQualified() const
Determine whether this type is const-qualified.
TypeAttrLocation
The location of a type attribute.
static void distributeFunctionTypeAttrFromDeclarator(TypeProcessingState &state, AttributeList &attr, QualType &declSpecType)
A function type attribute was written on the declarator.
const Type * getClass() const
static void spliceAttrIntoList(AttributeList &attr, AttributeList *&head)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
static TypeSourceInfo * GetFullTypeForDeclarator(TypeProcessingState &state, QualType declSpecType, TypeSourceInfo *TInfo)
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.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
SourceLocation getLocStart() const LLVM_READONLY
void setType(QualType newType)
Wrapper for source info for pointers.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
Wrapper for source info for block pointers.
bool isTypeAltiVecPixel() const
base_class_range vbases()
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
static AttributeList::Kind getAttrListKind(AttributedType::Kind kind)
Map an AttributedType::Kind to an AttributeList::Kind.
CUDADiagBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a CUDADiagBuilder that emits the diagnostic if the current context is "used as device code"...
A class which abstracts out some details necessary for making a call.
AttributeList *& getListRef()
Returns a reference to the attribute list.
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()
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
static void distributeObjCPointerTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType type)
Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator i...
This parameter (which must have pointer type) is a Swift indirect result parameter.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
AttributeList - Represents a syntactic attribute.
CanQualType UnsignedIntTy
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
static void fillAttributedTypeLoc(AttributedTypeLoc TL, const AttributeList *attrs, const AttributeList *DeclAttrs=nullptr)
bool isPointerType() const
SourceLocation getEllipsisLoc() const
const AttributeList * getAttributes() const
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?