1//////////////////////////////////////////////////////////////////////////////// 2// Note: This file is a work in progress. Please do not apply non-trivial 3// updates unless you have talked to Sean Hunt <rideau3@gmail.com> prior. 4// Merely adding a new attribute is a trivial update. 5//////////////////////////////////////////////////////////////////////////////// 6 7// An attribute's subject is whatever it appertains to. In this file, it is 8// more accurately a list of things that an attribute can appertain to. All 9// Decls and Stmts are possibly AttrSubjects (even though the syntax may not 10// allow attributes on a given Decl or Stmt). 11class AttrSubject; 12 13include "clang/Basic/DeclNodes.td" 14include "clang/Basic/StmtNodes.td" 15 16// A subset-subject is an AttrSubject constrained to operate only on some subset 17// of that subject. 18// 19// The description is used in output messages to specify what the subject 20// represents. FIXME: Deal with translation issues. 21// 22// The code fragment is a boolean expression that will confirm that the subject 23// meets the requirements; the subject will have the name S, and will have the 24// type specified by the base. It should be a simple boolean expression. 25class SubsetSubject<AttrSubject base, string description, code check> 26 : AttrSubject { 27 AttrSubject Base = base; 28 string Description = description; 29 code CheckCode = check; 30} 31 32// This is the type of a variable which C++0x defines [[aligned()]] as being 33// a possible subject. 34def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable", 35 [{S->getStorageClass() != VarDecl::Register && 36 S->getKind() != Decl::ImplicitParam && 37 S->getKind() != Decl::ParmVar && 38 S->getKind() != Decl::NonTypeTemplateParm}]>; 39def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function", 40 [{S->isVirtual()}]>; 41def NonBitField : SubsetSubject<Field, "non-bit field", 42 [{!S->isBitField()}]>; 43 44// A single argument to an attribute 45class Argument<string name> { 46 string Name = name; 47} 48 49class BoolArgument<string name> : Argument<name>; 50class IdentifierArgument<string name> : Argument<name>; 51class IntArgument<string name> : Argument<name>; 52class StringArgument<string name> : Argument<name>; 53class ExprArgument<string name> : Argument<name>; 54class FunctionArgument<string name> : Argument<name>; 55class TypeArgument<string name> : Argument<name>; 56class UnsignedArgument<string name> : Argument<name>; 57class SourceLocArgument<string name> : Argument<name>; 58class VariadicUnsignedArgument<string name> : Argument<name>; 59class VariadicExprArgument<string name> : Argument<name>; 60 61// A version of the form major.minor[.subminor]. 62class VersionArgument<string name> : Argument<name>; 63 64// This one's a doozy, so it gets its own special type 65// It can be an unsigned integer, or a type. Either can 66// be dependent. 67class AlignedArgument<string name> : Argument<name>; 68 69// An integer argument with a default value 70class DefaultIntArgument<string name, int default> : IntArgument<name> { 71 int Default = default; 72} 73 74// This argument is more complex, it includes the enumerator type name, 75// a list of strings to accept, and a list of enumerators to map them to. 76class EnumArgument<string name, string type, list<string> values, 77 list<string> enums> : Argument<name> { 78 string Type = type; 79 list<string> Values = values; 80 list<string> Enums = enums; 81} 82 83// This handles one spelling of an attribute. 84class Spelling<string name, string variety> { 85 string Name = name; 86 string Variety = variety; 87} 88 89class GNU<string name> : Spelling<name, "GNU">; 90class Declspec<string name> : Spelling<name, "Declspec">; 91class CXX11<string namespace, string name> : Spelling<name, "CXX11"> { 92 string Namespace = namespace; 93} 94 95class Attr { 96 // The various ways in which an attribute can be spelled in source 97 list<Spelling> Spellings; 98 // The things to which an attribute can appertain 99 list<AttrSubject> Subjects; 100 // The arguments allowed on an attribute 101 list<Argument> Args = []; 102 // Set to true for attributes with arguments which require delayed parsing. 103 bit LateParsed = 0; 104 // Set to false to prevent an attribute from being propagated from a template 105 // to the instantiation. 106 bit Clone = 1; 107 // Set to true for attributes which must be instantiated within templates 108 bit TemplateDependent = 0; 109 // Set to true for attributes that have a corresponding AST node. 110 bit ASTNode = 1; 111 // Set to true for attributes which have handler in Sema. 112 bit SemaHandler = 1; 113 // Set to true for attributes that are completely ignored. 114 bit Ignored = 0; 115 // Set to true if each of the spellings is a distinct attribute. 116 bit DistinctSpellings = 0; 117 // Any additional text that should be included verbatim in the class. 118 code AdditionalMembers = [{}]; 119} 120 121/// An inheritable attribute is inherited by later redeclarations. 122class InheritableAttr : Attr; 123 124/// An inheritable parameter attribute is inherited by later 125/// redeclarations, even when it's written on a parameter. 126class InheritableParamAttr : InheritableAttr; 127 128// 129// Attributes begin here 130// 131 132def AddressSpace : Attr { 133 let Spellings = [GNU<"address_space">]; 134 let Args = [IntArgument<"AddressSpace">]; 135 let ASTNode = 0; 136} 137 138def Alias : InheritableAttr { 139 let Spellings = [GNU<"alias">]; 140 let Args = [StringArgument<"Aliasee">]; 141} 142 143def Aligned : InheritableAttr { 144 let Spellings = [GNU<"aligned">, GNU<"align">]; 145 let Subjects = [NonBitField, NormalVar, Tag]; 146 let Args = [AlignedArgument<"Alignment">, BoolArgument<"IsMSDeclSpec">]; 147} 148 149def AlignMac68k : InheritableAttr { 150 let Spellings = []; 151 let SemaHandler = 0; 152} 153 154def AllocSize : Attr { 155 let Spellings = [GNU<"alloc_size">]; 156 let Args = [VariadicUnsignedArgument<"Args">]; 157} 158 159def AlwaysInline : InheritableAttr { 160 let Spellings = [GNU<"always_inline">]; 161} 162 163def TLSModel : InheritableAttr { 164 let Spellings = [GNU<"tls_model">]; 165 let Subjects = [Var]; 166 let Args = [StringArgument<"Model">]; 167} 168 169def AnalyzerNoReturn : InheritableAttr { 170 let Spellings = [GNU<"analyzer_noreturn">]; 171} 172 173def Annotate : InheritableParamAttr { 174 let Spellings = [GNU<"annotate">]; 175 let Args = [StringArgument<"Annotation">]; 176} 177 178def AsmLabel : InheritableAttr { 179 let Spellings = []; 180 let Args = [StringArgument<"Label">]; 181 let SemaHandler = 0; 182} 183 184def Availability : InheritableAttr { 185 let Spellings = [GNU<"availability">]; 186 let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">, 187 VersionArgument<"deprecated">, VersionArgument<"obsoleted">, 188 BoolArgument<"unavailable">, StringArgument<"message">]; 189 let AdditionalMembers = 190[{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) { 191 return llvm::StringSwitch<llvm::StringRef>(Platform) 192 .Case("ios", "iOS") 193 .Case("macosx", "Mac OS X") 194 .Default(llvm::StringRef()); 195} }]; 196} 197 198def Blocks : InheritableAttr { 199 let Spellings = [GNU<"blocks">]; 200 let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>]; 201} 202 203def Bounded : Attr { 204 let Spellings = [GNU<"bounded">]; 205 let ASTNode = 0; 206 let SemaHandler = 0; 207 let Ignored = 1; 208} 209 210def CarriesDependency : InheritableParamAttr { 211 let Spellings = [GNU<"carries_dependency">, CXX11<"","carries_dependency">, 212 CXX11<"std","carries_dependency">]; 213 let Subjects = [ParmVar, Function]; 214} 215 216def CDecl : InheritableAttr { 217 let Spellings = [GNU<"cdecl">, GNU<"__cdecl">]; 218} 219 220// cf_audited_transfer indicates that the given function has been 221// audited and has been marked with the appropriate cf_consumed and 222// cf_returns_retained attributes. It is generally applied by 223// '#pragma clang arc_cf_code_audited' rather than explicitly. 224def CFAuditedTransfer : InheritableAttr { 225 let Spellings = [GNU<"cf_audited_transfer">]; 226 let Subjects = [Function]; 227} 228 229// cf_unknown_transfer is an explicit opt-out of cf_audited_transfer. 230// It indicates that the function has unknown or unautomatable 231// transfer semantics. 232def CFUnknownTransfer : InheritableAttr { 233 let Spellings = [GNU<"cf_unknown_transfer">]; 234 let Subjects = [Function]; 235} 236 237def CFReturnsAutoreleased : Attr { 238 let Spellings = [GNU<"cf_returns_autoreleased">]; 239 let ASTNode = 0; 240} 241 242def CFReturnsRetained : InheritableAttr { 243 let Spellings = [GNU<"cf_returns_retained">]; 244 let Subjects = [ObjCMethod, Function]; 245} 246 247def CFReturnsNotRetained : InheritableAttr { 248 let Spellings = [GNU<"cf_returns_not_retained">]; 249 let Subjects = [ObjCMethod, Function]; 250} 251 252def CFConsumed : InheritableParamAttr { 253 let Spellings = [GNU<"cf_consumed">]; 254 let Subjects = [ParmVar]; 255} 256 257def Cleanup : InheritableAttr { 258 let Spellings = [GNU<"cleanup">]; 259 let Args = [FunctionArgument<"FunctionDecl">]; 260} 261 262def Cold : InheritableAttr { 263 let Spellings = [GNU<"cold">]; 264} 265 266def Common : InheritableAttr { 267 let Spellings = [GNU<"common">]; 268} 269 270def Const : InheritableAttr { 271 let Spellings = [GNU<"const">, GNU<"__const">]; 272} 273 274def Constructor : InheritableAttr { 275 let Spellings = [GNU<"constructor">]; 276 let Args = [IntArgument<"Priority">]; 277} 278 279def CUDAConstant : InheritableAttr { 280 let Spellings = [GNU<"constant">]; 281} 282 283def CUDADevice : InheritableAttr { 284 let Spellings = [GNU<"device">]; 285} 286 287def CUDAGlobal : InheritableAttr { 288 let Spellings = [GNU<"global">]; 289} 290 291def CUDAHost : InheritableAttr { 292 let Spellings = [GNU<"host">]; 293} 294 295def CUDALaunchBounds : InheritableAttr { 296 let Spellings = [GNU<"launch_bounds">]; 297 let Args = [IntArgument<"MaxThreads">, DefaultIntArgument<"MinBlocks", 0>]; 298} 299 300def CUDAShared : InheritableAttr { 301 let Spellings = [GNU<"shared">]; 302} 303 304def OpenCLKernel : Attr { 305 let Spellings = [GNU<"opencl_kernel_function">]; 306} 307 308def OpenCLImageAccess : Attr { 309 let Spellings = [GNU<"opencl_image_access">]; 310 let Args = [IntArgument<"Access">]; 311 let ASTNode = 0; 312} 313 314def Kernel : Attr { 315 let Spellings = [GNU<"kernel">]; 316} 317 318def Deprecated : InheritableAttr { 319 let Spellings = [GNU<"deprecated">]; 320 let Args = [StringArgument<"Message">]; 321} 322 323def Destructor : InheritableAttr { 324 let Spellings = [GNU<"destructor">]; 325 let Args = [IntArgument<"Priority">]; 326} 327 328def ExtVectorType : Attr { 329 let Spellings = [GNU<"ext_vector_type">]; 330 let Args = [ExprArgument<"NumElements">]; 331 let ASTNode = 0; 332} 333 334def FallThrough : Attr { 335 let Spellings = [CXX11<"clang","fallthrough">]; 336 let Subjects = [NullStmt]; 337} 338 339def FastCall : InheritableAttr { 340 let Spellings = [GNU<"fastcall">, GNU<"__fastcall">]; 341} 342 343def Final : InheritableAttr { 344 let Spellings = []; 345 let SemaHandler = 0; 346} 347 348def Format : InheritableAttr { 349 let Spellings = [GNU<"format">]; 350 let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">, 351 IntArgument<"FirstArg">]; 352} 353 354def FormatArg : InheritableAttr { 355 let Spellings = [GNU<"format_arg">]; 356 let Args = [IntArgument<"FormatIdx">]; 357} 358 359def GNUInline : InheritableAttr { 360 let Spellings = [GNU<"gnu_inline">]; 361} 362 363def Hot : InheritableAttr { 364 let Spellings = [GNU<"hot">]; 365} 366 367def IBAction : InheritableAttr { 368 let Spellings = [GNU<"ibaction">]; 369} 370 371def IBOutlet : InheritableAttr { 372 let Spellings = [GNU<"iboutlet">]; 373} 374 375def IBOutletCollection : InheritableAttr { 376 let Spellings = [GNU<"iboutletcollection">]; 377 let Args = [TypeArgument<"Interface">, SourceLocArgument<"InterfaceLoc">]; 378} 379 380def Malloc : InheritableAttr { 381 let Spellings = [GNU<"malloc">]; 382} 383 384def MaxFieldAlignment : InheritableAttr { 385 let Spellings = []; 386 let Args = [UnsignedArgument<"Alignment">]; 387 let SemaHandler = 0; 388} 389 390def MayAlias : InheritableAttr { 391 let Spellings = [GNU<"may_alias">]; 392} 393 394def MSP430Interrupt : InheritableAttr { 395 let Spellings = []; 396 let Args = [UnsignedArgument<"Number">]; 397 let SemaHandler = 0; 398} 399 400def MBlazeInterruptHandler : InheritableAttr { 401 let Spellings = []; 402 let SemaHandler = 0; 403} 404 405def MBlazeSaveVolatiles : InheritableAttr { 406 let Spellings = []; 407 let SemaHandler = 0; 408} 409 410def Mode : Attr { 411 let Spellings = [GNU<"mode">]; 412 let Args = [IdentifierArgument<"Mode">]; 413 let ASTNode = 0; 414} 415 416def Naked : InheritableAttr { 417 let Spellings = [GNU<"naked">]; 418} 419 420def NeonPolyVectorType : Attr { 421 let Spellings = [GNU<"neon_polyvector_type">]; 422 let Args = [IntArgument<"NumElements">]; 423 let ASTNode = 0; 424} 425 426def NeonVectorType : Attr { 427 let Spellings = [GNU<"neon_vector_type">]; 428 let Args = [IntArgument<"NumElements">]; 429 let ASTNode = 0; 430} 431 432def ReturnsTwice : InheritableAttr { 433 let Spellings = [GNU<"returns_twice">]; 434} 435 436def NoCommon : InheritableAttr { 437 let Spellings = [GNU<"nocommon">]; 438} 439 440def NoDebug : InheritableAttr { 441 let Spellings = [GNU<"nodebug">]; 442} 443 444def NoInline : InheritableAttr { 445 let Spellings = [GNU<"noinline">]; 446} 447 448def NonNull : InheritableAttr { 449 let Spellings = [GNU<"nonnull">]; 450 let Args = [VariadicUnsignedArgument<"Args">]; 451 let AdditionalMembers = 452[{bool isNonNull(unsigned idx) const { 453 for (args_iterator i = args_begin(), e = args_end(); 454 i != e; ++i) 455 if (*i == idx) 456 return true; 457 return false; 458 } }]; 459} 460 461def NoReturn : InheritableAttr { 462 let Spellings = [GNU<"noreturn">, CXX11<"","noreturn">, 463 CXX11<"std","noreturn">]; 464 // FIXME: Does GCC allow this on the function instead? 465 let Subjects = [Function]; 466} 467 468def NoInstrumentFunction : InheritableAttr { 469 let Spellings = [GNU<"no_instrument_function">]; 470 let Subjects = [Function]; 471} 472 473def NoThrow : InheritableAttr { 474 let Spellings = [GNU<"nothrow">]; 475} 476 477def NSBridged : InheritableAttr { 478 let Spellings = [GNU<"ns_bridged">]; 479 let Subjects = [Record]; 480 let Args = [IdentifierArgument<"BridgedType">]; 481} 482 483def NSReturnsRetained : InheritableAttr { 484 let Spellings = [GNU<"ns_returns_retained">]; 485 let Subjects = [ObjCMethod, Function]; 486} 487 488def NSReturnsNotRetained : InheritableAttr { 489 let Spellings = [GNU<"ns_returns_not_retained">]; 490 let Subjects = [ObjCMethod, Function]; 491} 492 493def NSReturnsAutoreleased : InheritableAttr { 494 let Spellings = [GNU<"ns_returns_autoreleased">]; 495 let Subjects = [ObjCMethod, Function]; 496} 497 498def NSConsumesSelf : InheritableAttr { 499 let Spellings = [GNU<"ns_consumes_self">]; 500 let Subjects = [ObjCMethod]; 501} 502 503def NSConsumed : InheritableParamAttr { 504 let Spellings = [GNU<"ns_consumed">]; 505 let Subjects = [ParmVar]; 506} 507 508def ObjCException : InheritableAttr { 509 let Spellings = [GNU<"objc_exception">]; 510} 511 512def ObjCMethodFamily : InheritableAttr { 513 let Spellings = [GNU<"objc_method_family">]; 514 let Subjects = [ObjCMethod]; 515 let Args = [EnumArgument<"Family", "FamilyKind", 516 ["none", "alloc", "copy", "init", "mutableCopy", "new"], 517 ["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init", 518 "OMF_mutableCopy", "OMF_new"]>]; 519} 520 521def ObjCNSObject : InheritableAttr { 522 let Spellings = [GNU<"NSObject">]; 523} 524 525def ObjCPreciseLifetime : Attr { 526 let Spellings = [GNU<"objc_precise_lifetime">]; 527 let Subjects = [Var]; 528} 529 530def ObjCReturnsInnerPointer : Attr { 531 let Spellings = [GNU<"objc_returns_inner_pointer">]; 532 let Subjects = [ObjCMethod]; 533} 534 535def ObjCRequiresSuper : InheritableAttr { 536 let Spellings = [GNU<"objc_requires_super">]; 537 let Subjects = [ObjCMethod]; 538} 539 540def ObjCRootClass : Attr { 541 let Spellings = [GNU<"objc_root_class">]; 542 let Subjects = [ObjCInterface]; 543} 544 545def Overloadable : Attr { 546 let Spellings = [GNU<"overloadable">]; 547} 548 549def Override : InheritableAttr { 550 let Spellings = []; 551 let SemaHandler = 0; 552} 553 554def Ownership : InheritableAttr { 555 let Spellings = [GNU<"ownership_holds">, GNU<"ownership_returns">, 556 GNU<"ownership_takes">]; 557 let DistinctSpellings = 1; 558 let Args = [EnumArgument<"OwnKind", "OwnershipKind", 559 ["ownership_holds", "ownership_returns", "ownership_takes"], 560 ["Holds", "Returns", "Takes"]>, 561 StringArgument<"Module">, VariadicUnsignedArgument<"Args">]; 562} 563 564def Packed : InheritableAttr { 565 let Spellings = [GNU<"packed">]; 566} 567 568def Pcs : InheritableAttr { 569 let Spellings = [GNU<"pcs">]; 570 let Args = [EnumArgument<"PCS", "PCSType", 571 ["aapcs", "aapcs-vfp"], 572 ["AAPCS", "AAPCS_VFP"]>]; 573} 574 575def Pure : InheritableAttr { 576 let Spellings = [GNU<"pure">]; 577} 578 579def Regparm : InheritableAttr { 580 let Spellings = [GNU<"regparm">]; 581 let Args = [UnsignedArgument<"NumParams">]; 582} 583 584def ReqdWorkGroupSize : InheritableAttr { 585 let Spellings = [GNU<"reqd_work_group_size">]; 586 let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">, 587 UnsignedArgument<"ZDim">]; 588} 589 590def WorkGroupSizeHint : InheritableAttr { 591 let Spellings = [GNU<"work_group_size_hint">]; 592 let Args = [UnsignedArgument<"XDim">, 593 UnsignedArgument<"YDim">, 594 UnsignedArgument<"ZDim">]; 595} 596 597def InitPriority : InheritableAttr { 598 let Spellings = [GNU<"init_priority">]; 599 let Args = [UnsignedArgument<"Priority">]; 600} 601 602def Section : InheritableAttr { 603 let Spellings = [GNU<"section">]; 604 let Args = [StringArgument<"Name">]; 605} 606 607def Sentinel : InheritableAttr { 608 let Spellings = [GNU<"sentinel">]; 609 let Args = [DefaultIntArgument<"Sentinel", 0>, 610 DefaultIntArgument<"NullPos", 0>]; 611} 612 613def StdCall : InheritableAttr { 614 let Spellings = [GNU<"stdcall">, GNU<"__stdcall">]; 615} 616 617def ThisCall : InheritableAttr { 618 let Spellings = [GNU<"thiscall">, GNU<"__thiscall">]; 619} 620 621def Pascal : InheritableAttr { 622 let Spellings = [GNU<"pascal">]; 623} 624 625def TransparentUnion : InheritableAttr { 626 let Spellings = [GNU<"transparent_union">]; 627} 628 629def Unavailable : InheritableAttr { 630 let Spellings = [GNU<"unavailable">]; 631 let Args = [StringArgument<"Message">]; 632} 633 634def ArcWeakrefUnavailable : InheritableAttr { 635 let Spellings = [GNU<"objc_arc_weak_reference_unavailable">]; 636 let Subjects = [ObjCInterface]; 637} 638 639def ObjCGC : Attr { 640 let Spellings = [GNU<"objc_gc">]; 641 let Args = [IdentifierArgument<"Kind">]; 642 let ASTNode = 0; 643} 644 645def ObjCOwnership : Attr { 646 let Spellings = [GNU<"objc_ownership">]; 647 let Args = [IdentifierArgument<"Kind">]; 648 let ASTNode = 0; 649} 650 651def ObjCRequiresPropertyDefs : InheritableAttr { 652 let Spellings = [GNU<"objc_requires_property_definitions">]; 653 let Subjects = [ObjCInterface]; 654} 655 656def Unused : InheritableAttr { 657 let Spellings = [GNU<"unused">]; 658} 659 660def Used : InheritableAttr { 661 let Spellings = [GNU<"used">]; 662} 663 664def Uuid : InheritableAttr { 665 let Spellings = [GNU<"uuid">]; 666 let Args = [StringArgument<"Guid">]; 667 let Subjects = [CXXRecord]; 668} 669 670def VectorSize : Attr { 671 let Spellings = [GNU<"vector_size">]; 672 let Args = [ExprArgument<"NumBytes">]; 673 let ASTNode = 0; 674} 675 676def VecTypeHint : Attr { 677 let Spellings = [GNU<"vec_type_hint">]; 678 let ASTNode = 0; 679 let SemaHandler = 0; 680 let Ignored = 1; 681} 682 683def Visibility : InheritableAttr { 684 let Clone = 0; 685 let Spellings = [GNU<"visibility">]; 686 let Args = [EnumArgument<"Visibility", "VisibilityType", 687 ["default", "hidden", "internal", "protected"], 688 ["Default", "Hidden", "Hidden", "Protected"]>]; 689} 690 691def VecReturn : InheritableAttr { 692 let Spellings = [GNU<"vecreturn">]; 693 let Subjects = [CXXRecord]; 694} 695 696def WarnUnusedResult : InheritableAttr { 697 let Spellings = [GNU<"warn_unused_result">]; 698} 699 700def Weak : InheritableAttr { 701 let Spellings = [GNU<"weak">]; 702} 703 704def WeakImport : InheritableAttr { 705 let Spellings = [GNU<"weak_import">]; 706} 707 708def WeakRef : InheritableAttr { 709 let Spellings = [GNU<"weakref">]; 710} 711 712def X86ForceAlignArgPointer : InheritableAttr { 713 let Spellings = []; 714} 715 716// AddressSafety attribute (e.g. for AddressSanitizer) 717def NoAddressSafetyAnalysis : InheritableAttr { 718 let Spellings = [GNU<"no_address_safety_analysis">]; 719} 720 721// C/C++ Thread safety attributes (e.g. for deadlock, data race checking) 722 723def GuardedVar : InheritableAttr { 724 let Spellings = [GNU<"guarded_var">]; 725} 726 727def PtGuardedVar : InheritableAttr { 728 let Spellings = [GNU<"pt_guarded_var">]; 729} 730 731def Lockable : InheritableAttr { 732 let Spellings = [GNU<"lockable">]; 733} 734 735def ScopedLockable : InheritableAttr { 736 let Spellings = [GNU<"scoped_lockable">]; 737} 738 739def NoThreadSafetyAnalysis : InheritableAttr { 740 let Spellings = [GNU<"no_thread_safety_analysis">]; 741} 742 743def GuardedBy : InheritableAttr { 744 let Spellings = [GNU<"guarded_by">]; 745 let Args = [ExprArgument<"Arg">]; 746 let LateParsed = 1; 747 let TemplateDependent = 1; 748} 749 750def PtGuardedBy : InheritableAttr { 751 let Spellings = [GNU<"pt_guarded_by">]; 752 let Args = [ExprArgument<"Arg">]; 753 let LateParsed = 1; 754 let TemplateDependent = 1; 755} 756 757def AcquiredAfter : InheritableAttr { 758 let Spellings = [GNU<"acquired_after">]; 759 let Args = [VariadicExprArgument<"Args">]; 760 let LateParsed = 1; 761 let TemplateDependent = 1; 762} 763 764def AcquiredBefore : InheritableAttr { 765 let Spellings = [GNU<"acquired_before">]; 766 let Args = [VariadicExprArgument<"Args">]; 767 let LateParsed = 1; 768 let TemplateDependent = 1; 769} 770 771def ExclusiveLockFunction : InheritableAttr { 772 let Spellings = [GNU<"exclusive_lock_function">]; 773 let Args = [VariadicExprArgument<"Args">]; 774 let LateParsed = 1; 775 let TemplateDependent = 1; 776} 777 778def SharedLockFunction : InheritableAttr { 779 let Spellings = [GNU<"shared_lock_function">]; 780 let Args = [VariadicExprArgument<"Args">]; 781 let LateParsed = 1; 782 let TemplateDependent = 1; 783} 784 785// The first argument is an integer or boolean value specifying the return value 786// of a successful lock acquisition. 787def ExclusiveTrylockFunction : InheritableAttr { 788 let Spellings = [GNU<"exclusive_trylock_function">]; 789 let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">]; 790 let LateParsed = 1; 791 let TemplateDependent = 1; 792} 793 794// The first argument is an integer or boolean value specifying the return value 795// of a successful lock acquisition. 796def SharedTrylockFunction : InheritableAttr { 797 let Spellings = [GNU<"shared_trylock_function">]; 798 let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">]; 799 let LateParsed = 1; 800 let TemplateDependent = 1; 801} 802 803def UnlockFunction : InheritableAttr { 804 let Spellings = [GNU<"unlock_function">]; 805 let Args = [VariadicExprArgument<"Args">]; 806 let LateParsed = 1; 807 let TemplateDependent = 1; 808} 809 810def LockReturned : InheritableAttr { 811 let Spellings = [GNU<"lock_returned">]; 812 let Args = [ExprArgument<"Arg">]; 813 let LateParsed = 1; 814 let TemplateDependent = 1; 815} 816 817def LocksExcluded : InheritableAttr { 818 let Spellings = [GNU<"locks_excluded">]; 819 let Args = [VariadicExprArgument<"Args">]; 820 let LateParsed = 1; 821 let TemplateDependent = 1; 822} 823 824def ExclusiveLocksRequired : InheritableAttr { 825 let Spellings = [GNU<"exclusive_locks_required">]; 826 let Args = [VariadicExprArgument<"Args">]; 827 let LateParsed = 1; 828 let TemplateDependent = 1; 829} 830 831def SharedLocksRequired : InheritableAttr { 832 let Spellings = [GNU<"shared_locks_required">]; 833 let Args = [VariadicExprArgument<"Args">]; 834 let LateParsed = 1; 835 let TemplateDependent = 1; 836} 837 838// Type safety attributes for `void *' pointers and type tags. 839 840def ArgumentWithTypeTag : InheritableAttr { 841 let Spellings = [GNU<"argument_with_type_tag">, 842 GNU<"pointer_with_type_tag">]; 843 let Args = [IdentifierArgument<"ArgumentKind">, 844 UnsignedArgument<"ArgumentIdx">, 845 UnsignedArgument<"TypeTagIdx">, 846 BoolArgument<"IsPointer">]; 847 let Subjects = [Function]; 848} 849 850def TypeTagForDatatype : InheritableAttr { 851 let Spellings = [GNU<"type_tag_for_datatype">]; 852 let Args = [IdentifierArgument<"ArgumentKind">, 853 TypeArgument<"MatchingCType">, 854 BoolArgument<"LayoutCompatible">, 855 BoolArgument<"MustBeNull">]; 856 let Subjects = [Var]; 857} 858 859// Microsoft-related attributes 860 861def MsStruct : InheritableAttr { 862 let Spellings = [Declspec<"ms_struct">]; 863} 864 865def DLLExport : InheritableAttr { 866 let Spellings = [Declspec<"dllexport">]; 867} 868 869def DLLImport : InheritableAttr { 870 let Spellings = [Declspec<"dllimport">]; 871} 872 873def ForceInline : InheritableAttr { 874 let Spellings = [Declspec<"__forceinline">]; 875} 876 877def Win64 : InheritableAttr { 878 let Spellings = [Declspec<"w64">]; 879} 880 881def Ptr32 : InheritableAttr { 882 let Spellings = [Declspec<"__ptr32">]; 883} 884 885def Ptr64 : InheritableAttr { 886 let Spellings = [Declspec<"__ptr64">]; 887} 888 889def SingleInheritance : InheritableAttr { 890 let Spellings = [Declspec<"__single_inheritance">]; 891} 892 893def MultipleInheritance : InheritableAttr { 894 let Spellings = [Declspec<"__multiple_inheritance">]; 895} 896 897def VirtualInheritance : InheritableAttr { 898 let Spellings = [Declspec<"__virtual_inheritance">]; 899} 900