summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-2/+3
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-7/+7
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+8
| | | | llvm-svn: 81346
* reduce indentation.Chris Lattner2009-09-081-17/+16
| | | | llvm-svn: 81234
* Regularize the case and sort.Mike Stump2009-08-261-6/+6
| | | | llvm-svn: 80163
* Handle the implicit 'this' parameter for format attributes.Anders Carlsson2009-08-251-3/+12
| | | | llvm-svn: 79987
* Enhance diagnostics concerning attribute 'ns_returns_retained' and ↵Ted Kremenek2009-08-191-4/+6
| | | | | | 'cf_returns_retained' to present the range of the attribute and have the diagnostic location be the declaration that the attribute was falsely attached to. This solves the problem where these diagnostics were being suppressed when these attributes were wrapped in a macro that was defined in a system header. llvm-svn: 79496
* Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema ↵Argyrios Kyrtzidis2009-08-191-2/+3
| | | | | | | | | | | | interfaces. DeclaratorDecl contains a DeclaratorInfo* to keep type source info. Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl. EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo. Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet. llvm-svn: 79392
* Change handling of attribute 'malloc' to only accept the attribute on functionTed Kremenek2009-08-151-14/+7
| | | | | | | | | | declarations (and not function pointers). This is consistent with GCC. Accepting this attribute on function pointers means that the attribute should be treated as a type qualifier, which apparently is not what GCC does. We obviously can change this later should we desire to enhance the 'malloc' attribute in this way. llvm-svn: 79060
* Per Eli Friedman's feedback, handle attribute 'malloc' being applied toTed Kremenek2009-08-141-5/+5
| | | | | | declarations of function pointers. llvm-svn: 79053
* Use 'dyn_cast' instead of a check for a function declaration followed by aTed Kremenek2009-08-141-2/+3
| | | | | | 'cast'. llvm-svn: 79041
* Improve Sema's handling of attribute 'malloc' to reject the attribute whenTed Kremenek2009-08-141-18/+26
| | | | | | | | | | | attaching to Objective-C methods (which mirrors GCC's behavior) and to allow the return type of the function to be an Objective-C pointer or Block pointer (which GCC also accepts). Along the way, add 'const' to some of the pointer arguments of various utility functions... llvm-svn: 79040
* change cast to dyn_cast because d may not be a FunctionDeclRyan Flynn2009-08-131-1/+1
| | | | llvm-svn: 78876
* change a dyn_cast to castRyan Flynn2009-08-121-1/+1
| | | | llvm-svn: 78862
* fix a couple of problems with section attributes:Chris Lattner2009-08-101-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Passing something that isn't a string used to cause: "argument to annotate attribute was not a string literal" make it say "section attribute" instead. 2. Fix the location of the above message to point to the bad argument instead of the section token. 3. Implement rdar://4341926, by diagnosing invalid section specifiers in the frontend rather than letting them slip all the way to the assembler (a QoI win). An example of #3 is that we used to produce something like this: /var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name /var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.). Daniel improved clang to use llvm_report_error, so now we got: $ clang t.c -c fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier requires a segment and section separated by a comma. with no loc info. Now we get: $ clang t.c -fsyntax-only t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma int x __attribute__((section("sadf"))); ^ which is nice :) llvm-svn: 78586
* warn, as gcc does, if __attribute__((malloc)) applied to function returning ↵Ryan Flynn2009-08-091-0/+7
| | | | | | non-pointer type llvm-svn: 78542
* map previously ignored __attribute((malloc)) to noalias attribute of llvm ↵Ryan Flynn2009-08-091-0/+17
| | | | | | function's return llvm-svn: 78541
* Introduce a new PragmaPack attribute, and use it for #pragma pack. The ↵Anders Carlsson2009-08-081-2/+2
| | | | | | | | PackedAttr now only represents __attribute__((packed)). This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug. llvm-svn: 78483
* add support for FreeBSD's format(printf0,x,y) attribute; allows null format ↵Ryan Flynn2009-08-061-1/+2
| | | | | | string. llvm-svn: 78276
* Canonicalize else.Mike Stump2009-08-041-2/+1
| | | | llvm-svn: 78102
* PR3679 - enable #pragma weak aliasing.Ryan Flynn2009-07-311-6/+12
| | | | llvm-svn: 77660
* PR3679 - handle #pragma weakRyan Flynn2009-07-301-0/+47
| | | | llvm-svn: 77573
* Change uses of:Ted Kremenek2009-07-291-10/+10
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Fix 80-col violations, reflow a few comments and zap some extraMike Stump2009-07-241-159/+158
| | | | | | whitespace at ends of lines. llvm-svn: 76992
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-10/+10
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-1/+1
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* 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
OpenPOWER on IntegriCloud