summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Switching some custom logic to using table-generated helper methods. This ↵Aaron Ballman2013-10-141-23/+11
| | | | | | also removes an unnecessary diagnostic. llvm-svn: 192639
* Consumed analysis: replace the consumes attribute with a set_typestateDeLesley Hutchins2013-10-111-58/+84
| | | | | | attribute. Patch by chris.wailes@gmail.com; reviewed and edited by delesley. llvm-svn: 192515
* Consumed analysis: switch from tests_consumed/unconsumed to a generalDeLesley Hutchins2013-10-111-23/+27
| | | | | | tests_typestate attribute. Patch by chris.wailes@gmail.com. llvm-svn: 192513
* Switching the CallableWhen attribute over to using the string literal helper ↵Aaron Ballman2013-10-051-17/+11
| | | | | | function instead of custom logic. llvm-svn: 192050
* Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins2013-10-041-6/+34
| | | | | | | | that a function can be called in. This reduced the total number of annotations needed and makes writing more complicated behaviour less burdensome. Patch by chriswails@gmail.com. llvm-svn: 191983
* Implement ARM GNU-style interrupt attributeTim Northover2013-10-011-1/+1
| | | | | | | | | | This attribute allows users to use a modified C or C++ function as an ARM exception-handling function and, with care, to successfully return control to user-space after the issue has been dealt with. rdar://problem/14207019 llvm-svn: 191769
* Move checkStringLiteralArgument into Sema classTim Northover2013-10-011-16/+15
| | | | | | It's a useful function to have around for target-specific attributes. llvm-svn: 191768
* Fixes a buildbot failure (was using localFariborz Jahanian2013-09-191-4/+2
| | | | | | type in template instantiation). llvm-svn: 191022
* Refinement to my previous patch forFariborz Jahanian2013-09-191-1/+7
| | | | | | objc_returns_inner_pointer on properties. // rdar://14990439 llvm-svn: 191016
* ObjectiveC: Allow NS_RETURNS_INNER_POINTER annotation Fariborz Jahanian2013-09-191-12/+18
| | | | | | | | | | of ObjectiveC properties to mean annotation of NS_RETURNS_INNER_POINTER on its synthesized getter. This also facilitates more migration to properties when methods are annotated with NS_RETURNS_INNER_POINTER. // rdar://14990439 llvm-svn: 191009
* Recommited:Stepan Dyatkovskiy2013-09-181-65/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Fix for PR16752. Second commit. PR16752: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width. 2. Fix handleModeAttr according to new methods in TargetInfo. Fixes: 1st Commit (Done): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function. Also test/Sema/attr-mode.c was fixed. 'XC' mode test was disabled for PPC64 machines. llvm-svn: 190926
* Updated the way the ownership attributes are semantically diagnosed. Added ↵Aaron Ballman2013-09-161-59/+43
| | | | | | test cases for the semantics checks. llvm-svn: 190802
* Switching the WeakRef attribute to using the new checkStringLiteralArgument ↵Aaron Ballman2013-09-131-50/+41
| | | | | | helper function. llvm-svn: 190719
* Updated the PCS calling convention to use the new checkStringLiteralArgument ↵Aaron Ballman2013-09-131-9/+2
| | | | | | helper function. llvm-svn: 190710
* As Aaron pointed out it's simpler to reject wide string availability attr ↵Benjamin Kramer2013-09-131-9/+2
| | | | | | messages in the parser. llvm-svn: 190706
* Guard availability and thread safety attributes against wide strings.Benjamin Kramer2013-09-131-4/+10
| | | | | | Found by inspection. llvm-svn: 190701
* Unify handling of string literal arguments for attributes and add fixits.Benjamin Kramer2013-09-131-71/+69
| | | | | | | | | | | | | | | | | | | | | | This fixes a couple of latent crashes for invalid attributes and also adds a fixit hint to turn identifiers into string literals if one was expected. It then proceeds recovery as if the identifier was a literal. Diagnostic locations are also changed to point at the literal instead of the attribute if the error concerns the argument. PR17175. For example: hidden.c:1:40: error: 'visibility' attribute requires a string extern int x __attribute__((visibility(hidden))); ^ " " hidden.c:2:29: error: visibility does not match previous declaration extern int x __attribute__((visibility("default"))); ^ hidden.c:1:29: note: previous attribute is here extern int x __attribute__((visibility(hidden))); ^ llvm-svn: 190699
* Tablegen now generates a StringSwitch for attributes containing enumeration ↵Aaron Ballman2013-09-111-66/+30
| | | | | | arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required. llvm-svn: 190545
* The cleanup attribute no longer uses an unresolved, simple identifier as its ↵Aaron Ballman2013-09-111-28/+30
| | | | | | argument. Instead, it takes an expression that is fully resolved. llvm-svn: 190476
* Rejected 190391, due to failures on ↵Stepan Dyatkovskiy2013-09-101-12/+65
| | | | | | clang-x86_64-darwin11-nobootstrap-RAincremental. llvm-svn: 190393
* Fix for PR16752. Second commit.Stepan Dyatkovskiy2013-09-101-65/+12
| | | | | | | | | | | | | | | | | | | | | PR16752: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width. 2. Fix handleModeAttr according to new methods in TargetInfo. Fixes: 1st Commit (Done): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function. llvm-svn: 190391
* Adding a FIXME based on feedback from Richard Smith.Aaron Ballman2013-09-091-0/+3
| | | | llvm-svn: 190369
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-091-228/+26
| | | | | | This allows for automated checking of the number of arguments expected vs number of arguments given for attributes. Greatly reduces the amount of manual checking required. llvm-svn: 190368
* Sema: Don't crash on visibility attributes with an identifier argument.Benjamin Kramer2013-09-091-3/+4
| | | | | | PR17105. llvm-svn: 190312
* Removing the endian attribute and updating associated test cases. This ↵Aaron Ballman2013-09-091-22/+0
| | | | | | functionality was never completely implemented, and this is an improvement over silently eating the attribute. llvm-svn: 190303
* Consumed Analysis: The 'consumable' attribute now takes a identifier ↵David Blaikie2013-09-061-2/+25
| | | | | | | | | | | | | specifying the default assumed state for objects of this class This information is used for return states and pass-by-value parameter states. Patch by Chris Wailes. Review by DeLesley Hutchins and Aaron Ballman. llvm-svn: 190116
* Switched FormatAttr to using an IdentifierArgument instead of a ↵Aaron Ballman2013-09-031-6/+10
| | | | | | StringArgument since that is a more accurate modeling. llvm-svn: 189851
* Consumed analysis: add return_typestate attribute.DeLesley Hutchins2013-09-031-0/+61
| | | | | | | | | | Patch by chris.wailes@gmail.com Functions can now declare what state the consumable type the are returning will be in. This is then used on the caller side and checked on the callee side. Constructors now use this attribute instead of the 'consumes' attribute. llvm-svn: 189843
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-311-190/+162
| | | | | | argument list. llvm-svn: 189711
* Consumed analysis: add 'consumable' class attribute.DeLesley Hutchins2013-08-301-15/+60
| | | | | | | | | | | | Patch by chris.wailes@gmail.com Adds the 'consumable' attribute that can be attached to classes. This replaces the previous method of scanning a class's methods to see if any of them have consumed analysis attributes attached to them. If consumed analysis attributes are attached to methods of a class that isn't marked 'consumable' a warning is generated. llvm-svn: 189702
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-301-0/+20
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don'tRichard Smith2013-08-291-48/+21
| | | | | | do anything useful. llvm-svn: 189548
* Mode is now handled as a non-inheritable attribute, and CUDADevice & ↵Aaron Ballman2013-08-281-5/+4
| | | | | | CUDAHost are now handled as inheritable attributes. In all three cases, this makes the processing behavior more consistent with the declared behavior in Attr.td. llvm-svn: 189532
* Since r179585, __declspec(property) has gotten special treatment as an ↵Aaron Ballman2013-08-261-1/+0
| | | | | | attribute where it is not processed as part of the typical Sema attribute functionality. Specifying this attribute as being "ignored" because there is no sema handler for it as a Decl attribute, and no AST node generated for it. llvm-svn: 189284
* Updated the consumed analysis warnings to use a more standardized diagnostic.Aaron Ballman2013-08-211-8/+8
| | | | | | Patch thanks to Christian Wailes! llvm-svn: 188940
* Removed unnecessary asserts.Aaron Ballman2013-08-211-38/+0
| | | | | | Patch thanks to Christian Wailes! llvm-svn: 188934
* Don't reject attribute used in an "extern const" variable definition.Rafael Espindola2013-08-161-1/+1
| | | | | | | Before this patch we would warn and drop the attribute in extern const char test3[] __attribute__((used)) = ""; llvm-svn: 188588
* Patch by Chris Wailes <chris.wailes@gmail.com>.DeLesley Hutchins2013-08-121-0/+77
| | | | | | | | | | | | | | | | | | Reviewed by delesley, dblaikie. Add the annotations and code needed to support a basic 'consumed' analysis. Summary: This new analysis is based on academic literature on linear types. It tracks the state of a value, either as unconsumed, consumed, or unknown. Methods are then annotated as CallableWhenUnconsumed, and when an annotated method is called while the value is in the 'consumed' state a warning is issued. A value may be tested in the conditional statement of an if-statement; when this occurs we know the state of the value in the different branches, and this information is added to our analysis. The code is still highly experimental, and the names of annotations or the algorithm may be subject to change. llvm-svn: 188206
* Sema: Assertion failure during CodeGen in CodeGenModule::EmitUuidofInitializerDavid Majnemer2013-08-091-21/+10
| | | | | | | | | Make sure we can properly generate code when the UUID has curly braces on it, strip the curly braces at the sema layer. This fixes PR16813. llvm-svn: 188061
* err_attribute_missing_parameter_name has been replaced by ↵Aaron Ballman2013-07-301-1/+2
| | | | | | err_attribute_argument_type. llvm-svn: 187420
* Replacing err_attribute_argument_not_int with err_attribute_not_type_attrAaron Ballman2013-07-301-10/+15
| | | | llvm-svn: 187419
* err_attribute_not_string has been subsumed by err_attribute_argument_type.Aaron Ballman2013-07-301-39/+33
| | | | llvm-svn: 187400
* Refactor some attributes to use checkFunctionOrMethodArgumentIndex instead ↵Aaron Ballman2013-07-301-159/+46
| | | | | | of using custom logic. No functional changes intended. llvm-svn: 187398
* Support for Thread Safety Analysis in CDavid Blaikie2013-07-291-1/+1
| | | | | | Patch by Ethan Jackson. llvm-svn: 187365
* Added the attribute name to the err_attribute_wrong_number_arguments ↵Aaron Ballman2013-07-231-26/+50
| | | | | | | | diagnostic for clarity; updated almost all of the affected test cases. Thanks to Fariborz Jahanian for the suggestion! llvm-svn: 186980
* Going back to using getName for consistency.Aaron Ballman2013-07-231-7/+2
| | | | llvm-svn: 186966
* Replacing some manual diagnostic checks with an existing helper method. ↵Aaron Ballman2013-07-231-12/+3
| | | | | | Adding missing test cases for the diagnostics. llvm-svn: 186944
* Consolidate several attribute argument diagnostics into a single, selectable ↵Aaron Ballman2013-07-231-44/+68
| | | | | | diagnostic. This makes the diagnostic more consistent. llvm-svn: 186940
* Correcting the NSObject and Overloadable attribute diagnostics so that the ↵Aaron Ballman2013-07-231-6/+2
| | | | | | count reported matches reality. llvm-svn: 186936
* add type attribute warn_unused, for -Wunused-variable warnings (pr#14253)Lubos Lunak2013-07-201-0/+14
| | | | | | | | | The functionality is equivalent to the GCC attribute. Variables of tagged types will be warned about as unused if they are not used in any way except for possible (even non-trivial) ctors/dtors called. Useful for tagging classes like std::string (which is not part of this commit). llvm-svn: 186765
OpenPOWER on IntegriCloud