Skip to content

Commit 802de4f

Browse files
committedDec 14, 2017
Harmonize GNU- and C++-style attribute spellings.
Most attributes will now use the Clang<"name"> construct to provide both __attribute__((name)) and [[clang::name]] syntaxes for the attribute. Attributes deviating from this should be marked with a comment explaining why they are not supported under both spellings. Common reasons are: the attribute is provided by some other specification that controls the syntax or the attribute cannot be exposed under a particular spelling for some given reason. Because this is a mechanical change that only introduces new spellings, there are no test cases for the commit. llvm-svn: 320752
1 parent d15d76e commit 802de4f

File tree

2 files changed

+121
-87
lines changed

2 files changed

+121
-87
lines changed
 

‎clang/docs/ReleaseNotes.rst

+6
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ Clang now supports the ...
149149
Attribute Changes in Clang
150150
--------------------------
151151

152+
- Clang now supports the majority of its attributes under both the GNU-style
153+
spelling (``__attribute((name))``) and the double square-bracket spelling
154+
in the ``clang`` vendor namespace (``[[clang::name]]``). Attributes whose
155+
syntax is specified by some other standard (such as CUDA and OpenCL
156+
attributes) continue to follow their respective specification.
157+
152158
- Added the ``__has_c_attribute()`` builtin preprocessor macro which allows
153159
users to dynamically detect whether a double square-bracket attribute is
154160
supported in C mode. This attribute syntax can be enabled with the

‎clang/include/clang/Basic/Attr.td

+115-87
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def AbiTag : Attr {
513513
}
514514

