summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Don't ICE when messaging on 'super' receiver when classFariborz Jahanian2009-01-071-3/+6
| | | | | | of category implementation is undeclared. Issue error instead. llvm-svn: 61882
* Silence a couple more operator precedence warnings; this shouldn't Eli Friedman2008-12-161-2/+2
| | | | | | | change the semantics. Please correct this if the precedence was actually supposed to be something different. llvm-svn: 61099
* Change a whole lot of diagnostics to take QualType's directly Chris Lattner2008-11-241-1/+1
| | | | | | | | instead of converting them to strings first. This also fixes a bunch of minor inconsistencies in the diagnostics emitted by clang and adds a bunch of FIXME's to DiagnosticKinds.def. llvm-svn: 59948
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-1/+1
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* Rename Selector::getName() to Selector::getAsString(), and addChris Lattner2008-11-241-12/+14
| | | | | | | | | | | | | a new NamedDecl::getAsString() method. Change uses of Selector::getName() to just pass in a Selector where possible (e.g. to diagnostics) instead of going through an std::string. This also adds new formatters for objcinstance and objcclass as described in the dox. llvm-svn: 59933
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-2/+1
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* merge some simple call diagnostics.Chris Lattner2008-11-211-1/+1
| | | | llvm-svn: 59831
* remove the last old-fashioned Diag method. Transition complete!Chris Lattner2008-11-201-4/+4
| | | | llvm-svn: 59714
* instead of looking up super at startup time, Chris Lattner2008-11-201-1/+1
| | | | | | | just check for it when needed. It doesn't incur real cost in any hot paths. llvm-svn: 59708
* Fix <rdar://problem/6150376> [sema] crash on invalid message send.Steve Naroff2008-11-191-17/+34
| | | | | | The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic). llvm-svn: 59639
* stop calling II::getName() unnecesarily in semaChris Lattner2008-11-191-1/+1
| | | | llvm-svn: 59609
* Switch several more Sema Diag methods over. This simplifies theChris Lattner2008-11-191-17/+15
| | | | | | | | __builtin_prefetch code to only emit one diagnostic per builtin_prefetch. While this has nothing to do with the rest of the patch, the code seemed like overkill when I was updating it. llvm-svn: 59588
* Fix <rdar://problem/6333904> [sema] message lookup on super is incorrectSteve Naroff2008-11-171-1/+17
| | | | | | Missing special lookup rule in Sema::ActOnInstanceMessage(). llvm-svn: 59467
OpenPOWER on IntegriCloud