summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Fix 5 issues from Chris's feedback on ↵Steve Naroff2009-07-131-1/+0
| | | | | | | | http://llvm.org/viewvc/llvm-project?view=rev&revision=75314. Still more to come...just wanted to get the no-brainers out of the way. llvm-svn: 75477
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-89/+97
| | | | | | | | | | | | 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-17/+17
| | | | | | | 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
* First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff2009-06-171-13/+14
| | | | | | | | | | | | representation. Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType). This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). No functionality change. llvm-svn: 73649
* Implements -Wundeclared-selector for ObjC.Fariborz Jahanian2009-06-161-0/+8
| | | | llvm-svn: 73495
* Template instantiation support for Obj-C @encode expressions.Anders Carlsson2009-06-071-13/+24
| | | | llvm-svn: 73034
* Convert ObjC qualified type clients over to using iterators.Steve Naroff2009-05-271-14/+19
| | | | | | | | This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType. No functionality change. llvm-svn: 72475
* An Obj-C message send expression can never have a reference type.Anders Carlsson2009-05-261-0/+7
| | | | llvm-svn: 72417
* Fixed a warning bug when receiver is an object viaFariborz Jahanian2009-05-211-1/+2
| | | | | | setting of NSObject attribute. llvm-svn: 72225
* Reflow some comments.Mike Stump2009-05-161-13/+13
| | | | llvm-svn: 71936
* Don't warn if result/argument type of an implemented Fariborz Jahanian2009-05-141-0/+9
| | | | | | | method is a qualified id which conforms to the matching type of its method declaration. llvm-svn: 71817
* Some early declarations to support sentinel attribute onFariborz Jahanian2009-05-131-0/+2
| | | | | | | message dispatches (and function calls later). No change in functionality. llvm-svn: 71683
* We want to diagnose sending message to a forward classFariborz Jahanian2009-05-081-2/+3
| | | | | | | and we also want to tell which message is actually being sent. llvm-svn: 71296
* Warn if forward class is used as a receiver.Fariborz Jahanian2009-05-081-1/+9
| | | | llvm-svn: 71278
* Issue a warning in odd case of instance method usedFariborz Jahanian2009-05-051-0/+9
| | | | | | | in a 'Class' receiver which is not a root instance method. llvm-svn: 70987
* fix PR4021, array and functions decay in the receiver position of an objc ↵Chris Lattner2009-04-291-1/+5
| | | | | | message send. llvm-svn: 70373
* PCH support for the global method pool (= instance and factory methodDouglas Gregor2009-04-241-2/+2
| | | | | | | | pools, combined). The methods in the global method pool are lazily loaded from an on-disk hash table when Sema looks into its version of the hash tables. llvm-svn: 69989
* Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's ↵Douglas Gregor2009-04-241-8/+8
| | | | | | | | | | | good for uniformity is good for PCH (or is it the other way around?). As part of this, make ObjCImplDecl inherit from NamedDecl (since ObjCImplementationDecls now need to have names so that they can be found). This brings ObjCImplDecl very, very close to ObjCContainerDecl; we may be able to merge them soon. llvm-svn: 69941
* Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls inDouglas Gregor2009-04-231-1/+1
| | | | | | | | | | | | their own namespace (IDNS_Protocol) and use the normal name-lookup routines to find them. Aside from the simplification this provides (one less DenseMap!), it means that protocols will be lazily deserialized from PCH files. Make the code size of the selector table block match the code size of the type and decl blocks. llvm-svn: 69939
* Eliminate the three SmallVectors in ObjCImplDecl (for instanceDouglas Gregor2009-04-231-7/+7
| | | | | | | | | | | methods, class methods, and property implementations) and instead place all of these entities into the DeclContext. This eliminates more linear walks when looking for class or instance methods and should make PCH (de-)serialization of ObjCDecls trivial (and lazy). llvm-svn: 69849
* Fix rdar://6770142 - Class and qualified id's are compatible, just likeChris Lattner2009-04-121-2/+6
| | | | | | Class and unqualified id's are. llvm-svn: 68899
* implement rdar://6780761, making sema reject some code that otherwiseChris Lattner2009-04-121-4/+4
| | | | | | crashes codegen. llvm-svn: 68891
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-10/+10
| | | | | | No functionality change (really). llvm-svn: 68726
* Tweak Sema::ActOnInstanceMessage() to look for a class method when dealing ↵Steve Naroff2009-04-071-0/+3
| | | | | | | | | | | | with qualified id's. This change is motivated by our desire to not support the "Class<foo>" idiom. Note that the change makes perfect sense (since all ObjC classes are also id/instances). This allow us to document a simple migration path...change "Class <foo>" to "id <foo>". This effects: - <rdar://problem/6761939> TASK: File source change radars for "qualified Class" errors - <rdar://problem/6761864> Protocol qualified Class is unsupported llvm-svn: 68517
* Change the type of ObjC @ string constants (from NSConstantString->NSString).Steve Naroff2009-04-071-3/+5
| | | | | | This fixes <rdar://problem/6757102> clang type for @"xxx" is "NSConstantString *" (GCC type is "NSString *"). llvm-svn: 68514
* various cleanupsChris Lattner2009-03-291-2/+4
| | | | llvm-svn: 67981
* Simplify SelectorTable::constructSetterName() usage...Steve Naroff2009-03-101-3/+3
| | | | llvm-svn: 66551
* Fix PR3766, a really nasty silent miscompilation case where we emittedChris Lattner2009-03-091-2/+11
| | | | | | | | | a warning and then threw away the AST. While I'm in there, tighten up the code to actually reject completely bogus cases (sending a message to a struct). We still allow sending a message to an int, which doesn't make sense but GCC allows it and is easy to support. llvm-svn: 66468
* Implement property '.' notation on Factory/Class objects. Parser changes ↵Steve Naroff2009-03-091-0/+74
| | | | | | | | aren't very pretty:-( This fixes <rdar://problem/6496506> Implement class setter/getter for properties. llvm-svn: 66465
* Remove dead clause (we decided not to support protocol qualified 'Class').Steve Naroff2009-03-081-9/+0
| | | | llvm-svn: 66385
* Improvements to private method lookup.Steve Naroff2009-03-081-36/+58
| | | | | | Patch by Jean-Daniel Dupas. Thanks! llvm-svn: 66383
* Removed an unfortunate cut and paste left-over.Fariborz Jahanian2009-03-041-2/+0
| | | | llvm-svn: 66099
* Some refactoring of recent code. No functionality change.Fariborz Jahanian2009-03-041-22/+13
| | | | llvm-svn: 66041
* Fix a corner case of message lookup looking for class methods.Fariborz Jahanian2009-03-041-3/+21
| | | | | | | If all else failed, find the message in class's root's list of instacne methods! llvm-svn: 66040
* Finish up some fixes related to <rdar://problem/6497631> Message lookup is ↵Steve Naroff2009-03-041-15/+28
| | | | | | | | | sometimes different than gcc's. - Disallow casting 'super'. GCC allows this, however it doesn't make sense (super isn't an expression and the cast won't alter lookup/dispatch). - Tighten up lookup when messaging 'self'. llvm-svn: 66033
* Implement an important missing warning when a selectorFariborz Jahanian2009-03-031-7/+19
| | | | | | | is searched for in the global pool. It already uncovered a clang bug in message selection. llvm-svn: 65974
* Fix <rdar://problem/6497242> Inherited overridden protocol declared objects ↵Steve Naroff2009-03-031-0/+1
| | | | | | | | don't work. Change Sema::DiagnosePropertyMismatch() to check for type compatibility (rather than type equivalence, which is too strict). llvm-svn: 65949
* Fix <rdar://problem/6248764> parser rejects: bad receiver type 'CFStringRef'.Steve Naroff2009-03-011-1/+1
| | | | | | Downgrade an error to a warning (for GCC compatibility). llvm-svn: 65779
* Fix <rdar://problem/6614945> method not found. Steve Naroff2009-02-261-3/+3
| | | | | | This was a fairly recent regression. llvm-svn: 65547
* Fix http://llvm.org/bugs/show_bug.cgi?id=3544.Steve Naroff2009-02-261-19/+26
| | | | | | | The code for looking up local/private method in Sema::ActOnInstanceMessage() was not handling categories properly. Sema::ActOnClassMessage() didn't have this bug. Created a helper with the correct logic and changed both methods to use it. llvm-svn: 65532
* first wave of fixes for @encode sema support. This is part of PR3648.Chris Lattner2009-02-241-2/+13
| | | | | | | The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
* Remove isSuperExpr(), which ignores any casts on 'super'.Steve Naroff2009-02-231-22/+6
| | | | | | | I don't think casting super makes any sense (since it won't effect method lookup). Will discuss with other offline and decide what to do. llvm-svn: 65317
* Sema::ActOnInstanceMessage(): Tighen up the lookup rules for handling ↵Steve Naroff2009-02-231-9/+31
| | | | | | messages to 'Class'. Also improve "super" handling. llvm-svn: 65300
* Minor cleanup, replace bool with qual_empty().Steve Naroff2009-02-221-3/+1
| | | | llvm-svn: 65293
* Contains the following (related to problems found while investigting ↵Steve Naroff2009-02-221-24/+15
| | | | | | | | | | <rdar://problem/6497631> Message lookup is sometimes different than gcc's). - Implement instance/class overloading in ObjCContainerDecl (removing a FIXME). This involved hacking NamedDecl::declarationReplaces(), which took awhile to figure out (didn't realize replace was the default). - Changed Sema::ActOnInstanceMessage() to remove redundant warnings when dealing with protocols. For now, I've omitted the "protocol" term in the diagnostic. It simplifies the code flow and wan't always 100% accurate (e.g. "Foo<Prot>" looks in the class interface, not just the protocol). - Changed several test cases to jive with the above changes. llvm-svn: 65292
* Remove debugging statement.Steve Naroff2009-02-221-1/+0
| | | | llvm-svn: 65257
* More work to integrate newly added ObjCQualifiedClassType into the type system.Steve Naroff2009-02-211-1/+14
| | | | | | This is necessary 'plumbing' to fix <rdar://problem/6497631> Message lookup is sometimes different than gcc's. llvm-svn: 65248
* remove some more methods from objc decls, using the iteratorChris Lattner2009-02-201-1/+1
| | | | | | interfaces more consistently. llvm-svn: 65138
* Downgrade complaints about calling unavailable functions to a warningDouglas Gregor2009-02-181-8/+8
| | | | | | | | | | | | | | | | | | (as GCC does), except when we've performed overload resolution and found an unavailable function: in this case, we actually error. Merge the checking of unavailable functions with the checking for deprecated functions. This unifies a bit of code, and makes sure that we're checking for unavailable functions in the right places. Also, this check can cause an error. We may, eventually, want an option to make "unavailable" warnings into errors. Implement much of the logic needed for C++0x deleted functions, which are effectively the same as "unavailable" functions (but always cause an error when referenced). However, we don't have the syntax to specify deleted functions yet :) llvm-svn: 64955
OpenPOWER on IntegriCloud