515515
def AddressSpace : TypeAttr {
516-
let Spellings = [GNU<"address_space">];
516+
let Spellings = [Clang<"address_space">];
517517
let Args = [IntArgument<"AddressSpace">];
518518
let Documentation = [Undocumented];
519519
}
@@ -545,6 +545,9 @@ def AlignValue : Attr {
545545
// the future (and a corresponding C++ attribute), but this can be done
546546
// later once we decide if we also want them to have slightly-different
547547
// semantics than Intel's align_value.
548+
//
549+
// Does not get a [[]] spelling because the attribute is not exposed as such
550+
// by Intel.
548551
GNU<"align_value">
549552
// Intel's compiler on Windows also supports:
550553
// , Declspec<"align_value">
@@ -593,12 +596,15 @@ def TLSModel : InheritableAttr {
593596
}
594597

595598
def AnalyzerNoReturn : InheritableAttr {
599+
// TODO: should this attribute be exposed with a [[]] spelling under the clang
600+
// vendor namespace, or should it use a vendor namespace specific to the
601+
// analyzer?
596602
let Spellings = [GNU<"analyzer_noreturn">];
597603
let Documentation = [Undocumented];
598604
}
599605

600606
def Annotate : InheritableParamAttr {
601-
let Spellings = [GNU<"annotate">];
607+
let Spellings = [Clang<"annotate">];
602608
let Args = [StringArgument<"Annotation">];
603609
// Ensure that the annotate attribute can be used with
604610
// '#pragma clang attribute' even though it has no subject list.
@@ -640,6 +646,8 @@ def AsmLabel : InheritableAttr {
640646
}
641647

642648
def Availability : InheritableAttr {
649+
// TODO: does not have a [[]] spelling because it requires custom parsing
650+
// support.
643651
let Spellings = [GNU<"availability">];
644652
let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">,
645653
VersionArgument<"deprecated">, VersionArgument<"obsoleted">,
@@ -700,12 +708,13 @@ def ExternalSourceSymbol : InheritableAttr {
700708
}
701709

702710
def Blocks : InheritableAttr {
703-
let Spellings = [GNU<"blocks">];
711+
let Spellings = [Clang<"blocks">];
704712
let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
705713
let Documentation = [Undocumented];
706714
}
707715

708716
def Bounded : IgnoredAttr {
717+
// Does not have a [[]] spelling because the attribute is ignored.
709718
let Spellings = [GNU<"bounded">];
710719
}
711720

@@ -727,7 +736,7 @@ def CDecl : InheritableAttr {
727736
// cf_returns_retained attributes. It is generally applied by
728737
// '#pragma clang arc_cf_code_audited' rather than explicitly.
729738
def CFAuditedTransfer : InheritableAttr {
730-
let Spellings = [GNU<"cf_audited_transfer">];
739+
let Spellings = [Clang<"cf_audited_transfer">];
731740
let Subjects = SubjectList<[Function], ErrorDiag>;
732741
let Documentation = [Undocumented];
733742
}
@@ -736,25 +745,25 @@ def CFAuditedTransfer : InheritableAttr {
736745
// It indicates that the function has unknown or unautomatable
737746
// transfer semantics.
738747
def CFUnknownTransfer : InheritableAttr {
739-
let Spellings = [GNU<"cf_unknown_transfer">];
748+
let Spellings = [Clang<"cf_unknown_transfer">];
740749
let Subjects = SubjectList<[Function], ErrorDiag>;
741750
let Documentation = [Undocumented];
742751
}
743752

744753
def CFReturnsRetained : InheritableAttr {
745-
let Spellings = [GNU<"cf_returns_retained">];
754+
let Spellings = [Clang<"cf_returns_retained">];
746755
// let Subjects = SubjectList<[ObjCMethod, ObjCProperty, Function]>;
747756
let Documentation = [Undocumented];
748757
}
749758

750759
def CFReturnsNotRetained : InheritableAttr {
751-
let Spellings = [GNU<"cf_returns_not_retained">];
760+
let Spellings = [Clang<"cf_returns_not_retained">];
752761
// let Subjects = SubjectList<[ObjCMethod, ObjCProperty, Function]>;
753762
let Documentation = [Undocumented];
754763
}
755764

756765
def CFConsumed : InheritableParamAttr {
757-
let Spellings = [GNU<"cf_consumed">];
766+
let Spellings = [Clang<"cf_consumed">];
758767
let Subjects = SubjectList<[ParmVar]>;
759768
let Documentation = [Undocumented];
760769
}
@@ -790,8 +799,8 @@ def Constructor : InheritableAttr {
790799
let Documentation = [Undocumented];
791800
}
792801

793-
// CUDA attributes are spelled __attribute__((attr)) or __declspec(__attr__).
794-
802+
// CUDA attributes are spelled __attribute__((attr)) or __declspec(__attr__),
803+
// and they do not receive a [[]] spelling.
795804
def CUDAConstant : InheritableAttr {
796805
let Spellings = [GNU<"constant">, Declspec<"__constant__">];
797806
let Subjects = SubjectList<[Var]>;
@@ -875,11 +884,13 @@ def C11NoReturn : InheritableAttr {
875884
}
876885

877886
def CXX11NoReturn : InheritableAttr {
878-
let Spellings = [CXX11<"","noreturn", 200809>];
887+
let Spellings = [CXX11<"", "noreturn", 200809>];
879888
let Subjects = SubjectList<[Function], ErrorDiag>;
880889
let Documentation = [CXX11NoReturnDocs];
881890
}
882891

892+
// Similar to CUDA, OpenCL attributes do not receive a [[]] spelling because
893+
// the specification does not expose them with one currently.
883894
def OpenCLKernel : InheritableAttr {
884895
let Spellings = [Keyword<"__kernel">, Keyword<"kernel">];
885896
let Subjects = SubjectList<[Function], ErrorDiag>;
@@ -988,6 +999,9 @@ def AllocSize : InheritableAttr {
988999
}
9891000

9901001
def EnableIf : InheritableAttr {
1002+
// Does not have a [[]] spelling because this attribute requires the ability
1003+
// to parse function arguments but the attribute is not written in the type
1004+
// position.
9911005
let Spellings = [GNU<"enable_if">];
9921006
let Subjects = SubjectList<[Function]>;
9931007
let Args = [ExprArgument<"Cond">, StringArgument<"Message">];
@@ -996,6 +1010,7 @@ def EnableIf : InheritableAttr {
9961010
}
9971011

9981012
def ExtVectorType : Attr {
1013+
// This is an OpenCL-related attribute and does not receive a [[]] spelling.
9991014
let Spellings = [GNU<"ext_vector_type">];
10001015
let Subjects = SubjectList<[TypedefName], ErrorDiag>;
10011016
let Args = [ExprArgument<"NumElements">];
@@ -1030,13 +1045,13 @@ def Final : InheritableAttr {
10301045
}
10311046

10321047
def MinSize : InheritableAttr {
1033-
let Spellings = [GNU<"minsize">];
1048+
let Spellings = [Clang<"minsize">];
10341049
let Subjects = SubjectList<[Function, ObjCMethod], ErrorDiag>;
10351050
let Documentation = [Undocumented];
10361051
}
10371052

10381053
def FlagEnum : InheritableAttr {
1039-
let Spellings = [GNU<"flag_enum">];
1054+
let Spellings = [Clang<"flag_enum">];
10401055
let Subjects = SubjectList<[Enum]>;
10411056
let Documentation = [FlagEnumDocs];
10421057
}
@@ -1085,7 +1100,7 @@ def Hot : InheritableAttr {
10851100
}
10861101

10871102
def IBAction : InheritableAttr {
1088-
let Spellings = [GNU<"ibaction">];
1103+
let Spellings = [Clang<"ibaction">];
10891104
let Subjects = SubjectList<[ObjCInstanceMethod]>;
10901105
// An AST node is created for this attribute, but is not used by other parts
10911106
// of the compiler. However, this node needs to exist in the AST because
@@ -1094,13 +1109,13 @@ def IBAction : InheritableAttr {
10941109
}
10951110

10961111
def IBOutlet : InheritableAttr {
1097-
let Spellings = [GNU<"iboutlet">];
1112+
let Spellings = [Clang<"iboutlet">];
10981113
// let Subjects = [ObjCIvar, ObjCProperty];
10991114
let Documentation = [Undocumented];
11001115
}
11011116

11021117
def IBOutletCollection : InheritableAttr {
1103-
let Spellings = [GNU<"iboutletcollection">];
1118+
let Spellings = [Clang<"iboutletcollection">];
11041119
let Args = [TypeArgument<"Interface", 1>];
11051120
// let Subjects = [ObjCIvar, ObjCProperty];
11061121
let Documentation = [Undocumented];
@@ -1210,13 +1225,13 @@ def Naked : InheritableAttr {
12101225
}
12111226

12121227
def NeonPolyVectorType : TypeAttr {
1213-
let Spellings = [GNU<"neon_polyvector_type">];
1228+
let Spellings = [Clang<"neon_polyvector_type">];
12141229
let Args = [IntArgument<"NumElements">];
12151230
let Documentation = [Undocumented];
12161231
}
12171232

12181233
def NeonVectorType : TypeAttr {
1219-
let Spellings = [GNU<"neon_vector_type">];
1234+
let Spellings = [Clang<"neon_vector_type">];
12201235
let Args = [IntArgument<"NumElements">];
12211236
let Documentation = [Undocumented];
12221237
}
@@ -1299,28 +1314,28 @@ def NoMicroMips : InheritableAttr, TargetSpecificAttr<TargetMips32> {
12991314
// this should be rejected on non-kernels.
13001315

13011316
def AMDGPUFlatWorkGroupSize : InheritableAttr {
1302-
let Spellings = [GNU<"amdgpu_flat_work_group_size">];
1317+
let Spellings = [Clang<"amdgpu_flat_work_group_size">];
13031318
let Args = [UnsignedArgument<"Min">, UnsignedArgument<"Max">];
13041319
let Documentation = [AMDGPUFlatWorkGroupSizeDocs];
13051320
let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
13061321
}
13071322

13081323
def AMDGPUWavesPerEU : InheritableAttr {
1309-
let Spellings = [GNU<"amdgpu_waves_per_eu">];
1324+
let Spellings = [Clang<"amdgpu_waves_per_eu">];
13101325
let Args = [UnsignedArgument<"Min">, UnsignedArgument<"Max", 1>];
13111326
let Documentation = [AMDGPUWavesPerEUDocs];
13121327
let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
13131328
}
13141329

13151330
def AMDGPUNumSGPR : InheritableAttr {
1316-
let Spellings = [GNU<"amdgpu_num_sgpr">];
1331+
let Spellings = [Clang<"amdgpu_num_sgpr">];
13171332
let Args = [UnsignedArgument<"NumSGPR">];
13181333
let Documentation = [AMDGPUNumSGPRNumVGPRDocs];
13191334
let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
13201335
}
13211336

13221337
def AMDGPUNumVGPR : InheritableAttr {
1323-
let Spellings = [GNU<"amdgpu_num_vgpr">];
1338+
let Spellings = [Clang<"amdgpu_num_vgpr">];
13241339
let Args = [UnsignedArgument<"NumVGPR">];
13251340
let Documentation = [AMDGPUNumSGPRNumVGPRDocs];
13261341
let Subjects = SubjectList<[Function], ErrorDiag, "kernel functions">;
@@ -1360,7 +1375,7 @@ def ReturnsNonNull : InheritableAttr {
13601375
// pass_object_size(N) indicates that the parameter should have
13611376
// __builtin_object_size with Type=N evaluated on the parameter at the callsite.
13621377
def PassObjectSize : InheritableParamAttr {
1363-
let Spellings = [GNU<"pass_object_size">];
1378+
let Spellings = [Clang<"pass_object_size">];
13641379
let Args = [IntArgument<"Type">];
13651380
let Subjects = SubjectList<[ParmVar]>;
13661381
let Documentation = [PassObjectSizeDocs];
@@ -1433,26 +1448,29 @@ def NoThrow : InheritableAttr {
14331448

14341449
def NvWeak : IgnoredAttr {
14351450
// No Declspec spelling of this attribute; the CUDA headers use
1436-
// __attribute__((nv_weak)) unconditionally.
1451+
// __attribute__((nv_weak)) unconditionally. Does not receive an [[]]
1452+
// spelling because it is a CUDA attribute.
14371453
let Spellings = [GNU<"nv_weak">];
14381454
let LangOpts = [CUDA];
14391455
}
14401456

14411457
def ObjCBridge : InheritableAttr {
1442-
let Spellings = [GNU<"objc_bridge">];
1458+
let Spellings = [Clang<"objc_bridge">];
14431459
let Subjects = SubjectList<[Record, TypedefName], ErrorDiag>;
14441460
let Args = [IdentifierArgument<"BridgedType">];
14451461
let Documentation = [Undocumented];
14461462
}
14471463

14481464
def ObjCBridgeMutable : InheritableAttr {
1449-
let Spellings = [GNU<"objc_bridge_mutable">];
1465+
let Spellings = [Clang<"objc_bridge_mutable">];
14501466
let Subjects = SubjectList<[Record], ErrorDiag>;
14511467
let Args = [IdentifierArgument<"BridgedType">];
14521468
let Documentation = [Undocumented];
14531469
}
14541470

14551471
def ObjCBridgeRelated : InheritableAttr {
1472+
// TODO: this attribute does not have a [[]] spelling because it requires
1473+
// custom parsing support.
14561474
let Spellings = [GNU<"objc_bridge_related">];
14571475
let Subjects = SubjectList<[Record], ErrorDiag>;
14581476
let Args = [IdentifierArgument<"RelatedClass">,
@@ -1463,43 +1481,43 @@ def ObjCBridgeRelated : InheritableAttr {
14631481
}
14641482

14651483
def NSReturnsRetained : InheritableAttr {
1466-
let Spellings = [GNU<"ns_returns_retained">];
1484+
let Spellings = [Clang<"ns_returns_retained">];
14671485
// let Subjects = SubjectList<[ObjCMethod, ObjCProperty, Function]>;
14681486
let Documentation = [Undocumented];
14691487
}
14701488

14711489
def NSReturnsNotRetained : InheritableAttr {
1472-
let Spellings = [GNU<"ns_returns_not_retained">];
1490+
let Spellings = [Clang<"ns_returns_not_retained">];
14731491
// let Subjects = SubjectList<[ObjCMethod, ObjCProperty, Function]>;
14741492
let Documentation = [Undocumented];
14751493
}
14761494

14771495
def NSReturnsAutoreleased : InheritableAttr {
1478-
let Spellings = [GNU<"ns_returns_autoreleased">];
1496+
let Spellings = [Clang<"ns_returns_autoreleased">];
14791497
// let Subjects = SubjectList<[ObjCMethod, ObjCProperty, Function]>;
14801498
let Documentation = [Undocumented];
14811499
}
14821500

14831501
def NSConsumesSelf : InheritableAttr {
1484-
let Spellings = [GNU<"ns_consumes_self">];
1502+
let Spellings = [Clang<"ns_consumes_self">];
14851503
let Subjects = SubjectList<[ObjCMethod]>;
14861504
let Documentation = [Undocumented];
14871505
}
14881506

14891507
def NSConsumed : InheritableParamAttr {
1490-
let Spellings = [GNU<"ns_consumed">];
1508+
let Spellings = [Clang<"ns_consumed">];
14911509
let Subjects = SubjectList<[ParmVar]>;
14921510
let Documentation = [Undocumented];
14931511
}
14941512

14951513
def ObjCException : InheritableAttr {
1496-
let Spellings = [GNU<"objc_exception">];
1514+
let Spellings = [Clang<"objc_exception">];
14971515
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
14981516
let Documentation = [Undocumented];
14991517
}
15001518

15011519
def ObjCMethodFamily : InheritableAttr {
1502-
let Spellings = [GNU<"objc_method_family">];
1520+
let Spellings = [Clang<"objc_method_family">];
15031521
let Subjects = SubjectList<[ObjCMethod], ErrorDiag>;
15041522
let Args = [EnumArgument<"Family", "FamilyKind",
15051523
["none", "alloc", "copy", "init", "mutableCopy", "new"],
@@ -1509,72 +1527,72 @@ def ObjCMethodFamily : InheritableAttr {
15091527
}
15101528

15111529
def ObjCNSObject : InheritableAttr {
1512-
let Spellings = [GNU<"NSObject">];
1530+
let Spellings = [Clang<"NSObject">];
15131531
let Documentation = [Undocumented];
15141532
}
15151533

15161534
def ObjCIndependentClass : InheritableAttr {
1517-
let Spellings = [GNU<"objc_independent_class">];
1535+
let Spellings = [Clang<"objc_independent_class">];
15181536
let Documentation = [Undocumented];
15191537
}
15201538

15211539
def ObjCPreciseLifetime : InheritableAttr {
1522-
let Spellings = [GNU<"objc_precise_lifetime">];
1540+
let Spellings = [Clang<"objc_precise_lifetime">];
15231541
let Subjects = SubjectList<[Var], ErrorDiag>;
15241542
let Documentation = [Undocumented];
15251543
}
15261544

15271545
def ObjCReturnsInnerPointer : InheritableAttr {
1528-
let Spellings = [GNU<"objc_returns_inner_pointer">];
1546+
let Spellings = [Clang<"objc_returns_inner_pointer">];
15291547
let Subjects = SubjectList<[ObjCMethod, ObjCProperty], ErrorDiag>;
15301548
let Documentation = [Undocumented];
15311549
}
15321550

15331551
def ObjCRequiresSuper : InheritableAttr {
1534-
let Spellings = [GNU<"objc_requires_super">];
1552+
let Spellings = [Clang<"objc_requires_super">];
15351553
let Subjects = SubjectList<[ObjCMethod], ErrorDiag>;
15361554
let Documentation = [ObjCRequiresSuperDocs];
15371555
}
15381556

15391557
def ObjCRootClass : InheritableAttr {
1540-
let Spellings = [GNU<"objc_root_class">];
1558+
let Spellings = [Clang<"objc_root_class">];
15411559
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
15421560
let Documentation = [Undocumented];
15431561
}
15441562

15451563
def ObjCSubclassingRestricted : InheritableAttr {
1546-
let Spellings = [GNU<"objc_subclassing_restricted">];
1564+
let Spellings = [Clang<"objc_subclassing_restricted">];
15471565
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
15481566
let Documentation = [ObjCSubclassingRestrictedDocs];
15491567
}
15501568

15511569
def ObjCExplicitProtocolImpl : InheritableAttr {
1552-
let Spellings = [GNU<"objc_protocol_requires_explicit_implementation">];
1570+
let Spellings = [Clang<"objc_protocol_requires_explicit_implementation">];
15531571
let Subjects = SubjectList<[ObjCProtocol], ErrorDiag>;
15541572
let Documentation = [Undocumented];
15551573
}
15561574

15571575
def ObjCDesignatedInitializer : Attr {
1558-
let Spellings = [GNU<"objc_designated_initializer">];
1576+
let Spellings = [Clang<"objc_designated_initializer">];
15591577
let Subjects = SubjectList<[ObjCInterfaceDeclInitMethod], ErrorDiag>;
15601578
let Documentation = [Undocumented];
15611579
}
15621580

15631581
def ObjCRuntimeName : Attr {
1564-
let Spellings = [GNU<"objc_runtime_name">];
1582+
let Spellings = [Clang<"objc_runtime_name">];
15651583
let Subjects = SubjectList<[ObjCInterface, ObjCProtocol], ErrorDiag>;
15661584
let Args = [StringArgument<"MetadataName">];
15671585
let Documentation = [ObjCRuntimeNameDocs];
15681586
}
15691587

15701588
def ObjCRuntimeVisible : Attr {
1571-
let Spellings = [GNU<"objc_runtime_visible">];
1589+
let Spellings = [Clang<"objc_runtime_visible">];
15721590
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
15731591
let Documentation = [ObjCRuntimeVisibleDocs];
15741592
}
15751593

15761594
def ObjCBoxable : Attr {
1577-
let Spellings = [GNU<"objc_boxable">];
1595+
let Spellings = [Clang<"objc_boxable">];
15781596
let Subjects = SubjectList<[Record], ErrorDiag>;
15791597
let Documentation = [ObjCBoxableDocs];
15801598
}
@@ -1586,7 +1604,7 @@ def OptimizeNone : InheritableAttr {
15861604
}
15871605

15881606
def Overloadable : Attr {
1589-
let Spellings = [GNU<"overloadable">];
1607+
let Spellings = [Clang<"overloadable">];
15901608
let Subjects = SubjectList<[Function], ErrorDiag>;
15911609
let Documentation = [OverloadableDocs];
15921610
}
@@ -1598,11 +1616,11 @@ def Override : InheritableAttr {
15981616
}
15991617

16001618
def Ownership : InheritableAttr {
1601-
let Spellings = [GNU<"ownership_holds">, GNU<"ownership_returns">,
1602-
GNU<"ownership_takes">];
1603-
let Accessors = [Accessor<"isHolds", [GNU<"ownership_holds">]>,
1604-
Accessor<"isReturns", [GNU<"ownership_returns">]>,
1605-
Accessor<"isTakes", [GNU<"ownership_takes">]>];
1619+
let Spellings = [Clang<"ownership_holds">, Clang<"ownership_returns">,
1620+
Clang<"ownership_takes">];
1621+
let Accessors = [Accessor<"isHolds", [Clang<"ownership_holds">]>,
1622+
Accessor<"isReturns", [Clang<"ownership_returns">]>,
1623+
Accessor<"isTakes", [Clang<"ownership_takes">]>];
16061624
let AdditionalMembers = [{
16071625
enum OwnershipKind { Holds, Returns, Takes };
16081626
OwnershipKind getOwnKind() const {
@@ -1623,7 +1641,7 @@ def Packed : InheritableAttr {
16231641
}
16241642

16251643
def IntelOclBicc : InheritableAttr {
1626-
let Spellings = [GNU<"intel_ocl_bicc">];
1644+
let Spellings = [Clang<"intel_ocl_bicc">];
16271645
// let Subjects = [Function, ObjCMethod];
16281646
let Documentation = [Undocumented];
16291647
}
@@ -1649,6 +1667,7 @@ def Regparm : TypeAttr {
16491667
}
16501668

16511669
def ReqdWorkGroupSize : InheritableAttr {
1670+
// Does not have a [[]] spelling because it is an OpenCL-related attribute.
16521671
let Spellings = [GNU<"reqd_work_group_size">];
16531672
let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">,
16541673
UnsignedArgument<"ZDim">];
@@ -1664,6 +1683,7 @@ def RequireConstantInit : InheritableAttr {
16641683
}
16651684

16661685
def WorkGroupSizeHint : InheritableAttr {
1686+
// Does not have a [[]] spelling because it is an OpenCL-related attribute.
16671687
let Spellings = [GNU<"work_group_size_hint">];
16681688
let Args = [UnsignedArgument<"XDim">,
16691689
UnsignedArgument<"YDim">,
@@ -1734,23 +1754,23 @@ def StdCall : InheritableAttr {
17341754
}
17351755

17361756
def SwiftCall : InheritableAttr {
1737-
let Spellings = [GNU<"swiftcall">];
1757+
let Spellings = [Clang<"swiftcall">];
17381758
// let Subjects = SubjectList<[Function]>;
17391759
let Documentation = [SwiftCallDocs];
17401760
}
17411761

17421762
def SwiftContext : ParameterABIAttr {
1743-
let Spellings = [GNU<"swift_context">];
1763+
let Spellings = [Clang<"swift_context">];
17441764
let Documentation = [SwiftContextDocs];
17451765
}
17461766

17471767
def SwiftErrorResult : ParameterABIAttr {
1748-
let Spellings = [GNU<"swift_error_result">];
1768+
let Spellings = [Clang<"swift_error_result">];
17491769
let Documentation = [SwiftErrorResultDocs];
17501770
}
17511771

17521772
def SwiftIndirectResult : ParameterABIAttr {
1753-
let Spellings = [GNU<"swift_indirect_result">];
1773+
let Spellings = [Clang<"swift_indirect_result">];
17541774
let Documentation = [SwiftIndirectResultDocs];
17551775
}
17561776

@@ -1774,25 +1794,25 @@ def ThisCall : InheritableAttr {
17741794
}
17751795

17761796
def VectorCall : InheritableAttr {
1777-
let Spellings = [GNU<"vectorcall">, Keyword<"__vectorcall">,
1797+
let Spellings = [Clang<"vectorcall">, Keyword<"__vectorcall">,
17781798
Keyword<"_vectorcall">];
17791799
// let Subjects = [Function, ObjCMethod];
17801800
let Documentation = [VectorCallDocs];
17811801
}
17821802

17831803
def Pascal : InheritableAttr {
1784-
let Spellings = [GNU<"pascal">, Keyword<"__pascal">, Keyword<"_pascal">];
1804+
let Spellings = [Clang<"pascal">, Keyword<"__pascal">, Keyword<"_pascal">];
17851805
// let Subjects = [Function, ObjCMethod];
17861806
let Documentation = [Undocumented];
17871807
}
17881808

17891809
def PreserveMost : InheritableAttr {
1790-
let Spellings = [GNU<"preserve_most">];
1810+
let Spellings = [Clang<"preserve_most">];
17911811
let Documentation = [PreserveMostDocs];
17921812
}
17931813

17941814
def PreserveAll : InheritableAttr {
1795-
let Spellings = [GNU<"preserve_all">];
1815+
let Spellings = [Clang<"preserve_all">];
17961816
let Documentation = [PreserveAllDocs];
17971817
}
17981818

@@ -1853,7 +1873,7 @@ def TransparentUnion : InheritableAttr {
18531873
}
18541874

18551875
def Unavailable : InheritableAttr {
1856-
let Spellings = [GNU<"unavailable">];
1876+
let Spellings = [Clang<"unavailable">];
18571877
let Args = [StringArgument<"Message", 1>,
18581878
EnumArgument<"ImplicitReason", "ImplicitReason",
18591879
["", "", "", ""],
@@ -1867,6 +1887,9 @@ def Unavailable : InheritableAttr {
18671887
}
18681888

18691889
def DiagnoseIf : InheritableAttr {
1890+
// Does not have a [[]] spelling because this attribute requires the ability
1891+
// to parse function arguments but the attribute is not written in the type
1892+
// position.
18701893
let Spellings = [GNU<"diagnose_if">];
18711894
let Subjects = SubjectList<[Function, ObjCMethod, ObjCProperty]>;
18721895
let Args = [ExprArgument<"Cond">, StringArgument<"Message">,
@@ -1887,26 +1910,26 @@ def DiagnoseIf : InheritableAttr {
18871910
}
18881911

18891912
def ArcWeakrefUnavailable : InheritableAttr {
1890-
let Spellings = [GNU<"objc_arc_weak_reference_unavailable">];
1913+
let Spellings = [Clang<"objc_arc_weak_reference_unavailable">];
18911914
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
18921915
let Documentation = [Undocumented];
18931916
}
18941917

18951918
def ObjCGC : TypeAttr {
1896-
let Spellings = [GNU<"objc_gc">];
1919+
let Spellings = [Clang<"objc_gc">];
18971920
let Args = [IdentifierArgument<"Kind">];
18981921
let Documentation = [Undocumented];
18991922
}
19001923

19011924
def ObjCOwnership : InheritableAttr {
1902-
let Spellings = [GNU<"objc_ownership">];
1925+
let Spellings = [Clang<"objc_ownership">];
19031926
let Args = [IdentifierArgument<"Kind">];
19041927
let ASTNode = 0;
19051928
let Documentation = [Undocumented];
19061929
}
19071930

19081931
def ObjCRequiresPropertyDefs : InheritableAttr {
1909-
let Spellings = [GNU<"objc_requires_property_definitions">];
1932+
let Spellings = [Clang<"objc_requires_property_definitions">];
19101933
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
19111934
let Documentation = [Undocumented];
19121935
}
@@ -1941,6 +1964,7 @@ def VectorSize : TypeAttr {
19411964
}
19421965

19431966
def VecTypeHint : InheritableAttr {
1967+
// Does not have a [[]] spelling because it is an OpenCL-related attribute.
19441968
let Spellings = [GNU<"vec_type_hint">];
19451969
let Args = [TypeArgument<"TypeHint">];
19461970
let Subjects = SubjectList<[Function], ErrorDiag>;
@@ -1968,7 +1992,7 @@ def TypeVisibility : InheritableAttr {
19681992
}
19691993

19701994
def VecReturn : InheritableAttr {
1971-
let Spellings = [GNU<"vecreturn">];
1995+
let Spellings = [Clang<"vecreturn">];
19721996
let Subjects = SubjectList<[CXXRecord], ErrorDiag>;
19731997
let Documentation = [Undocumented];
19741998
}
@@ -1994,7 +2018,7 @@ def Weak : InheritableAttr {
19942018
}
19952019

19962020
def WeakImport : InheritableAttr {
1997-
let Spellings = [GNU<"weak_import">];
2021+
let Spellings = [Clang<"weak_import">];
19982022
let Documentation = [Undocumented];
19992023
}
20002024

@@ -2007,7 +2031,7 @@ def WeakRef : InheritableAttr {
20072031
}
20082032

20092033
def LTOVisibilityPublic : InheritableAttr {
2010-
let Spellings = [CXX11<"clang", "lto_visibility_public">];
2034+
let Spellings = [Clang<"lto_visibility_public">];
20112035
let Subjects = SubjectList<[Record]>;
20122036
let Documentation = [LTOVisibilityDocs];
20132037
}
@@ -2060,23 +2084,27 @@ def NoSanitizeSpecific : InheritableAttr {
20602084
let Spellings = [GCC<"no_address_safety_analysis">,
20612085
GCC<"no_sanitize_address">,
20622086
GCC<"no_sanitize_thread">,
2063-
GNU<"no_sanitize_memory">];
2087+
Clang<"no_sanitize_memory">];
20642088
let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag>;
20652089
let Documentation = [NoSanitizeAddressDocs, NoSanitizeThreadDocs,
20662090
NoSanitizeMemoryDocs];
20672091
let ASTNode = 0;
20682092
}
20692093

20702094
// C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
2071-
2095+
// Not all of these attributes will be given a [[]] spelling. The attributes
2096+
// which require access to function parameter names cannot use the [[]] spelling
2097+
// because they are not written in the type position. Some attributes are given
2098+
// an updated captability-based name and the older name will only be supported
2099+
// under the GNU-style spelling.
20722100
def GuardedVar : InheritableAttr {
2073-
let Spellings = [GNU<"guarded_var">];
2101+
let Spellings = [Clang<"guarded_var">];
20742102
let Subjects = SubjectList<[Field, SharedVar]>;
20752103
let Documentation = [Undocumented];
20762104
}
20772105

20782106
def PtGuardedVar : InheritableAttr {
2079-
let Spellings = [GNU<"pt_guarded_var">];
2107+
let Spellings = [Clang<"pt_guarded_var">];
20802108
let Subjects = SubjectList<[Field, SharedVar]>;
20812109
let Documentation = [Undocumented];
20822110
}
@@ -2089,7 +2117,7 @@ def Lockable : InheritableAttr {
20892117
}
20902118

20912119
def ScopedLockable : InheritableAttr {
2092-
let Spellings = [GNU<"scoped_lockable">];
2120+
let Spellings = [Clang<"scoped_lockable">];
20932121
let Subjects = SubjectList<[Record]>;
20942122
let Documentation = [Undocumented];
20952123
}
@@ -2157,7 +2185,7 @@ def ReleaseCapability : InheritableAttr {
21572185
let Spellings = [Clang<"release_capability">,
21582186
Clang<"release_shared_capability">,
21592187
Clang<"release_generic_capability">,
2160-
GNU<"unlock_function">];
2188+
Clang<"unlock_function">];
21612189
let Subjects = SubjectList<[Function]>;
21622190
let LateParsed = 1;
21632191
let TemplateDependent = 1;
@@ -2168,28 +2196,28 @@ def ReleaseCapability : InheritableAttr {
21682196
[Clang<"release_shared_capability">]>,
21692197
Accessor<"isGeneric",
21702198
[Clang<"release_generic_capability">,
2171-
GNU<"unlock_function">]>];
2199+
Clang<"unlock_function">]>];
21722200
let Documentation = [ReleaseCapabilityDocs];
21732201
}
21742202

21752203
def RequiresCapability : InheritableAttr {
21762204
let Spellings = [Clang<"requires_capability">,
2177-
GNU<"exclusive_locks_required">,
2205+
Clang<"exclusive_locks_required">,
21782206
Clang<"requires_shared_capability">,
2179-
GNU<"shared_locks_required">];
2207+
Clang<"shared_locks_required">];
21802208
let Args = [VariadicExprArgument<"Args">];
21812209
let LateParsed = 1;
21822210
let TemplateDependent = 1;
21832211
let ParseArgumentsAsUnevaluated = 1;
21842212
let DuplicatesAllowedWhileMerging = 1;
21852213
let Subjects = SubjectList<[Function]>;
21862214
let Accessors = [Accessor<"isShared", [Clang<"requires_shared_capability">,
2187-
GNU<"shared_locks_required">]>];
2215+
Clang<"shared_locks_required">]>];
21882216
let Documentation = [Undocumented];
21892217
}
21902218

21912219
def NoThreadSafetyAnalysis : InheritableAttr {
2192-
let Spellings = [GNU<"no_thread_safety_analysis">];
2220+
let Spellings = [Clang<"no_thread_safety_analysis">];
21932221
let Subjects = SubjectList<[Function]>;
21942222
let Documentation = [Undocumented];
21952223
}
@@ -2310,7 +2338,7 @@ def LocksExcluded : InheritableAttr {
23102338
// C/C++ consumed attributes.
23112339

23122340
def Consumable : InheritableAttr {
2313-
let Spellings = [GNU<"consumable">];
2341+
let Spellings = [Clang<"consumable">];
23142342
let Subjects = SubjectList<[CXXRecord]>;
23152343
let Args = [EnumArgument<"DefaultState", "ConsumedState",
23162344
["unknown", "consumed", "unconsumed"],
@@ -2319,19 +2347,19 @@ def Consumable : InheritableAttr {
23192347
}
23202348

23212349
def ConsumableAutoCast : InheritableAttr {
2322-
let Spellings = [GNU<"consumable_auto_cast_state">];
2350+
let Spellings = [Clang<"consumable_auto_cast_state">];
23232351
let Subjects = SubjectList<[CXXRecord]>;
23242352
let Documentation = [Undocumented];
23252353
}
23262354

23272355
def ConsumableSetOnRead : InheritableAttr {
2328-
let Spellings = [GNU<"consumable_set_state_on_read">];
2356+
let Spellings = [Clang<"consumable_set_state_on_read">];
23292357
let Subjects = SubjectList<[CXXRecord]>;
23302358
let Documentation = [Undocumented];
23312359
}
23322360

23332361
def CallableWhen : InheritableAttr {
2334-
let Spellings = [GNU<"callable_when">];
2362+
let Spellings = [Clang<"callable_when">];
23352363
let Subjects = SubjectList<[CXXMethod]>;
23362364
let Args = [VariadicEnumArgument<"CallableStates", "ConsumedState",
23372365
["unknown", "consumed", "unconsumed"],
@@ -2340,7 +2368,7 @@ def CallableWhen : InheritableAttr {
23402368
}
23412369

23422370
def ParamTypestate : InheritableAttr {
2343-
let Spellings = [GNU<"param_typestate">];
2371+
let Spellings = [Clang<"param_typestate">];
23442372
let Subjects = SubjectList<[ParmVar]>;
23452373
let Args = [EnumArgument<"ParamState", "ConsumedState",
23462374
["unknown", "consumed", "unconsumed"],
@@ -2349,7 +2377,7 @@ def ParamTypestate : InheritableAttr {
23492377
}
23502378

23512379
def ReturnTypestate : InheritableAttr {
2352-
let Spellings = [GNU<"return_typestate">];
2380+
let Spellings = [Clang<"return_typestate">];
23532381
let Subjects = SubjectList<[Function, ParmVar]>;
23542382
let Args = [EnumArgument<"State", "ConsumedState",
23552383
["unknown", "consumed", "unconsumed"],
@@ -2358,7 +2386,7 @@ def ReturnTypestate : InheritableAttr {
23582386
}
23592387

23602388
def SetTypestate : InheritableAttr {
2361-
let Spellings = [GNU<"set_typestate">];
2389+
let Spellings = [Clang<"set_typestate">];
23622390
let Subjects = SubjectList<[CXXMethod]>;
23632391
let Args = [EnumArgument<"NewState", "ConsumedState",
23642392
["unknown", "consumed", "unconsumed"],
@@ -2367,7 +2395,7 @@ def SetTypestate : InheritableAttr {
23672395
}
23682396

23692397
def TestTypestate : InheritableAttr {
2370-
let Spellings = [GNU<"test_typestate">];
2398+
let Spellings = [Clang<"test_typestate">];
23712399
let Subjects = SubjectList<[CXXMethod]>;
23722400
let Args = [EnumArgument<"TestState", "ConsumedState",
23732401
["consumed", "unconsumed"],

0 commit comments

Comments
 (0)
Please sign in to comment.