summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Removed a string literal for a diagnostic, and updated the diagnostic to not ↵Aaron Ballman2013-12-271-1/+1
| | | | | | manually quote. No functional changes intended. llvm-svn: 198076
* Teach the diagnostics engine about the Attr type to make reporting on ↵Aaron Ballman2013-12-261-10/+8
| | | | | | semantic attributes easier (and not require hard-coded strings). This requires a getSpelling() function on the Attr class, which is table-driven. Updates a handful of cases where a hard-coded string was being used to test the functionality out. Updating associated test cases for the improved quoting. llvm-svn: 198055
* Removed a string literal for an attribute name, which means the attribute ↵Aaron Ballman2013-12-261-1/+1
| | | | | | name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate. llvm-svn: 198054
* This diagnostic did not accept arguments, and did not have any test ↵Aaron Ballman2013-12-261-2/+2
| | | | | | | | coverage. Parameterized the diagnostic, and made it more consistent with other attribute diagnostic wordings. Added test coverage. Since this warning was generalized, it was also given a sensible warning group flag and the corresponding test was updated to reflect this. llvm-svn: 198053
* Simplifying some diagnostics so that they don't need to work with ↵Aaron Ballman2013-12-261-25/+18
| | | | | | StringRefs. No functional changes intended. llvm-svn: 198051
* Getting rid of a string literal in favor of the generalized diagnostic.Aaron Ballman2013-12-261-1/+1
| | | | llvm-svn: 198050
* No need for the manual quotes and extra getName() call. No functional ↵Aaron Ballman2013-12-261-1/+1
| | | | | | changes intended. llvm-svn: 198047
* Removing some unneeded code, and a diagnostic that was obsoleted. The type ↵Aaron Ballman2013-12-261-19/+15
| | | | | | | | has already been determined to be a ValueDecl by virtue of the attribute subjects. Added some test case coverage as well. llvm-svn: 198046
* Consolidating some mode attribute diagnostics. No functional changes intended.Aaron Ballman2013-12-231-2/+2
| | | | llvm-svn: 197911
* Removing the alloc_size attribute. The attribute was semantically handled, ↵Aaron Ballman2013-12-211-42/+0
| | | | | | but silently ignored. Most of this feature was already reverted in June 2012 (r159016), this just cleans up the pieces left over. llvm-svn: 197866
* The const and nothrow attributes can be handled by the simple attribute ↵Aaron Ballman2013-12-211-24/+4
| | | | | | handler. This removes a silent dropping of the attributes when they are duplicated on a Decl. llvm-svn: 197864
* Remove dead code identified by Aaron Ballman.Ted Kremenek2013-12-191-4/+0
| | | | llvm-svn: 197730
* After discussing with John McCall, removing the ns_bridged attribute as it ↵Aaron Ballman2013-12-191-28/+0
| | | | | | is unused. llvm-svn: 197729
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-6/+4
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Added a comment about the launch_bounds attribute's AST node being required. ↵Aaron Ballman2013-12-191-4/+8
| | | | | | Since there were no test cases for the attribute, some have been added. This promptly demonstrated a bug with the semantic handling, which is also fixed. llvm-svn: 197637
* Refactor the Microsoft inheritance attribute handling so that it no longer ↵Aaron Ballman2013-12-181-6/+2
| | | | | | has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes. llvm-svn: 197629
* Implemented delayed processing of 'unavailable' checking, just like with ↵Ted Kremenek2013-12-181-44/+109
| | | | | | | | | | | | | | | | | | | | | | | | | 'deprecated'. Fixes <rdar://problem/15584219> and <rdar://problem/12241361>. This change looks large, but all it does is reuse and consolidate the delayed diagnostic logic for deprecation warnings with unavailability warnings. By doing so, it showed various inconsistencies between the diagnostics, which were close, but not consistent. It also revealed some missing "note:"'s in the deprecated diagnostics that were showing up in the unavailable diagnostics, etc. This change also changes the wording of the core deprecation diagnostics. Instead of saying "function has been explicitly marked deprecated" we now saw "'X' has been been explicitly marked deprecated". It turns out providing a bit more context is useful, and often we got the actual term wrong or it was not very precise (e.g., "function" instead of "destructor"). By just saying the name of the thing that is deprecated/deleted/unavailable we define this issue away. This diagnostic can likely be further wordsmithed to be shorter. llvm-svn: 197627
* [OpenCL] Produce an error when the work group and vec type hint attributesJoey Gouly2013-12-131-0/+19
| | | | | | | | are used on non-kernel functions. Reviewed by Aaron over IRC! llvm-svn: 197243
* Added a Subjects clause to the section attribute and made its diagnostics ↵Aaron Ballman2013-12-121-6/+0
| | | | | | more consistent with other attributes. llvm-svn: 197104
* Rename attribute 'objc_suppress_protocol_methods' to ↵Ted Kremenek2013-12-101-10/+3
| | | | | | | | | | | | | | | 'objc_protocol_requires_explicit_implementation'. That's a mouthful, and not necessarily the final name. This also reflects a semantic change where this attribute is now on the protocol itself instead of a class. This attribute will require that a protocol, when adopted by a class, is explicitly implemented by the class itself (instead of walking the super class chain). Note that this attribute is not "done". This should be considered a WIP. llvm-svn: 196955
* Add a SubsetSubject in Attr.td to automate checking of where the ↵Argyrios Kyrtzidis2013-12-071-17/+2
| | | | | | | | objc_designated_initializer attribute is acceptable. llvm-svn: 196644
* Turning the __w64 attribute into an ignored attribute to match other ↵Aaron Ballman2013-12-061-2/+0
| | | | | | Microsoft extensions we do not currently support. Note that __w64 has been deprecated in MSVC since 2008. llvm-svn: 196592
* ObjectiveC - Introducing objc_bridge_related attribute Fariborz Jahanian2013-12-041-0/+21
| | | | | | | | which specifies couple of (optional) method selectors for bridging a CFobject to or from an ObjectiveC object. This is wip. // rdsr://15499111 llvm-svn: 196408
* [objc] Introduce ObjCInterfaceDecl::getDesignatedInitializers() to get theArgyrios Kyrtzidis2013-12-031-2/+4
| | | | | | | | | | designated initializers of an interface. If the interface declaration does not have methods marked as designated initializers then the interface inherits the designated initializers of its super class. llvm-svn: 196315
* [objc] Introduce attribute 'objc_designated_initializer'.Argyrios Kyrtzidis2013-12-031-0/+25
| | | | | | It only applies to methods of init family in an interface declaration. llvm-svn: 196314
* Refactored the work group-related attributes to use a template, which ↵Aaron Ballman2013-12-021-33/+10
| | | | | | reduces the amount of duplicate code in the handler. No functional change intended. llvm-svn: 196165
* Simplifying a test for duplicate vec_type_hint attributes. The assert and ↵Aaron Ballman2013-12-021-5/+1
| | | | | | attribute kind test were superfluous. No functional change intended. llvm-svn: 196162
* The CUDA device attribute doesn't need custom logic to check the number of ↵Aaron Ballman2013-12-021-14/+2
| | | | | | attribute arguments (the common attribute handler already does this). Switching to use the simple attribute handler. No functional change intended. llvm-svn: 196155
* Automate attribute language option checking by specifying the list of ↵Aaron Ballman2013-12-021-155/+59
| | | | | | options to test in tablegen. llvm-svn: 196138
* Factored attribute mutual exclusion code into a helper function; split the ↵Aaron Ballman2013-12-021-35/+37
| | | | | | cf_audited_transfer and cf_unknown_transfer attributes into separate helper methods for simplicity. No functional changes intended. llvm-svn: 196126
* Re-enabled support for the Subjects for the weak attribute. This changes the ↵Aaron Ballman2013-12-021-19/+2
| | | | | | diagnostic involved to be more accurate -- for C++ code, it will now report that weak applies to variables, functions or classes. Added additional test case for this. llvm-svn: 196120
* The __w64 attribute handler was more generically named, but only applied to ↵Aaron Ballman2013-12-021-8/+4
| | | | | | __w64 specifically. Renamed and removed some unused code. No functional change intended. llvm-svn: 196116
* The FieldDecl is already covered by the ValueDecl case, so it is being removed.Aaron Ballman2013-12-021-2/+0
| | | | llvm-svn: 196110
OpenPOWER on IntegriCloud