summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Making type_tag_for_datatype consistent with its declared subject from ↵Aaron Ballman2013-11-251-0/+6
| | | | | | | | Attr.td. Also updated the related testcase. Reviewed by Dmitri Gribenko. llvm-svn: 195675
* SemaDeclAttr.cpp: Try to fix a warning [-Wunnamed-type-template-args]NAKAMURA Takumi2013-11-251-1/+1
| | | | llvm-svn: 195589
* Switching the common attribute over to using the generic diagnostic, and ↵Aaron Ballman2013-11-241-1/+2
| | | | | | removing the now-unused diagnostic. Updates a test case. llvm-svn: 195581
* __declspec(uuid) is only supported for C++ code according to MSDN (as well ↵Aaron Ballman2013-11-241-0/+14
| | | | | | as behaviorally in MSVC). This adds a generic diagnostic that we use for uuid, and can use for some other attributes as well, and adds a testcase. llvm-svn: 195580
* __declspec(uuid) is only allowed on a class according to MSDN; this makes ↵Aaron Ballman2013-11-241-0/+6
| | | | | | the semantic checking consistent with what the attribute specifies in Attr.td. Also adds a test case. llvm-svn: 195579
* Making some attribute diagnostics more consistent. Removes a newly-unused ↵Aaron Ballman2013-11-241-1/+7
| | | | | | | | diagnostic. Reviewed by Fariborz Jahanian llvm-svn: 195578
* Remove optional parameter bit from attribute ObjCSuppressProtocol.Ted Kremenek2013-11-231-2/+1
| | | | | | This refines some diagnostics and reduces some boilerplate checking logic. llvm-svn: 195560
* Add back experimental attribute objc_suppress_protocol_methods (slightly ↵Ted Kremenek2013-11-231-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | renamed). This is still an experimental attribute, but I wanted it in tree for review. It may still get yanked. This attribute can only be applied to a class @interface, not a class extension or category. It does not change the type system rules for Objective-C, but rather the implementation checking for Objective-C classes that explicitly conform to a protocol. During protocol conformance checking, clang recursively searches up the class hierarchy for the set of methods that compose a protocol. This attribute will cause the compiler to not consider the methods contributed by a super class, its categories, and those from its ancestor classes. Thus this attribute is used to force subclasses to redeclare (and hopefully re-implement) methods if they decide to explicitly conform to a protocol where some of those methods may be provided by a super class. This attribute intentionally leaves out properties, which are associated with state. This attribute only considers methods (at least right now) that are non-property accessors. These represent methods that "do something" as dictated by the protocol. This may be further refined, and this should be considered a WIP until documentation gets written or this gets removed. llvm-svn: 195533
* Whitespace. No functional change intended.Aaron Ballman2013-11-221-4/+4
| | | | llvm-svn: 195503
* ObjectiveC migrator. Improve on definition, useFariborz Jahanian2013-11-221-6/+2
| | | | | | | | and testing of objc_bridgmutable attribute per Aaron Ballman's comments. // rdar://15498044 llvm-svn: 195396
* ObjectiveC. Implement attribute 'objc_bridge_mutable'Fariborz Jahanian2013-11-211-0/+27
| | | | | | | | whose semantic is currently identical to objc_bridge, but their differences may manifest down the road with further enhancements. // rdar://15498044 llvm-svn: 195376
* Revert "Add new attribute 'objc_suppress_protocol' to suppress protocol ↵Ted Kremenek2013-11-211-28/+1
| | | | | | | | | | | conformance for a class." After implementing this patch, a few concerns about the language feature itself emerged in my head that I had previously not considered. I want to resolve those design concerns first before having a half-designed language feature in the tree. llvm-svn: 195328
* Add new attribute 'objc_suppress_protocol' to suppress protocol conformance ↵Ted Kremenek2013-11-211-1/+28
| | | | | | | | | | | | | | | | | | | | | | | for a class. The idea is to allow a class to stipulate that its methods (and those of its parents) cannot be used for protocol conformance in a subclass. A subclass is then explicitly required to re-implement those methods of they are present in the class marked with this attribute. Currently the attribute can only be applied to an @interface, and not a category or class extension. This is by design. Unlike protocol conformance, where a category can add explicit conformance of a protocol to class, this anti-conformance really needs to be observed uniformly by all clients of the class. That's because the absence of the attribute implies more permissive checking of protocol conformance. This unfortunately required changing method lookup in ObjCInterfaceDecl to take an optional protocol parameter. This should not slow down method lookup in most cases, and is just used for protocol conformance. llvm-svn: 195323
* Refactor some of handleObjCBridgeAttr to make it more concise and the ↵Ted Kremenek2013-11-211-8/+7
| | | | | | diagnostic reusable. llvm-svn: 195322
* Refactored integer argument checking code into a helper method. Removes a ↵Aaron Ballman2013-11-211-111/+61
| | | | | | considerable amount of duplicated code. llvm-svn: 195302
* Implemented DefaultIntArgument in the table generator and start using it in ↵Aaron Ballman2013-11-211-4/+4
| | | | | | semantic analysis. Removes some magic numbers. llvm-svn: 195287
* There is no such thing as __declspec(ms_struct), this is a GNU attribute. ↵Aaron Ballman2013-11-201-1/+2
| | | | | | Switched the attribute to have the proper spelling, gave it a subject, updated the warning to be more accurate, and updated the test case as appropriate. llvm-svn: 195277
* Removed a duplicate diagnostic related to attribute subjects for thread ↵Aaron Ballman2013-11-201-28/+22
| | | | | | safety annotations, and replaced it with the more general attribute diagnostic. Updated the test case in the one instance where wording changed. No functional change intended. llvm-svn: 195275
* Removing a custom error diagnostic and replacing it with a stock one. Added ↵Aaron Ballman2013-11-201-2/+4
| | | | | | a test case to ensure the diagnostic was firing properly. llvm-svn: 195188
* Switching some string literals to be generated by the AttributeList object ↵Aaron Ballman2013-11-191-5/+5
| | | | | | itself. llvm-svn: 195160
* bjectiveC. Use a uniform diagnostic forFariborz Jahanian2013-11-191-3/+7
| | | | | | 'objc_bridge' attribute. // rdar://15454846. llvm-svn: 195135
* ObjectiveC 'objc_bridging'. Assorment of improvements Fariborz Jahanian2013-11-191-1/+2
| | | | | | per Doug/Jordan comments. // rdar://15454846. llvm-svn: 195066
* ObjectiveC ARC. Adopt objc_bridge attributeFariborz Jahanian2013-11-191-33/+1
| | | | | | | on struct/union/class instead of typedef of such types. // rdar://15454846 llvm-svn: 195061
* ObjectiveC ARC. Only briding of pointer to struct CF object is allowed.Fariborz Jahanian2013-11-151-3/+8
| | | | | | | Improve on wording on illegal objc_bridge argumment. // rdar://15454846 llvm-svn: 194881
* ObjectiveC ARC. objc_bridge attribute should be applied toFariborz Jahanian2013-11-141-4/+3
| | | | | | toll-free bridging cf types only. // rdar//15454846 wip. llvm-svn: 194640
* ObjectiveC ARC. Introduce a new attribute, 'objc_bridge'Fariborz Jahanian2013-11-131-0/+53
| | | | | | | that teaches the compiler about a subset of toll-free bridging semantics. This is wip. // rdar://15454846 llvm-svn: 194633
* Store a TypeArgument on an attribute as a TypeSourceInfo*, rather than as aRichard Smith2013-10-311-17/+23
| | | | | | QualType with a SourceLocation stashed alongside. llvm-svn: 193803
* Factor out custom parsing for iboutletcollection and vec_type_hint attributesRichard Smith2013-10-311-18/+22
| | | | | | | | | into a separate "parse an attribute that takes a type argument" codepath. This results in both codepaths being a lot cleaner and simpler, and fixes some bugs where the type argument handling bled into the expression argument handling and caused us to both accept invalid and reject valid attribute arguments. llvm-svn: 193731
* Changed tests_typestate to test_typestate for consistency.Chris Wailes2013-10-291-7/+7
| | | | llvm-svn: 193648
* Revert "This patch causes clang to reject alias attributes that point to ↵Rafael Espindola2013-10-221-7/+0
| | | | | | | | | | | | | | | | undefined names. For example, with this patch we now reject" This reverts commit r193161. It broke void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); Looks like we have to fix pr17639 first :-( llvm-svn: 193162
* This patch causes clang to reject alias attributes that point to undefinedRafael Espindola2013-10-221-0/+7
| | | | | | | | | | | | names. For example, with this patch we now reject void f1(void) __attribute__((alias("g1"))); This patch is implemented in CodeGen. It is quiet a bit simpler and more compatible with gcc than implementing it in Sema. The downside is that the errors only fire during -emit-llvm. llvm-svn: 193161
* Fix crash in cleanup attr handlingAlp Toker2013-10-201-2/+7
| | | | | | | | | | | ResolveSingleFunctionTemplateSpecialization() returns 0 and doesn't emit diags unless the expression has template-ids, so we must null check the result. Also add a better diag noting which overloads are causing the problem. Reviewed by Aaron Ballman. llvm-svn: 193055
* Consumed analysis: Add param_typestate attribute, which specifies thatDeLesley Hutchins2013-10-171-1/+50
| | | | | | | function parameters must be in a particular state. Patch by chris.wailes@gmail.com. Reviewed by delesley@google.com. llvm-svn: 192934
* Consumed Analysis: Allow parameters that are passed by non-const referenceDeLesley Hutchins2013-10-171-7/+13
| | | | | | | to be treated as return values, and marked with the "returned_typestate" attribute. Patch by chris.wailes@gmail.com; reviewed by delesley@google.com. llvm-svn: 192932
* Trivial formatting changes; no functional changes intended.Aaron Ballman2013-10-141-4/+6
| | | | llvm-svn: 192640
* 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
OpenPOWER on IntegriCloud