summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* fix the ownership issues and location tracking inChris Lattner2009-02-181-16/+22
| | | | | | Sema::ParseObjCStringLiteral. llvm-svn: 64900
* privatize all of the string literal memory allocation/creationChris Lattner2009-02-181-3/+3
| | | | | | stuff behind a private static function. llvm-svn: 64898
* add some comments describing what is happening here.Chris Lattner2009-02-181-9/+17
| | | | llvm-svn: 64896
* simplify the code used to compute the type of an objc string. This makesChris Lattner2009-02-181-27/+29
| | | | | | it faster in the common case when NSConstantString is around. llvm-svn: 64895
* rename CheckBuiltinCFStringArgument -> CheckObjCStringChris Lattner2009-02-181-1/+2
| | | | llvm-svn: 64894
* change the StringLiteral AST node to track all of the SourceLocations of Chris Lattner2009-02-181-5/+8
| | | | | | | | the various PPTokens that are pasted together to make it. In the course of working on this, I discovered ParseObjCStringLiteral which needs some work. I'll tackle it next. llvm-svn: 64892
* Refactor the deprecated and unavailable checks into a newChris Lattner2009-02-151-24/+8
| | | | | | | | | DiagnoseUseOfDeprecatedDecl method. This ensures that they are treated consistently. This gets us 'unavailable' support on a few new types of decls, and makes sure we consistently silence deprecated when the caller is also deprecated. llvm-svn: 64612
* implement support for attribute(unavailable) on objc methods.Chris Lattner2009-02-151-8/+24
| | | | | | This implements gcc/testsuite/objc.dg/method-attribute-1.m llvm-svn: 64581
* Add support for deprecated Obj-C methods. The semantics mostly match what ↵Anders Carlsson2009-02-141-0/+12
| | | | | | gcc has. llvm-svn: 64562
* Pass the location of the start of the selector to ↵Anders Carlsson2009-02-141-5/+8
| | | | | | ActOnClassMessage/ActOnInstanceMessage. llvm-svn: 64560
* Several cleanups:Steve Naroff2009-02-121-2/+2
| | | | | | | | - rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect. - add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time. - move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types). llvm-svn: 64385
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Move StringLiteral to allocate its internal string data using the allocator inTed Kremenek2009-02-061-3/+3
| | | | | | | | | | | ASTContext. This required changing all clients to pass in the ASTContext& to the constructor of StringLiteral. I also changed all allocations of StringLiteral to use new(ASTContext&). Along the way, I updated a bunch of new()'s in StmtSerialization.cpp to use the allocator from ASTContext& (not complete). llvm-svn: 63958
* Some name-lookup-related fixes, from Piotr Rak!Douglas Gregor2009-02-041-3/+3
| | | | | | | | | | | | | - Changes Lookup*Name functions to return NamedDecls, instead of Decls. Unfortunately my recent statement that it will simplify lot of code, was not quite right, but it simplifies some... - Makes MergeLookupResult SmallPtrSet instead of vector, following Douglas suggestions. - Adds %qN format for printing qualified names to Diagnostic. - Avoids searching for using-directives in Scopes, which are not DeclScope, during unqualified name lookup. llvm-svn: 63739
* Eliminated LookupCriteria, whose creation was causing a bottleneck forDouglas Gregor2009-01-301-3/+3
| | | | | | | | | | | | | | | | | | LookupName et al. Instead, use an enum and a bool to describe its contents. Optimized the C/Objective-C path through LookupName, eliminating any unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing some code and arguments that are no longer used. Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers over to LookupName, LookupQualifiedName, or LookupParsedName, as appropriate. All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and -disable-free. Plus, we're down to three name-lookup routines. llvm-svn: 63354
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+0
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Refactor Sema::LookupDecl() into 2 functions: LookupDeclInScope() and ↵Steve Naroff2009-01-291-3/+3
| | | | | | | | | | LookupDeclInContext(). The previous interface was very confusing. This is much more explicit, which will be easier to understand/optimize/convert. The plan is to eventually deprecate both of these functions. For now, I'm focused on performance. llvm-svn: 63256
* Remove 'NamespaceNameOnly' argument to Sema::LookupDecl(). It is unused.Steve Naroff2009-01-281-2/+2
| | | | | | Even though Sema::LookupDecl() is deprecated, it's still used all over the place. Simplifying the interface will make it easier to understand/optimize/convert. llvm-svn: 63210
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Some micro-optimizations for DISABLE_SMART_POINTERS:Douglas Gregor2009-01-261-2/+2
| | | | | | | | | | | | | | | | | - When it's safe, ActionResult uses the low bit of the pointer for the "invalid" flag rather than a separate "bool" value. This keeps GCC from generating some truly awful code, for a > 3x speedup in the result-passing microbenchmark. - When DISABLE_SMART_POINTERS is defined, store an ActionResult within ASTOwningResult rather than an ASTOwningPtr. Brings the performance benefits of the above to smart pointers with DISABLE_SMART_POINTERS defined. Sadly, these micro-benchmark performance improvements don't seem to make much of a difference on Cocoa.h right now. However, they're harmless and might help with future optimizations. llvm-svn: 63061
* Don't ICE (issue diagnostics) when receiver is a non-objcFariborz Jahanian2009-01-161-2/+3
| | | | | | type. llvm-svn: 62355
* Use a single function for doing vararg argument promotion. Also, make sure ↵Anders Carlsson2009-01-161-9/+2
| | | | | | to do the promotion before checking the type - fixes PR3340. llvm-svn: 62323
* Warn when someone tries to pass a variable with a non-POD type to a varargs ↵Anders Carlsson2009-01-131-1/+8
| | | | | | function/method/block. llvm-svn: 62148
* Provide a new kind of iterator, the specific_decl_iterator, thatDouglas Gregor2009-01-091-1/+1
| | | | | | | | | filters the decls seen by decl_iterator with two criteria: the dynamic type of the declaration and a run-time predicate described by a member function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl considerably. It has no measurable performance impact. llvm-svn: 61994
OpenPOWER on IntegriCloud