• Home
  • Raw
  • Download

Lines Matching refs:S

197 static bool checkAttributeNumArgs(Sema &S, const AttributeList &Attr,  in checkAttributeNumArgs()  argument
200 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << Num; in checkAttributeNumArgs()
215 static void handleExtVectorTypeAttr(Sema &S, Scope *scope, Decl *D, in handleExtVectorTypeAttr() argument
219 S.Diag(Attr.getLoc(), diag::err_typecheck_ext_vector_not_typedef); in handleExtVectorTypeAttr()
233 ExprResult Size = S.ActOnIdExpression(scope, SS, id, false, false); in handleExtVectorTypeAttr()
240 if (!checkAttributeNumArgs(S, Attr, 1)) in handleExtVectorTypeAttr()
248 QualType T = S.BuildExtVectorType(curType, sizeExpr, Attr.getLoc()); in handleExtVectorTypeAttr()
251 tDecl->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(T)); in handleExtVectorTypeAttr()
254 S.ExtVectorDecls.push_back(tDecl); in handleExtVectorTypeAttr()
258 static void handlePackedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handlePackedAttr() argument
260 if (!checkAttributeNumArgs(S, Attr, 0)) in handlePackedAttr()
264 TD->addAttr(::new (S.Context) PackedAttr(Attr.getLoc(), S.Context)); in handlePackedAttr()
269 S.Context.getTypeAlign(FD->getType()) <= 8) in handlePackedAttr()
270 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored_for_field_of_type) in handlePackedAttr()
273 FD->addAttr(::new (S.Context) PackedAttr(Attr.getLoc(), S.Context)); in handlePackedAttr()
275 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); in handlePackedAttr()
278 static void handleMsStructAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMsStructAttr() argument
280 TD->addAttr(::new (S.Context) MsStructAttr(Attr.getLoc(), S.Context)); in handleMsStructAttr()
282 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); in handleMsStructAttr()
285 static void handleIBAction(Sema &S, Decl *D, const AttributeList &Attr) { in handleIBAction() argument
287 if (!checkAttributeNumArgs(S, Attr, 0)) in handleIBAction()
293 D->addAttr(::new (S.Context) IBActionAttr(Attr.getLoc(), S.Context)); in handleIBAction()
297 S.Diag(Attr.getLoc(), diag::warn_attribute_ibaction) << Attr.getName(); in handleIBAction()
300 static void handleIBOutlet(Sema &S, Decl *D, const AttributeList &Attr) { in handleIBOutlet() argument
302 if (!checkAttributeNumArgs(S, Attr, 0)) in handleIBOutlet()
308 D->addAttr(::new (S.Context) IBOutletAttr(Attr.getLoc(), S.Context)); in handleIBOutlet()
312 S.Diag(Attr.getLoc(), diag::warn_attribute_iboutlet) << Attr.getName(); in handleIBOutlet()
315 static void handleIBOutletCollection(Sema &S, Decl *D, in handleIBOutletCollection() argument
320 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleIBOutletCollection()
327 S.Diag(Attr.getLoc(), diag::warn_attribute_iboutlet) << Attr.getName(); in handleIBOutletCollection()
332 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_object_type) in handleIBOutletCollection()
338 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_object_type) in handleIBOutletCollection()
345 II = &S.Context.Idents.get("id"); in handleIBOutletCollection()
347 ParsedType TypeRep = S.getTypeName(*II, Attr.getLoc(), in handleIBOutletCollection()
348 S.getScopeForContext(D->getDeclContext()->getParent())); in handleIBOutletCollection()
350 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II; in handleIBOutletCollection()
360 S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II; in handleIBOutletCollection()
363 D->addAttr(::new (S.Context) IBOutletCollectionAttr(Attr.getLoc(), S.Context, in handleIBOutletCollection()
382 static void handleNonNullAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNonNullAttr() argument
386 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNonNullAttr()
407 !Ex->isIntegerConstantExpr(ArgNum, S.Context)) { in handleNonNullAttr()
408 S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int) in handleNonNullAttr()
416 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleNonNullAttr()
424 S.Diag(Attr.getLoc(), in handleNonNullAttr()
438 S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only) in handleNonNullAttr()
461 S.Diag(Attr.getLoc(), diag::warn_attribute_nonnull_no_pointers); in handleNonNullAttr()
469 D->addAttr(::new (S.Context) NonNullAttr(Attr.getLoc(), S.Context, start, in handleNonNullAttr()
473 static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) { in handleOwnershipAttr() argument
484 S.Diag(AL.getLoc(), diag::err_attribute_argument_n_not_string) in handleOwnershipAttr()
494 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2; in handleOwnershipAttr()
501 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2; in handleOwnershipAttr()
508 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) in handleOwnershipAttr()
519 S.Diag(AL.getLoc(), diag::warn_attribute_wrong_decl_type) in handleOwnershipAttr()
543 || !IdxExpr->isIntegerConstantExpr(ArgNum, S.Context)) { in handleOwnershipAttr()
544 S.Diag(AL.getLoc(), diag::err_attribute_argument_not_int) in handleOwnershipAttr()
552 S.Diag(AL.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleOwnershipAttr()
559 S.Diag(AL.getLoc(), diag::err_attribute_invalid_implicit_this_argument) in handleOwnershipAttr()
573 S.Diag(AL.getLoc(), diag::err_ownership_type) in handleOwnershipAttr()
587 || !IdxExpr->isIntegerConstantExpr(ArgNum, S.Context)) { in handleOwnershipAttr()
588 S.Diag(AL.getLoc(), diag::err_ownership_type) in handleOwnershipAttr()
609 S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) in handleOwnershipAttr()
623 S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << 2; in handleOwnershipAttr()
627 D->addAttr(::new (S.Context) OwnershipAttr(AL.getLoc(), S.Context, K, Module, in handleOwnershipAttr()
651 static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakRefAttr() argument
654 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleWeakRefAttr()
659 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) in handleWeakRefAttr()
678 S.Diag(Attr.getLoc(), diag::err_attribute_weakref_not_global_context) << in handleWeakRefAttr()
702 S.Diag(Attr.getLoc(), diag::err_attribute_weakref_not_static); in handleWeakRefAttr()
716 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleWeakRefAttr()
722 D->addAttr(::new (S.Context) AliasAttr(Attr.getLoc(), S.Context, in handleWeakRefAttr()
726 D->addAttr(::new (S.Context) WeakRefAttr(Attr.getLoc(), S.Context)); in handleWeakRefAttr()
729 static void handleAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAliasAttr() argument
732 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleAliasAttr()
741 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleAliasAttr()
746 if (S.Context.Target.getTriple().isOSDarwin()) { in handleAliasAttr()
747 S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin); in handleAliasAttr()
753 D->addAttr(::new (S.Context) AliasAttr(Attr.getLoc(), S.Context, in handleAliasAttr()
757 static void handleNakedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNakedAttr() argument
759 if (!checkAttributeNumArgs(S, Attr, 0)) in handleNakedAttr()
763 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNakedAttr()
768 D->addAttr(::new (S.Context) NakedAttr(Attr.getLoc(), S.Context)); in handleNakedAttr()
771 static void handleAlwaysInlineAttr(Sema &S, Decl *D, in handleAlwaysInlineAttr() argument
775 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleAlwaysInlineAttr()
780 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleAlwaysInlineAttr()
785 D->addAttr(::new (S.Context) AlwaysInlineAttr(Attr.getLoc(), S.Context)); in handleAlwaysInlineAttr()
788 static void handleMallocAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMallocAttr() argument
791 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleMallocAttr()
798 D->addAttr(::new (S.Context) MallocAttr(Attr.getLoc(), S.Context)); in handleMallocAttr()
803 S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only); in handleMallocAttr()
806 static void handleMayAliasAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleMayAliasAttr() argument
808 if (!checkAttributeNumArgs(S, Attr, 0)) in handleMayAliasAttr()
811 D->addAttr(::new (S.Context) MayAliasAttr(Attr.getLoc(), S.Context)); in handleMayAliasAttr()
814 static void handleNoCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoCommonAttr() argument
817 D->addAttr(::new (S.Context) NoCommonAttr(Attr.getLoc(), S.Context)); in handleNoCommonAttr()
819 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNoCommonAttr()
823 static void handleCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCommonAttr() argument
826 D->addAttr(::new (S.Context) CommonAttr(Attr.getLoc(), S.Context)); in handleCommonAttr()
828 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleCommonAttr()
832 static void handleNoReturnAttr(Sema &S, Decl *D, const AttributeList &attr) { in handleNoReturnAttr() argument
835 if (S.CheckNoReturnAttr(attr)) return; in handleNoReturnAttr()
838 S.Diag(attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNoReturnAttr()
843 D->addAttr(::new (S.Context) NoReturnAttr(attr.getLoc(), S.Context)); in handleNoReturnAttr()
856 static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D, in handleAnalyzerNoReturnAttr() argument
862 if(!checkAttributeNumArgs(S, Attr, 0)) in handleAnalyzerNoReturnAttr()
869 S.Diag(Attr.getLoc(), in handleAnalyzerNoReturnAttr()
877 D->addAttr(::new (S.Context) AnalyzerNoReturnAttr(Attr.getLoc(), S.Context)); in handleAnalyzerNoReturnAttr()
881 static void handleVecReturnAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleVecReturnAttr() argument
906 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) in handleVecReturnAttr()
912 S.Diag(Attr.getLoc(), diag::err_repeat_attribute) << "vecreturn"; in handleVecReturnAttr()
920 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_vector_member); in handleVecReturnAttr()
925 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_pod_record); in handleVecReturnAttr()
932 S.Diag(Attr.getLoc(), diag::err_attribute_vecreturn_only_vector_member); in handleVecReturnAttr()
938 D->addAttr(::new (S.Context) VecReturnAttr(Attr.getLoc(), S.Context)); in handleVecReturnAttr()
941 static void handleDependencyAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDependencyAttr() argument
943 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) in handleDependencyAttr()
950 static void handleUnusedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUnusedAttr() argument
953 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleUnusedAttr()
959 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleUnusedAttr()
964 D->addAttr(::new (S.Context) UnusedAttr(Attr.getLoc(), S.Context)); in handleUnusedAttr()
967 static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUsedAttr() argument
970 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleUsedAttr()
976 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "used"; in handleUsedAttr()
980 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleUsedAttr()
985 D->addAttr(::new (S.Context) UsedAttr(Attr.getLoc(), S.Context)); in handleUsedAttr()
988 static void handleConstructorAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstructorAttr() argument
991 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1; in handleConstructorAttr()
1000 !E->isIntegerConstantExpr(Idx, S.Context)) { in handleConstructorAttr()
1001 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleConstructorAttr()
1009 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleConstructorAttr()
1014 D->addAttr(::new (S.Context) ConstructorAttr(Attr.getLoc(), S.Context, in handleConstructorAttr()
1018 static void handleDestructorAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDestructorAttr() argument
1021 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1; in handleDestructorAttr()
1030 !E->isIntegerConstantExpr(Idx, S.Context)) { in handleDestructorAttr()
1031 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleDestructorAttr()
1039 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleDestructorAttr()
1044 D->addAttr(::new (S.Context) DestructorAttr(Attr.getLoc(), S.Context, in handleDestructorAttr()
1048 static void handleDeprecatedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDeprecatedAttr() argument
1051 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1; in handleDeprecatedAttr()
1060 S.Diag(Attr.getArg(0)->getLocStart(), diag::err_attribute_not_string) in handleDeprecatedAttr()
1067 D->addAttr(::new (S.Context) DeprecatedAttr(Attr.getLoc(), S.Context, Str)); in handleDeprecatedAttr()
1070 static void handleUnavailableAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUnavailableAttr() argument
1073 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 1; in handleUnavailableAttr()
1082 S.Diag(Attr.getArg(0)->getLocStart(), in handleUnavailableAttr()
1088 D->addAttr(::new (S.Context) UnavailableAttr(Attr.getLoc(), S.Context, Str)); in handleUnavailableAttr()
1091 static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D, in handleArcWeakrefUnavailableAttr() argument
1095 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0; in handleArcWeakrefUnavailableAttr()
1099 D->addAttr(::new (S.Context) ArcWeakrefUnavailableAttr( in handleArcWeakrefUnavailableAttr()
1100 Attr.getLoc(), S.Context)); in handleArcWeakrefUnavailableAttr()
1103 static void handleAvailabilityAttr(Sema &S, Decl *D, in handleAvailabilityAttr() argument
1111 S.Diag(PlatformLoc, diag::warn_availability_unknown_platform) in handleAvailabilityAttr()
1126 S.Diag(Introduced.KeywordLoc, diag::warn_availability_version_ordering) in handleAvailabilityAttr()
1134 S.Diag(Introduced.KeywordLoc, diag::warn_availability_version_ordering) in handleAvailabilityAttr()
1142 S.Diag(Deprecated.KeywordLoc, diag::warn_availability_version_ordering) in handleAvailabilityAttr()
1148 D->addAttr(::new (S.Context) AvailabilityAttr(Attr.getLoc(), S.Context, in handleAvailabilityAttr()
1156 static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleVisibilityAttr() argument
1158 if(!checkAttributeNumArgs(S, Attr, 1)) in handleVisibilityAttr()
1166 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleVisibilityAttr()
1183 S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_visibility) << TypeStr; in handleVisibilityAttr()
1187 D->addAttr(::new (S.Context) VisibilityAttr(Attr.getLoc(), S.Context, type)); in handleVisibilityAttr()
1190 static void handleObjCMethodFamilyAttr(Sema &S, Decl *decl, in handleObjCMethodFamilyAttr() argument
1194 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) in handleObjCMethodFamilyAttr()
1201 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleObjCMethodFamilyAttr()
1204 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleObjCMethodFamilyAttr()
1227 S.Diag(Attr.getParameterLoc(), diag::warn_unknown_method_family); in handleObjCMethodFamilyAttr()
1233 S.Diag(method->getLocation(), diag::err_init_method_bad_return_type) in handleObjCMethodFamilyAttr()
1239 method->addAttr(new (S.Context) ObjCMethodFamilyAttr(Attr.getLoc(), in handleObjCMethodFamilyAttr()
1240 S.Context, family)); in handleObjCMethodFamilyAttr()
1243 static void handleObjCExceptionAttr(Sema &S, Decl *D, in handleObjCExceptionAttr() argument
1245 if (!checkAttributeNumArgs(S, Attr, 0)) in handleObjCExceptionAttr()
1250 S.Diag(Attr.getLoc(), diag::err_attribute_requires_objc_interface); in handleObjCExceptionAttr()
1254 D->addAttr(::new (S.Context) ObjCExceptionAttr(Attr.getLoc(), S.Context)); in handleObjCExceptionAttr()
1257 static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) { in handleObjCNSObject() argument
1259 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleObjCNSObject()
1266 S.Diag(TD->getLocation(), diag::err_nsobject_attribute); in handleObjCNSObject()
1270 D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getLoc(), S.Context)); in handleObjCNSObject()
1274 handleOverloadableAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleOverloadableAttr() argument
1276 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleOverloadableAttr()
1281 S.Diag(Attr.getLoc(), diag::err_attribute_overloadable_not_function); in handleOverloadableAttr()
1285 D->addAttr(::new (S.Context) OverloadableAttr(Attr.getLoc(), S.Context)); in handleOverloadableAttr()
1288 static void handleBlocksAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleBlocksAttr() argument
1290 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleBlocksAttr()
1296 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleBlocksAttr()
1304 S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported) in handleBlocksAttr()
1309 D->addAttr(::new (S.Context) BlocksAttr(Attr.getLoc(), S.Context, type)); in handleBlocksAttr()
1312 static void handleSentinelAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSentinelAttr() argument
1315 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 2; in handleSentinelAttr()
1324 !E->isIntegerConstantExpr(Idx, S.Context)) { in handleSentinelAttr()
1325 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleSentinelAttr()
1332 S.Diag(Attr.getLoc(), diag::err_attribute_sentinel_less_than_zero) in handleSentinelAttr()
1343 !E->isIntegerConstantExpr(Idx, S.Context)) { in handleSentinelAttr()
1344 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleSentinelAttr()
1353 S.Diag(Attr.getLoc(), diag::err_attribute_sentinel_not_zero_or_one) in handleSentinelAttr()
1364 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_named_arguments); in handleSentinelAttr()
1369 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0; in handleSentinelAttr()
1374 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0; in handleSentinelAttr()
1388 S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m; in handleSentinelAttr()
1392 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleSentinelAttr()
1397 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleSentinelAttr()
1401 D->addAttr(::new (S.Context) SentinelAttr(Attr.getLoc(), S.Context, sentinel, in handleSentinelAttr()
1405 static void handleWarnUnusedResult(Sema &S, Decl *D, const AttributeList &Attr) { in handleWarnUnusedResult() argument
1407 if (!checkAttributeNumArgs(S, Attr, 0)) in handleWarnUnusedResult()
1411 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleWarnUnusedResult()
1417 S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method) in handleWarnUnusedResult()
1423 S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method) in handleWarnUnusedResult()
1428 D->addAttr(::new (S.Context) WarnUnusedResultAttr(Attr.getLoc(), S.Context)); in handleWarnUnusedResult()
1431 static void handleWeakAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakAttr() argument
1434 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleWeakAttr()
1439 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleWeakAttr()
1448 S.Diag(Attr.getLoc(), diag::err_attribute_weak_static); in handleWeakAttr()
1452 nd->addAttr(::new (S.Context) WeakAttr(Attr.getLoc(), S.Context)); in handleWeakAttr()
1455 static void handleWeakImportAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleWeakImportAttr() argument
1457 if (!checkAttributeNumArgs(S, Attr, 0)) in handleWeakImportAttr()
1465 S.Diag(Attr.getLoc(), in handleWeakImportAttr()
1469 (S.Context.Target.getTriple().isOSDarwin() && in handleWeakImportAttr()
1473 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleWeakImportAttr()
1479 D->addAttr(::new (S.Context) WeakImportAttr(Attr.getLoc(), S.Context)); in handleWeakImportAttr()
1482 static void handleReqdWorkGroupSize(Sema &S, Decl *D, in handleReqdWorkGroupSize() argument
1485 if (!checkAttributeNumArgs(S, Attr, 3)) in handleReqdWorkGroupSize()
1493 !E->isIntegerConstantExpr(ArgNum, S.Context)) { in handleReqdWorkGroupSize()
1494 S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int) in handleReqdWorkGroupSize()
1500 D->addAttr(::new (S.Context) ReqdWorkGroupSizeAttr(Attr.getLoc(), S.Context, in handleReqdWorkGroupSize()
1505 static void handleSectionAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSectionAttr() argument
1507 if (!checkAttributeNumArgs(S, Attr, 1)) in handleSectionAttr()
1515 S.Diag(ArgExpr->getLocStart(), diag::err_attribute_not_string) << "section"; in handleSectionAttr()
1520 std::string Error = S.Context.Target.isValidSectionSpecifier(SE->getString()); in handleSectionAttr()
1522 S.Diag(SE->getLocStart(), diag::err_attribute_section_invalid_for_target) in handleSectionAttr()
1529 S.Diag(SE->getLocStart(), diag::err_attribute_section_local_variable); in handleSectionAttr()
1533 D->addAttr(::new (S.Context) SectionAttr(Attr.getLoc(), S.Context, in handleSectionAttr()
1538 static void handleNothrowAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNothrowAttr() argument
1541 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleNothrowAttr()
1549 D->addAttr(::new (S.Context) NoThrowAttr(Attr.getLoc(), S.Context)); in handleNothrowAttr()
1553 static void handleConstAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstAttr() argument
1556 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleConstAttr()
1564 D->addAttr(::new (S.Context) ConstAttr(Attr.getLoc(), S.Context)); in handleConstAttr()
1568 static void handlePureAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handlePureAttr() argument
1570 if (!checkAttributeNumArgs(S, Attr, 0)) in handlePureAttr()
1573 D->addAttr(::new (S.Context) PureAttr(Attr.getLoc(), S.Context)); in handlePureAttr()
1576 static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCleanupAttr() argument
1578 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleCleanupAttr()
1583 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleCleanupAttr()
1590 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "cleanup"; in handleCleanupAttr()
1597 = S.LookupSingleName(S.TUScope, Attr.getParameterName(), in handleCleanupAttr()
1600 S.Diag(Attr.getParameterLoc(), diag::err_attribute_cleanup_arg_not_found) << in handleCleanupAttr()
1607 S.Diag(Attr.getParameterLoc(), in handleCleanupAttr()
1614 S.Diag(Attr.getParameterLoc(), in handleCleanupAttr()
1622 QualType Ty = S.Context.getPointerType(VD->getType()); in handleCleanupAttr()
1624 if (S.CheckAssignmentConstraints(FD->getParamDecl(0)->getLocation(), in handleCleanupAttr()
1626 S.Diag(Attr.getParameterLoc(), in handleCleanupAttr()
1632 D->addAttr(::new (S.Context) CleanupAttr(Attr.getLoc(), S.Context, FD)); in handleCleanupAttr()
1633 S.MarkDeclarationReferenced(Attr.getParameterLoc(), FD); in handleCleanupAttr()
1638 static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleFormatArgAttr() argument
1639 if (!checkAttributeNumArgs(S, Attr, 1)) in handleFormatArgAttr()
1643 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleFormatArgAttr()
1658 !IdxExpr->isIntegerConstantExpr(Idx, S.Context)) { in handleFormatArgAttr()
1659 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleFormatArgAttr()
1665 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatArgAttr()
1674 S.Diag(Attr.getLoc(), diag::err_attribute_invalid_implicit_this_argument) in handleFormatArgAttr()
1684 bool not_nsstring_type = !isNSStringType(Ty, S.Context); in handleFormatArgAttr()
1686 !isCFStringType(Ty, S.Context) && in handleFormatArgAttr()
1690 S.Diag(Attr.getLoc(), diag::err_format_attribute_not) in handleFormatArgAttr()
1696 if (!isNSStringType(Ty, S.Context) && in handleFormatArgAttr()
1697 !isCFStringType(Ty, S.Context) && in handleFormatArgAttr()
1701 S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not) in handleFormatArgAttr()
1707 D->addAttr(::new (S.Context) FormatArgAttr(Attr.getLoc(), S.Context, in handleFormatArgAttr()
1748 static void handleInitPriorityAttr(Sema &S, Decl *D, in handleInitPriorityAttr() argument
1750 if (!S.getLangOptions().CPlusPlus) { in handleInitPriorityAttr()
1751 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); in handleInitPriorityAttr()
1755 if (!isa<VarDecl>(D) || S.getCurFunctionOrMethodDecl()) { in handleInitPriorityAttr()
1756 S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr); in handleInitPriorityAttr()
1761 if (S.Context.getAsArrayType(T)) in handleInitPriorityAttr()
1762 T = S.Context.getBaseElementType(T); in handleInitPriorityAttr()
1764 S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr); in handleInitPriorityAttr()
1770 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleInitPriorityAttr()
1778 !priorityExpr->isIntegerConstantExpr(priority, S.Context)) { in handleInitPriorityAttr()
1779 S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int) in handleInitPriorityAttr()
1786 S.Diag(Attr.getLoc(), diag::err_attribute_argument_outof_range) in handleInitPriorityAttr()
1791 D->addAttr(::new (S.Context) InitPriorityAttr(Attr.getLoc(), S.Context, in handleInitPriorityAttr()
1797 static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleFormatAttr() argument
1800 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleFormatAttr()
1806 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 3; in handleFormatAttr()
1811 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleFormatAttr()
1835 S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported) in handleFormatAttr()
1844 !IdxExpr->isIntegerConstantExpr(Idx, S.Context)) { in handleFormatAttr()
1845 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleFormatAttr()
1851 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatAttr()
1861 S.Diag(Attr.getLoc(), in handleFormatAttr()
1873 if (!isCFStringType(Ty, S.Context)) { in handleFormatAttr()
1874 S.Diag(Attr.getLoc(), diag::err_format_attribute_not) in handleFormatAttr()
1881 if (!isNSStringType(Ty, S.Context)) { in handleFormatAttr()
1883 S.Diag(Attr.getLoc(), diag::err_format_attribute_not) in handleFormatAttr()
1890 S.Diag(Attr.getLoc(), diag::err_format_attribute_not) in handleFormatAttr()
1899 !FirstArgExpr->isIntegerConstantExpr(FirstArg, S.Context)) { in handleFormatAttr()
1900 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleFormatAttr()
1910 S.Diag(D->getLocation(), diag::err_format_attribute_requires_variadic); in handleFormatAttr()
1919 S.Diag(Attr.getLoc(), diag::err_format_strftime_third_parameter) in handleFormatAttr()
1925 S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds) in handleFormatAttr()
1947 D->addAttr(::new (S.Context) FormatAttr(Attr.getLoc(), S.Context, Format, in handleFormatAttr()
1952 static void handleTransparentUnionAttr(Sema &S, Decl *D, in handleTransparentUnionAttr() argument
1955 if (!checkAttributeNumArgs(S, Attr, 0)) in handleTransparentUnionAttr()
1968 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleTransparentUnionAttr()
1974 S.Diag(Attr.getLoc(), in handleTransparentUnionAttr()
1982 S.Diag(Attr.getLoc(), diag::warn_transparent_union_attribute_zero_fields); in handleTransparentUnionAttr()
1989 S.Diag(FirstField->getLocation(), in handleTransparentUnionAttr()
1995 uint64_t FirstSize = S.Context.getTypeSize(FirstType); in handleTransparentUnionAttr()
1996 uint64_t FirstAlign = S.Context.getTypeAlign(FirstType); in handleTransparentUnionAttr()
1999 if (S.Context.getTypeSize(FieldType) != FirstSize || in handleTransparentUnionAttr()
2000 S.Context.getTypeAlign(FieldType) != FirstAlign) { in handleTransparentUnionAttr()
2002 bool isSize = S.Context.getTypeSize(FieldType) != FirstSize; in handleTransparentUnionAttr()
2003 unsigned FieldBits = isSize? S.Context.getTypeSize(FieldType) in handleTransparentUnionAttr()
2004 : S.Context.getTypeAlign(FieldType); in handleTransparentUnionAttr()
2005 S.Diag(Field->getLocation(), in handleTransparentUnionAttr()
2009 S.Diag(FirstField->getLocation(), in handleTransparentUnionAttr()
2016 RD->addAttr(::new (S.Context) TransparentUnionAttr(Attr.getLoc(), S.Context)); in handleTransparentUnionAttr()
2019 static void handleAnnotateAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAnnotateAttr() argument
2021 if (!checkAttributeNumArgs(S, Attr, 1)) in handleAnnotateAttr()
2030 S.Diag(ArgExpr->getLocStart(), diag::err_attribute_not_string) <<"annotate"; in handleAnnotateAttr()
2033 D->addAttr(::new (S.Context) AnnotateAttr(Attr.getLoc(), S.Context, in handleAnnotateAttr()
2037 static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleAlignedAttr() argument
2040 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1; in handleAlignedAttr()
2049 D->addAttr(::new (S.Context) AlignedAttr(Attr.getLoc(), S.Context, true, 0)); in handleAlignedAttr()
2053 S.AddAlignedAttr(Attr.getLoc(), D, Attr.getArg(0)); in handleAlignedAttr()
2092 static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleModeAttr() argument
2097 if (!checkAttributeNumArgs(S, Attr, 0)) in handleModeAttr()
2103 S.Diag(Attr.getLoc(), diag::err_attribute_missing_parameter_name); in handleModeAttr()
2139 DestWidth = S.Context.Target.getPointerWidth(0); in handleModeAttr()
2141 DestWidth = S.Context.Target.getCharWidth(); in handleModeAttr()
2145 DestWidth = S.Context.Target.getPointerWidth(0); in handleModeAttr()
2155 S.Diag(D->getLocation(), diag::err_attr_wrong_decl) in handleModeAttr()
2161 S.Diag(Attr.getLoc(), diag::err_mode_not_primitive); in handleModeAttr()
2164 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type); in handleModeAttr()
2167 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type); in handleModeAttr()
2170 S.Diag(Attr.getLoc(), diag::err_mode_wrong_type); in handleModeAttr()
2182 S.Diag(Attr.getLoc(), diag::err_unknown_machine_mode) << Name; in handleModeAttr()
2185 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name; in handleModeAttr()
2189 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name; in handleModeAttr()
2193 NewTy = S.Context.SignedCharTy; in handleModeAttr()
2195 NewTy = S.Context.UnsignedCharTy; in handleModeAttr()
2199 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name; in handleModeAttr()
2203 NewTy = S.Context.ShortTy; in handleModeAttr()
2205 NewTy = S.Context.UnsignedShortTy; in handleModeAttr()
2209 NewTy = S.Context.FloatTy; in handleModeAttr()
2211 NewTy = S.Context.IntTy; in handleModeAttr()
2213 NewTy = S.Context.UnsignedIntTy; in handleModeAttr()
2217 NewTy = S.Context.DoubleTy; in handleModeAttr()
2219 if (S.Context.Target.getLongWidth() == 64) in handleModeAttr()
2220 NewTy = S.Context.LongTy; in handleModeAttr()
2222 NewTy = S.Context.LongLongTy; in handleModeAttr()
2224 if (S.Context.Target.getLongWidth() == 64) in handleModeAttr()
2225 NewTy = S.Context.UnsignedLongTy; in handleModeAttr()
2227 NewTy = S.Context.UnsignedLongLongTy; in handleModeAttr()
2230 NewTy = S.Context.LongDoubleTy; in handleModeAttr()
2234 S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name; in handleModeAttr()
2238 NewTy = S.Context.Int128Ty; in handleModeAttr()
2240 NewTy = S.Context.UnsignedInt128Ty; in handleModeAttr()
2245 NewTy = S.Context.getComplexType(NewTy); in handleModeAttr()
2251 TD->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(NewTy)); in handleModeAttr()
2256 static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoDebugAttr() argument
2258 if (!checkAttributeNumArgs(S, Attr, 0)) in handleNoDebugAttr()
2262 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNoDebugAttr()
2267 D->addAttr(::new (S.Context) NoDebugAttr(Attr.getLoc(), S.Context)); in handleNoDebugAttr()
2270 static void handleNoInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNoInlineAttr() argument
2272 if (!checkAttributeNumArgs(S, Attr, 0)) in handleNoInlineAttr()
2277 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNoInlineAttr()
2282 D->addAttr(::new (S.Context) NoInlineAttr(Attr.getLoc(), S.Context)); in handleNoInlineAttr()
2285 static void handleNoInstrumentFunctionAttr(Sema &S, Decl *D, in handleNoInstrumentFunctionAttr() argument
2288 if (!checkAttributeNumArgs(S, Attr, 0)) in handleNoInstrumentFunctionAttr()
2293 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleNoInstrumentFunctionAttr()
2298 D->addAttr(::new (S.Context) NoInstrumentFunctionAttr(Attr.getLoc(), in handleNoInstrumentFunctionAttr()
2299 S.Context)); in handleNoInstrumentFunctionAttr()
2302 static void handleConstantAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleConstantAttr() argument
2303 if (S.LangOpts.CUDA) { in handleConstantAttr()
2306 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleConstantAttr()
2311 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleConstantAttr()
2316 D->addAttr(::new (S.Context) CUDAConstantAttr(Attr.getLoc(), S.Context)); in handleConstantAttr()
2318 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "constant"; in handleConstantAttr()
2322 static void handleDeviceAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleDeviceAttr() argument
2323 if (S.LangOpts.CUDA) { in handleDeviceAttr()
2326 S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; in handleDeviceAttr()
2331 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleDeviceAttr()
2336 D->addAttr(::new (S.Context) CUDADeviceAttr(Attr.getLoc(), S.Context)); in handleDeviceAttr()
2338 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "device"; in handleDeviceAttr()
2342 static void handleGlobalAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGlobalAttr() argument
2343 if (S.LangOpts.CUDA) { in handleGlobalAttr()
2345 if (!checkAttributeNumArgs(S, Attr, 0)) in handleGlobalAttr()
2349 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleGlobalAttr()
2358 S.Diag(FD->getTypeSpecStartLoc(), diag::err_kern_type_not_void_return) in handleGlobalAttr()
2363 S.Diag(FD->getTypeSpecStartLoc(), diag::err_kern_type_not_void_return) in handleGlobalAttr()
2369 D->addAttr(::new (S.Context) CUDAGlobalAttr(Attr.getLoc(), S.Context)); in handleGlobalAttr()
2371 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "global"; in handleGlobalAttr()
2375 static void handleHostAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleHostAttr() argument
2376 if (S.LangOpts.CUDA) { in handleHostAttr()
2378 if (!checkAttributeNumArgs(S, Attr, 0)) in handleHostAttr()
2383 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleHostAttr()
2388 D->addAttr(::new (S.Context) CUDAHostAttr(Attr.getLoc(), S.Context)); in handleHostAttr()
2390 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "host"; in handleHostAttr()
2394 static void handleSharedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleSharedAttr() argument
2395 if (S.LangOpts.CUDA) { in handleSharedAttr()
2397 if (!checkAttributeNumArgs(S, Attr, 0)) in handleSharedAttr()
2402 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleSharedAttr()
2407 D->addAttr(::new (S.Context) CUDASharedAttr(Attr.getLoc(), S.Context)); in handleSharedAttr()
2409 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "shared"; in handleSharedAttr()
2413 static void handleGNUInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleGNUInlineAttr() argument
2415 if (!checkAttributeNumArgs(S, Attr, 0)) in handleGNUInlineAttr()
2420 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleGNUInlineAttr()
2426 S.Diag(Attr.getLoc(), diag::warn_gnu_inline_attribute_requires_inline); in handleGNUInlineAttr()
2430 D->addAttr(::new (S.Context) GNUInlineAttr(Attr.getLoc(), S.Context)); in handleGNUInlineAttr()
2433 static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleCallConvAttr() argument
2439 if (S.CheckCallingConvAttr(Attr, CC)) in handleCallConvAttr()
2443 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleCallConvAttr()
2450 D->addAttr(::new (S.Context) FastCallAttr(Attr.getLoc(), S.Context)); in handleCallConvAttr()
2453 D->addAttr(::new (S.Context) StdCallAttr(Attr.getLoc(), S.Context)); in handleCallConvAttr()
2456 D->addAttr(::new (S.Context) ThisCallAttr(Attr.getLoc(), S.Context)); in handleCallConvAttr()
2459 D->addAttr(::new (S.Context) CDeclAttr(Attr.getLoc(), S.Context)); in handleCallConvAttr()
2462 D->addAttr(::new (S.Context) PascalAttr(Attr.getLoc(), S.Context)); in handleCallConvAttr()
2468 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleCallConvAttr()
2481 S.Diag(Attr.getLoc(), diag::err_invalid_pcs); in handleCallConvAttr()
2486 D->addAttr(::new (S.Context) PcsAttr(Attr.getLoc(), S.Context, PCS)); in handleCallConvAttr()
2494 static void handleOpenCLKernelAttr(Sema &S, Decl *D, const AttributeList &Attr){ in handleOpenCLKernelAttr() argument
2496 D->addAttr(::new (S.Context) OpenCLKernelAttr(Attr.getLoc(), S.Context)); in handleOpenCLKernelAttr()
2545 static void handleRegparmAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleRegparmAttr() argument
2549 if (S.CheckRegparmAttr(Attr, numParams)) in handleRegparmAttr()
2553 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleRegparmAttr()
2558 D->addAttr(::new (S.Context) RegparmAttr(Attr.getLoc(), S.Context, numParams)); in handleRegparmAttr()
2601 static void handleLaunchBoundsAttr(Sema &S, Decl *D, const AttributeList &Attr){ in handleLaunchBoundsAttr() argument
2602 if (S.LangOpts.CUDA) { in handleLaunchBoundsAttr()
2606 S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 2; in handleLaunchBoundsAttr()
2611 S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) in handleLaunchBoundsAttr()
2620 !MaxThreadsExpr->isIntegerConstantExpr(MaxThreads, S.Context)) { in handleLaunchBoundsAttr()
2621 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleLaunchBoundsAttr()
2631 !MinBlocksExpr->isIntegerConstantExpr(MinBlocks, S.Context)) { in handleLaunchBoundsAttr()
2632 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int) in handleLaunchBoundsAttr()
2638 D->addAttr(::new (S.Context) CUDALaunchBoundsAttr(Attr.getLoc(), S.Context, in handleLaunchBoundsAttr()
2642 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "launch_bounds"; in handleLaunchBoundsAttr()
2650 static bool isValidSubjectOfNSAttribute(Sema &S, QualType type) { in isValidSubjectOfNSAttribute() argument
2651 return type->isObjCObjectPointerType() || S.Context.isObjCNSObjectType(type); in isValidSubjectOfNSAttribute()
2653 static bool isValidSubjectOfCFAttribute(Sema &S, QualType type) { in isValidSubjectOfCFAttribute() argument
2654 return type->isPointerType() || isValidSubjectOfNSAttribute(S, type); in isValidSubjectOfCFAttribute()
2657 static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleNSConsumedAttr() argument
2660 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSConsumedAttr()
2667 typeOK = isValidSubjectOfNSAttribute(S, param->getType()); in handleNSConsumedAttr()
2670 typeOK = isValidSubjectOfCFAttribute(S, param->getType()); in handleNSConsumedAttr()
2675 S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type) in handleNSConsumedAttr()
2681 param->addAttr(::new (S.Context) CFConsumedAttr(Attr.getLoc(), S.Context)); in handleNSConsumedAttr()
2683 param->addAttr(::new (S.Context) NSConsumedAttr(Attr.getLoc(), S.Context)); in handleNSConsumedAttr()
2686 static void handleNSConsumesSelfAttr(Sema &S, Decl *D, in handleNSConsumesSelfAttr() argument
2689 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSConsumesSelfAttr()
2694 D->addAttr(::new (S.Context) NSConsumesSelfAttr(Attr.getLoc(), S.Context)); in handleNSConsumesSelfAttr()
2697 static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, in handleNSReturnsRetainedAttr() argument
2706 else if (S.getLangOptions().ObjCAutoRefCount && hasDeclarator(D) && in handleNSReturnsRetainedAttr()
2712 S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) in handleNSReturnsRetainedAttr()
2725 typeOK = isValidSubjectOfNSAttribute(S, returnType); in handleNSReturnsRetainedAttr()
2731 typeOK = isValidSubjectOfCFAttribute(S, returnType); in handleNSReturnsRetainedAttr()
2737 S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type) in handleNSReturnsRetainedAttr()
2748 D->addAttr(::new (S.Context) NSReturnsAutoreleasedAttr(Attr.getLoc(), in handleNSReturnsRetainedAttr()
2749 S.Context)); in handleNSReturnsRetainedAttr()
2752 D->addAttr(::new (S.Context) CFReturnsNotRetainedAttr(Attr.getLoc(), in handleNSReturnsRetainedAttr()
2753 S.Context)); in handleNSReturnsRetainedAttr()
2756 D->addAttr(::new (S.Context) NSReturnsNotRetainedAttr(Attr.getLoc(), in handleNSReturnsRetainedAttr()
2757 S.Context)); in handleNSReturnsRetainedAttr()
2760 D->addAttr(::new (S.Context) CFReturnsRetainedAttr(Attr.getLoc(), in handleNSReturnsRetainedAttr()
2761 S.Context)); in handleNSReturnsRetainedAttr()
2764 D->addAttr(::new (S.Context) NSReturnsRetainedAttr(Attr.getLoc(), in handleNSReturnsRetainedAttr()
2765 S.Context)); in handleNSReturnsRetainedAttr()
2770 static void handleObjCOwnershipAttr(Sema &S, Decl *D, in handleObjCOwnershipAttr() argument
2775 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCOwnershipAttr()
2779 static void handleObjCPreciseLifetimeAttr(Sema &S, Decl *D, in handleObjCPreciseLifetimeAttr() argument
2783 S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) in handleObjCPreciseLifetimeAttr()
2793 S.Diag(Attr.getLoc(), diag::err_objc_precise_lifetime_bad_type) in handleObjCPreciseLifetimeAttr()
2817 S.Diag(Attr.getLoc(), diag::warn_objc_precise_lifetime_meaningless) in handleObjCPreciseLifetimeAttr()
2822 D->addAttr(::new (S.Context) in handleObjCPreciseLifetimeAttr()
2823 ObjCPreciseLifetimeAttr(Attr.getLoc(), S.Context)); in handleObjCPreciseLifetimeAttr()
2836 static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { in handleUuidAttr() argument
2837 if (S.LangOpts.Microsoft || S.LangOpts.Borland) { in handleUuidAttr()
2839 if (!checkAttributeNumArgs(S, Attr, 1)) in handleUuidAttr()
2845 S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string) in handleUuidAttr()
2857 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid); in handleUuidAttr()
2861 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid); in handleUuidAttr()
2874 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid); in handleUuidAttr()
2878 S.Diag(Attr.getLoc(), diag::err_attribute_uuid_malformed_guid); in handleUuidAttr()
2884 D->addAttr(::new (S.Context) UuidAttr(Attr.getLoc(), S.Context, in handleUuidAttr()
2887 S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "uuid"; in handleUuidAttr()
2894 static void ProcessNonInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, in ProcessNonInheritableDeclAttr() argument
2897 case AttributeList::AT_device: handleDeviceAttr (S, D, Attr); break; in ProcessNonInheritableDeclAttr()
2898 case AttributeList::AT_host: handleHostAttr (S, D, Attr); break; in ProcessNonInheritableDeclAttr()
2899 case AttributeList::AT_overloadable:handleOverloadableAttr(S, D, Attr); break; in ProcessNonInheritableDeclAttr()
2905 static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, in ProcessInheritableDeclAttr() argument
2908 case AttributeList::AT_IBAction: handleIBAction(S, D, Attr); break; in ProcessInheritableDeclAttr()
2909 case AttributeList::AT_IBOutlet: handleIBOutlet(S, D, Attr); break; in ProcessInheritableDeclAttr()
2911 handleIBOutletCollection(S, D, Attr); break; in ProcessInheritableDeclAttr()
2927 case AttributeList::AT_alias: handleAliasAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2928 case AttributeList::AT_aligned: handleAlignedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2930 handleAlwaysInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2932 handleAnalyzerNoReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2933 case AttributeList::AT_annotate: handleAnnotateAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2934 case AttributeList::AT_availability:handleAvailabilityAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2936 handleDependencyAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2937 case AttributeList::AT_common: handleCommonAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2938 case AttributeList::AT_constant: handleConstantAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2939 case AttributeList::AT_constructor: handleConstructorAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2940 case AttributeList::AT_deprecated: handleDeprecatedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2941 case AttributeList::AT_destructor: handleDestructorAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2943 handleExtVectorTypeAttr(S, scope, D, Attr); in ProcessInheritableDeclAttr()
2945 case AttributeList::AT_format: handleFormatAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2946 case AttributeList::AT_format_arg: handleFormatArgAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2947 case AttributeList::AT_global: handleGlobalAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2948 case AttributeList::AT_gnu_inline: handleGNUInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2950 handleLaunchBoundsAttr(S, D, Attr); in ProcessInheritableDeclAttr()
2952 case AttributeList::AT_mode: handleModeAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2953 case AttributeList::AT_malloc: handleMallocAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2954 case AttributeList::AT_may_alias: handleMayAliasAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2955 case AttributeList::AT_nocommon: handleNoCommonAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2956 case AttributeList::AT_nonnull: handleNonNullAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2960 handleOwnershipAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2961 case AttributeList::AT_naked: handleNakedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2962 case AttributeList::AT_noreturn: handleNoReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2963 case AttributeList::AT_nothrow: handleNothrowAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2964 case AttributeList::AT_shared: handleSharedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2965 case AttributeList::AT_vecreturn: handleVecReturnAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2968 handleObjCOwnershipAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2970 handleObjCPreciseLifetimeAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2974 case AttributeList::AT_ns_consumed: handleNSConsumedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2976 handleNSConsumesSelfAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2983 handleNSReturnsRetainedAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2986 handleReqdWorkGroupSize(S, D, Attr); break; in ProcessInheritableDeclAttr()
2989 handleInitPriorityAttr(S, D, Attr); break; in ProcessInheritableDeclAttr()
2991 case AttributeList::AT_packed: handlePackedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2992 case AttributeList::AT_MsStruct: handleMsStructAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2993 case AttributeList::AT_section: handleSectionAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2994 case AttributeList::AT_unavailable: handleUnavailableAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2996 handleArcWeakrefUnavailableAttr (S, D, Attr); in ProcessInheritableDeclAttr()
2998 case AttributeList::AT_unused: handleUnusedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
2999 case AttributeList::AT_used: handleUsedAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3000 case AttributeList::AT_visibility: handleVisibilityAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3001 case AttributeList::AT_warn_unused_result: handleWarnUnusedResult(S, D, Attr); in ProcessInheritableDeclAttr()
3003 case AttributeList::AT_weak: handleWeakAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3004 case AttributeList::AT_weakref: handleWeakRefAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3005 case AttributeList::AT_weak_import: handleWeakImportAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3007 handleTransparentUnionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3010 handleObjCExceptionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3013 handleObjCMethodFamilyAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3015 case AttributeList::AT_nsobject: handleObjCNSObject (S, D, Attr); break; in ProcessInheritableDeclAttr()
3016 case AttributeList::AT_blocks: handleBlocksAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3017 case AttributeList::AT_sentinel: handleSentinelAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3018 case AttributeList::AT_const: handleConstAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3019 case AttributeList::AT_pure: handlePureAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3020 case AttributeList::AT_cleanup: handleCleanupAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3021 case AttributeList::AT_nodebug: handleNoDebugAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3022 case AttributeList::AT_noinline: handleNoInlineAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3023 case AttributeList::AT_regparm: handleRegparmAttr (S, D, Attr); break; in ProcessInheritableDeclAttr()
3028 handleNoInstrumentFunctionAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3036 handleCallConvAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3039 handleOpenCLKernelAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3042 handleUuidAttr(S, D, Attr); in ProcessInheritableDeclAttr()
3046 const TargetAttributesSema &TargetAttrs = S.getTargetAttributesSema(); in ProcessInheritableDeclAttr()
3047 if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S)) in ProcessInheritableDeclAttr()
3048 S.Diag(Attr.getLoc(), diag::warn_unknown_attribute_ignored) in ProcessInheritableDeclAttr()
3058 static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, in ProcessDeclAttribute() argument
3069 ProcessNonInheritableDeclAttr(S, scope, D, Attr); in ProcessDeclAttribute()
3072 ProcessInheritableDeclAttr(S, scope, D, Attr); in ProcessDeclAttribute()
3077 void Sema::ProcessDeclAttributeList(Scope *S, Decl *D, in ProcessDeclAttributeList() argument
3081 ProcessDeclAttribute(*this, S, D, *l, NonInheritable, Inheritable); in ProcessDeclAttributeList()
3124 void Sema::DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W) { in DeclApplyPragmaWeak() argument
3138 PushOnScopeChains(NewD, S); in DeclApplyPragmaWeak()
3148 void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD, in ProcessDeclAttributes() argument
3159 DeclApplyPragmaWeak(S, ND, W); in ProcessDeclAttributes()
3168 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
3176 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
3180 ProcessDeclAttributeList(S, D, Attrs, NonInheritable, Inheritable); in ProcessDeclAttributes()
3184 static bool isForbiddenTypeAllowed(Sema &S, Decl *decl) { in isForbiddenTypeAllowed() argument
3192 return S.Context.getSourceManager().isInSystemHeader(decl->getLocation()); in isForbiddenTypeAllowed()
3196 static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &diag, in handleDelayedForbiddenType() argument
3198 if (decl && isForbiddenTypeAllowed(S, decl)) { in handleDelayedForbiddenType()
3199 decl->addAttr(new (S.Context) UnavailableAttr(diag.Loc, S.Context, in handleDelayedForbiddenType()
3204 S.Diag(diag.Loc, diag.getForbiddenTypeDiagnostic()) in handleDelayedForbiddenType()
3232 void Sema::DelayedDiagnostics::popParsingDecl(Sema &S, ParsingDeclState state, in popParsingDecl() argument
3234 DelayedDiagnostics &DD = S.DelayedDiagnostics; in popParsingDecl()
3265 S.HandleDelayedDeprecationCheck(diag, decl); in popParsingDecl()
3269 S.HandleDelayedAccessCheck(diag, decl); in popParsingDecl()
3273 handleDelayedForbiddenType(S, diag, decl); in popParsingDecl()