summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-9/+9
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Generate error on declaration containing 'static' and '__attribute__((weak))'Fariborz Jahanian2009-07-161-0/+13
| | | | | | Patch by Ryan Flynn llvm-svn: 75879
* Handle some more fallout with the conversion of using PointerType forTed Kremenek2009-07-151-2/+2
| | | | | | | | | | | | | | | Objective-C pointers to using ObjCObjectPointerType. Now the checking for 'attribute ((nonnull))' in Sema doesn't emit an error when trying to apply that attribute to a parameter that is an Objective-C pointer (this is a regression). To prevent this regression from occuring in the future, the 'nonnull.c' test was moved to test/SemaObjC and renamed 'nonnull.m'. I also enhanced the tests to show that function calls involved a NULL Objective-C pointer constant does not trigger a warning. This is consistent with GCC, but should likely be fixed. llvm-svn: 75856
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-2/+3
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-2/+2
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* Remove the ASTContext parameter from the getBody() methods of Decl and ↵Argyrios Kyrtzidis2009-06-301-1/+1
| | | | | | | | subclasses. Timings showed no significant difference before and after the commit. llvm-svn: 74504
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-55/+50
| | | | | | | | | The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. llvm-svn: 74501
* OpenCL 1.0 support: attributesNate Begeman2009-06-261-0/+27
| | | | llvm-svn: 74280
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-49/+53
| | | | llvm-svn: 73702
* Support dependent extended vector types and template instantiationDouglas Gregor2009-06-171-39/+34
| | | | | | thereof. Patch by Anders Johnsen! llvm-svn: 73641
* Add more parser support for Microsoft extensions.Eli Friedman2009-06-081-0/+3
| | | | llvm-svn: 73101
* implementation of format_arg for ObjC methods/functions.Fariborz Jahanian2009-05-201-0/+70
| | | | | | Still more to do. llvm-svn: 72173
* Patch finishes off application of printf attribute on blocks.Fariborz Jahanian2009-05-191-4/+9
| | | | llvm-svn: 72111
* Minor tweak to support format attribute on blocks. No change in functionality.Fariborz Jahanian2009-05-181-3/+3
| | | | llvm-svn: 72020
* Reflow some comments.Mike Stump2009-05-161-10/+8
| | | | llvm-svn: 71936
* Removed superfluous code.Fariborz Jahanian2009-05-151-11/+0
| | | | llvm-svn: 71909
* Early support for __format__attribute on blocks.Fariborz Jahanian2009-05-151-4/+32
| | | | | | Work in progress... llvm-svn: 71908
* improved on diagnosing misplacement of sentinel attributes.Fariborz Jahanian2009-05-151-3/+4
| | | | | | No change in functionality. llvm-svn: 71894
* This patch finishes off the sentinel attribute handling forFariborz Jahanian2009-05-151-5/+3
| | | | | | blocks and function pointers. llvm-svn: 71888
* updated comments.Fariborz Jahanian2009-05-141-3/+2
| | | | llvm-svn: 71790
* Adds recognition of sentinel attribute on block declarations.Fariborz Jahanian2009-05-141-2/+24
| | | | llvm-svn: 71788
* Look for and diagnose missing sentinel argument on messageFariborz Jahanian2009-05-131-2/+1
| | | | | | dispatch arguments which have sentinel attribute. llvm-svn: 71737
* Add some basic type checking for attributes ns_returns_retained andTed Kremenek2009-05-131-39/+39
| | | | | | | | | | | | | | cf_returns_retained. Currently this attribute can now be applied to any Objective-C method or C function that returns a pointer or Objective-C object type. Modify the tablegen definition of diagnostic 'warn_attribute_wrong_decl_type' to expect that the diagnostics infrastructure will add quotes around the attribute name when appropriate. Alonq with this change, I modified the places where this warning is issued to passed the attribute's IdentifierInfo* instead of having a hard-coded C constant string. llvm-svn: 71718
* Fix rdar://6880951 by rejecting vectors of vectors.Chris Lattner2009-05-131-2/+3
| | | | | | | | It seems dubious to me that isIntegerType() returns true for vectors of integers, but not complex integers. This should probably be rethought, I'll file a bugzilla. llvm-svn: 71640
* Fix rdar://6881069, a crash on a form of vector_size that weChris Lattner2009-05-131-1/+2
| | | | | | | | | don't support. While it would be nice to support this eventually, this form is not common at all (just seen in gcc testsuite) and it might be better to model vector_size as a type attribute anyway. For now just emit a nice error on it. llvm-svn: 71633
* Add back Parse/Sema support for attributes cf_returns_retained andTed Kremenek2009-05-091-0/+44
| | | | | | | ns_returns_retained, but do not include the other ownership attributes we previously had. llvm-svn: 71308
* Remove experimental ownership attributes from Clang.Ted Kremenek2009-05-081-101/+0
| | | | llvm-svn: 71216
* More attribute renaming:Ted Kremenek2009-05-071-8/+8
| | | | | | | - Rename 'ns_returns_owned' -> 'ns_returns_retained'. - Rename 'cf_returns_owned' -> 'cf_returns_retained'. llvm-svn: 71182
* Implement attribute 'ns_autorelease'.Ted Kremenek2009-05-051-0/+6
| | | | llvm-svn: 70990
* Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').Ted Kremenek2009-05-051-10/+37
| | | | llvm-svn: 70952
* Rename ownership attributes:Ted Kremenek2009-05-051-18/+18
| | | | | | | | | | ns_ownership_returns -> ns_returns_owned ns_ownership_retain -> ns_retains ns_ownership_release -> ns_releases cf_ownership_retain -> cf_retains cf_ownership_release -> cf_releases llvm-svn: 70949
* Rename attribute 'ns_ownership_returns' to 'ns_returns_ownership'.Ted Kremenek2009-05-041-2/+2
| | | | llvm-svn: 70941
* Remove experimental attribute 'ns_ownership_make_collectable.'Ted Kremenek2009-05-041-5/+0
| | | | llvm-svn: 70940
* ignore weak_import attribute on objc method decls.Fariborz Jahanian2009-05-041-2/+2
| | | | llvm-svn: 70901
* Rename attributes 'objc_ownership...' to 'ns_ownership...'.Ted Kremenek2009-05-041-23/+23
| | | | llvm-svn: 70897
* Rename attributes:Ted Kremenek2009-05-041-10/+10
| | | | | | | | | | | 'objc_ownership_cfretain' -> 'cf_ownership_retain' 'objc_ownership_cfrelease' -> 'cf_ownership_release' Motivation: Core Foundation objects can be used in isolation from Objective-C, and this forces users to reason about the separate semantics of CF objects. More Sema support pending. llvm-svn: 70884
* Remove support for ObjCMethodDecl attributes that appear between theTed Kremenek2009-05-041-34/+0
| | | | | | | | return type and the selector. This is inconsistent with C functions (where such attributes would be placed on the return type, not the the FunctionDecl), and is inconsistent with what people are use to seeing. llvm-svn: 70878
* Allow attributes 'objc_ownership_retain' and 'objc_ownership_release' to beTed Kremenek2009-04-301-5/+7
| | | | | | | applied to ObjCMethodDecls, not just parameters. This allows one to specific side-effects on the receiver of a message expression. No checker support yet. llvm-svn: 70505
* Hook up Sema support for attributes on Objective-C method declarations thatTed Kremenek2009-04-301-1/+33
| | | | | | | | | | | | | appear between the return type and the selector. This is a separate code path from regular attribute processing, as we only want to (a) accept only a specific set of attributes in this place and (b) want to distinguish to clients the context in which an attribute was added to an ObjCMethodDecl. Currently, the attribute 'objc_ownership_returns' is the only attribute that uses this new feature. Shortly I will add a warning for 'objc_ownership_returns' to be placed at the end of a method declaration. llvm-svn: 70504
* Implement semantic analysis for transparent unions. This is largelyDouglas Gregor2009-04-291-18/+45
| | | | | | | based on a patch from Anders Johnsen. CodeGen support is incomplete, in that we do not properly coerce to the first field's type. llvm-svn: 70419
* Sema and CodeGen support for attributes on blocks. Radar 6441502Mike Stump2009-04-291-4/+7
| | | | llvm-svn: 70403
* Implement ownership attribute 'objc_ownership_make_collectable'. This allows oneTed Kremenek2009-04-281-10/+15
| | | | | | to add 'CFMakeCollectable' semantics to a method. llvm-svn: 70336
* Improve compatibility with GCC regarding inline semantics in GNU89Douglas Gregor2009-04-281-5/+1
| | | | | | | | | | | mode and in the presence of __gnu_inline__ attributes. This should fix both PR3989 and PR4069. As part of this, we now keep track of all of the attributes attached to each declaration even after we've performed declaration merging. This fixes PR3264. llvm-svn: 70292
* Add two new checker-specific attributes: 'objc_ownership_release' andTed Kremenek2009-04-271-0/+10
| | | | | | | 'objc_ownership_cfrelease'. These are the 'release' equivalents of 'objc_ownership_retain' and 'objc_ownership_cfretain' respectively. llvm-svn: 70235
* Refactor HandleObjCOwnershipRetainAttr and HandleObjCOwnershipCFRetainAttr intoTed Kremenek2009-04-271-19/+26
| | | | | | HandleObjCOwnershipParmAttr. No functionality change (hopefully). llvm-svn: 70224
* Add new checker-specific attribute 'objc_ownership_cfretain'. This is the sameTed Kremenek2009-04-271-0/+14
| | | | | | | | as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead of a [... retain] (important in GC modes). Checker support is wired up, but currently only for Objective-C message expressions (not function calls). llvm-svn: 70218
* Correct the order of the parameters to CheckAssignmentConstraints in Eli Friedman2009-04-261-1/+1
| | | | | | | cleanup attribute checking. The difference isn't normally visible, but it can make a difference... llvm-svn: 70104
* accept an ignore the no_instrument_function attribute. Since we don'tChris Lattner2009-04-251-0/+1
| | | | | | support -pg, we never instrument :) llvm-svn: 70061
* Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked upTed Kremenek2009-04-251-0/+14
| | | | | | | | to the checker yet, but essentially it allows a user to specify that an Objective-C method or C function increments the reference count of a passed object. llvm-svn: 70005
* Add new checker-specific attribute 'objc_ownership_returns'. This isn't hookedTed Kremenek2009-04-241-0/+21
| | | | | | | up to the checker yet, but essentially it allows a user to specify that an Objective-C method or C function returns an owned an Objective-C object. llvm-svn: 70001
OpenPOWER on IntegriCloud