summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* In preparation for being able to use simple Boolean logic expressions ↵Aaron Ballman2014-04-041-15/+41
| | | | | | involving capabilities, the semantics for attributes now looks through the types of the constituent parts of a capability expression instead of at the aggregate expression type. llvm-svn: 205629
* Implement the 'optnone' attribute, which suppresses most optimizationsPaul Robinson2014-03-311-1/+24
| | | | | | on a function. llvm-svn: 205255
* Capability attributes can now be declared on a typedef declaration as well ↵Aaron Ballman2014-03-241-45/+60
| | | | | | as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability))) llvm-svn: 204657
* Replacing the exclusive_lock_function, shared_lock_function and ↵Aaron Ballman2014-03-201-67/+6
| | | | | | | | unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced. Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases. llvm-svn: 204350
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-171-4/+2
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204045
* Objective-C. Allow objc_designated_initializer for private Fariborz Jahanian2014-03-141-1/+5
| | | | | | | initializers; but only those declared in class extensions (not in implementations). // rdar://16305347 llvm-svn: 203954
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-101-24/+14
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203474
* [Sema] Fix assertion hit with #pragma weak.Argyrios Kyrtzidis2014-03-091-0/+2
| | | | | | rdar://16264844 llvm-svn: 203372
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-6/+4
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Reformatting the style used within the massive attribute semantic handling ↵Aaron Ballman2014-03-061-115/+245
| | | | | | | | switch statement, so now there is only one style used in this block of code, instead of three or more styles. No functional change intended. llvm-svn: 203120
* Remove 2 dead 'break' statements. The 'break' usage in this switch is ↵Ted Kremenek2014-03-061-2/+0
| | | | | | inconsistent, making this hard to see. llvm-svn: 203079
* Capabilities are required to pass a name specifying what type of capability ↵Aaron Ballman2014-03-051-1/+9
| | | | | | | | is being annotated. There are currently only two supported names: mutex and role. Adding functionality to check for the capability name and diagnose when it's unexpected. Note that for backwards compatibility, an unnamed capability will default to being a "mutex." This allows the deprecated lockable attribute to continue to function. llvm-svn: 203012
* Sema: Definition of dllimport globals is not allowedNico Rieck2014-02-261-9/+0
| | | | | | | Upgrades the warning to an error and clarifies the message by treating the definition as error instead of the attribute. llvm-svn: 202300
* Attr: Remove ForceInlineDavid Majnemer2014-02-251-2/+0
| | | | | | | | | | The __forceinline keyword's semantics are now recast as AlwaysInline and the kw___forceinline token has its language mode set for KEYMS. This preserves the semantics of the previous implementation but with less duplication of code. llvm-svn: 202131
* Reorganize and improve semantic tests for dllexport/importNico Rieck2014-02-221-2/+2
| | | | llvm-svn: 201947
* Exposing the noduplicate attribute within Clang, which marks functions so ↵Aaron Ballman2014-02-221-0/+2
| | | | | | | | that the optimizer does not duplicate code. Patch thanks to Marcello Maggioni! llvm-svn: 201941
* Per feedback from Aaron Ballman, push cast-to-ObjCProtocolDecl inside ↵Ted Kremenek2014-02-221-3/+3
| | | | | | handleObjCSuppresProtocolAttr(). llvm-svn: 201922
* Add requirement that attribute ↵Ted Kremenek2014-02-211-2/+8
| | | | | | 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions. llvm-svn: 201899
* Adding role-based capability attributes that allow you to express role ↵Aaron Ballman2014-02-211-2/+66
| | | | | | | | management: asserting a capability is held, acquiring a capability and releasing a capability. Also includes some skeleton documentation for these new attributes. This functionality should be considered a WIP. llvm-svn: 201890
* DeLesley Hutchins (who wrote the original thread-safety attribute ↵Aaron Ballman2014-02-181-51/+44
| | | | | | | | | | | | | | | functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used. The following attributes have been (silently) deprecated, with their replacements listed: lockable => capability exclusive_locks_required => requires_capability shared_locks_required => requires_shared_capability locks_excluded => requires_capability There are no functional changes intended. llvm-svn: 201585
* Sema: Restrict alignment to 2**28.David Majnemer2014-02-121-8/+6
| | | | | | | | Allowing alignment past this point causes wrap around within clang. N.B. GCC has the same restriction. llvm-svn: 201254
* 'nonnull(1)' on a block parameter should apply to the block's argument.Jordan Rose2014-02-111-17/+21
| | | | | | | | | | | | | | | Thanks to r199467, __attribute__((nonnull)) (without arguments) can apply directly to parameters, instead of being applied to the whole function. However, the old form of nonnull (with an argument index) could also apply to the arguments of function and block pointers, and both of these can be passed as parameters. Now, if 'nonnull' with an argument is found on a parameter, /and/ the parameter is a function or block pointer, it is handled the old way. PR18795 llvm-svn: 201162
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-101-7/+14
| | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 llvm-svn: 201105
* MS ABI: Don't be so hasty to judge an inheritance modelDavid Majnemer2014-02-071-9/+16
| | | | | | | | If we are in the middle of defining the class, don't attempt to validate previously annotated declarations. We may not have seen base specifiers or virtual method declarations yet. llvm-svn: 200959
* Sema: Diagnose improper application of inheritance keywordsDavid Majnemer2014-01-291-1/+66
| | | | | | | | | | | We would previously allow inappropriate inheritance keywords to appear on class declarations. We would also allow inheritance keywords on templates which were not fully specialized; this was divergent from MSVC. Differential Revision: http://llvm-reviews.chandlerc.com/D2585 llvm-svn: 200423
* Relaxing the alignment requirements for fields in a transparent_union. Emits ↵Aaron Ballman2014-01-281-1/+6
| | | | | | | | the diagnostic only when subsequent alignments are more strict than the alignment required by the first field. Fixes PR15134 llvm-svn: 200277
* Rename getResultLoc() tooAlp Toker2014-01-251-1/+1
| | | | | | | | Follow up to r200082. Spotted by Dmitri llvm-svn: 200105
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-12/+13
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Correct various uses of 'argument' that in fact refer to function parametersAlp Toker2014-01-211-32/+31
| | | | | | Cleanup only. llvm-svn: 199773
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-201-4/+5
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* Formatting cleanups; no functional changes.Aaron Ballman2014-01-201-6/+4
| | | | llvm-svn: 199671
* Fixing a typo (turned out to be harmless since the default priority values ↵Aaron Ballman2014-01-201-1/+1
| | | | | | are the same between the two attributes). llvm-svn: 199666
* Since the diagnostics engine understands Attr objects, this code is no ↵Aaron Ballman2014-01-201-10/+1
| | | | | | longer required -- we can just pass in the attribute directly. llvm-svn: 199664
* Making some minor improvements to r199626.Aaron Ballman2014-01-201-9/+3
| | | | llvm-svn: 199663
* Wire up basic parser/sema support for attribute 'returns_nonnull'.Ted Kremenek2014-01-201-2/+24
| | | | | | | | | | | This attribute is supported by GCC. More generally it should probably be a type attribute, but this behavior matches 'nonnull'. This patch does not include warning logic for checking if a null value is returned from a function annotated with this attribute. That will come in subsequent patches. llvm-svn: 199626
* These attributes are no longer "checker-specific."Ted Kremenek2014-01-201-1/+0
| | | | llvm-svn: 199625
* Enhance attribute 'nonnull' to be applicable to parameters directly (infix).Ted Kremenek2014-01-171-9/+39
| | | | | | | | | | | | | | | | | | | | | This allows the following syntax: void baz(__attribute__((nonnull)) const char *str); instead of: void baz(const char *str) __attribute__((nonnull(1))); This also extends to Objective-C methods. The checking logic in Sema is not as clean as I would like. Effectively now we need to check both the FunctionDecl/ObjCMethodDecl and the parameters, so the point of truth is spread in two places, but the logic isn't that cumbersome. Implements <rdar://problem/14691443>. llvm-svn: 199467
* Factored some function-like type reasoning out of SemaDeclAttr and onto Decl ↵Aaron Ballman2014-01-161-105/+12
| | | | | | itself. This allows for more declarative subjects in attribute tablegen where the attribute appertains to something function-like, but not strictly a FunctionDecl. llvm-svn: 199387
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-15/+24
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. llvm-svn: 199378
* Remove unused function to fix clang -Werror buildReid Kleckner2014-01-141-7/+0
| | | | llvm-svn: 199230
* Simplifying the OpenCL image attribute. It does not need a semantic integer ↵Aaron Ballman2014-01-141-8/+4
| | | | | | parameter because the required information is encoded in the spelling. Added an appropriate subject to the attribute, and simplified the semantic checking (which will likely be expanded upon in a future patch). Also, removed the GNU spelling since it was unsupported in the first place. llvm-svn: 199229
* Consumed analysis: add two new attributes which fine-tune the behavior ofDeLesley Hutchins2014-01-141-0/+7
| | | | | | | | consumable objects. These are useful for implementing error codes that must be checked. Patch also includes some significant refactoring, which was necesary to implement the new behavior. llvm-svn: 199169
* Add a new attribute 'enable_if' which can be used to control overload ↵Nick Lewycky2014-01-111-0/+29
| | | | | | resolution based on the values of the function arguments at the call site. llvm-svn: 198996
* Removing the notion of TargetAttributesSema and replacing it with one where ↵Aaron Ballman2014-01-091-32/+203
| | | | | | the parsed attributes are responsible for knowing their target-specific nature, instead of letting Sema figure it out. This is necessary so that __has_attribute can eventually determine whether a parsed attribute applies to the given target or not. llvm-svn: 198896
* Treating the RegParmAttr as a TypeAttr because that is what it is.Aaron Ballman2014-01-081-19/+1
| | | | | | Patch reviewed by Rafael Espindola. llvm-svn: 198765
* Simplifying the mutual exclusion check now that the diagnostics engine knows ↵Aaron Ballman2014-01-031-12/+7
| | | | | | how to handle Attr objects directly. Updates an associated test case due to the attribute name being properly quoted again. llvm-svn: 198424
* Removed an unnecessary %select from the alignas diagnostics. The attribute ↵Aaron Ballman2014-01-021-3/+2
| | | | | | already knows how it was spelled. llvm-svn: 198375
* Removing some more unnecessary manual quotes from attribute diagnostics. ↵Aaron Ballman2014-01-021-2/+2
| | | | | | Updated the associated testcase because QualType pretty printing was an improvement. llvm-svn: 198372
* Removing some more unnecessary manual quotes from attribute diagnostics.Aaron Ballman2014-01-021-4/+4
| | | | llvm-svn: 198371
* Updated the wording of two attribute-related diagnostics so that they print ↵Aaron Ballman2014-01-021-8/+16
| | | | | | the offending attribute name. Also updates the associated test cases. llvm-svn: 198355
OpenPOWER on IntegriCloud