summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Add a new expression class, ObjCSuperExpr, to handle the Objective-C ↵Douglas Gregor2008-11-041-2/+1
| | | | | | 'super'. Remove ObjCThis from PredefinedExpr llvm-svn: 58698
* Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global ↵Steve Naroff2008-09-301-6/+9
| | | | | | | | scope) fails to handle overloaded selectors properly. Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary. llvm-svn: 56843
* Fix <rdar://problem/6251012> clang: Blocks are objects too.Steve Naroff2008-09-291-1/+2
| | | | llvm-svn: 56791
* Fix <rdar://problem/6252129> implementation of method in category doesn't ↵Steve Naroff2008-09-281-0/+8
| | | | | | effectively declare it for methods below. llvm-svn: 56771
* Fix two bugs exposed by array passing assert:Daniel Dunbar2008-09-111-8/+26
| | | | | | | | | (1) Additional arguments to variadic methods should have default promotions applied. (2) Additional arguments to non-variadic methods were allowed. llvm-svn: 56084
* Bug fix, apply default argument promotion in message sends for whichDaniel Dunbar2008-09-111-0/+4
| | | | | | | | | no method declaration was found. - This was allowing arrays to pass "by value" among other things. Add assert in CodeGen that arguments cannot have array type. llvm-svn: 56080
* Refactor common Obj-C message send checking code intoDaniel Dunbar2008-09-111-45/+27
| | | | | | | CheckMessageArgumentTypes. - No functionality change. llvm-svn: 56079
* Change Parser & Sema to use interned "super" for comparions.Daniel Dunbar2008-08-141-1/+1
| | | | | | | | | | | | | | - Added as private members for each because it is not clear where to put the common definition. Perhaps the IdentifierInfos all of these "pseudo-keywords" should be collected into one place (this would KnownFunctionIDs and Objective-C property IDs, for example). Remove Token::isNamedIdentifier. - There isn't a good reason to use strcmp when we have interned strings, and there isn't a good reason to encourage clients to do so. llvm-svn: 54794
* Minor #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | - Drop TokenKinds.h from Action.h - Move DeclSpec.h from Sema.h into individual Sema .cpp files llvm-svn: 54625
* rename PreDefinedExpr -> PredefinedExprChris Lattner2008-08-101-2/+2
| | | | llvm-svn: 54605
* change more instances of QualType::getCanonicalType to callChris Lattner2008-07-261-9/+9
| | | | | | ASTContext::getCanonicalType instead (PR2189) llvm-svn: 54105
* Cleaunup Sema::ActOnClassMessage(). This commit:Steve Naroff2008-07-251-15/+24
| | | | | | | (a) removes a bogus warning. (b) removes an undesirable usage of the ObjCMessageExpr constructor that takes an IdentifierInfo * (which I will abolish). llvm-svn: 54042
* Fix Sema::ActOnClassMessage() to pass through the identifier for "super". Steve Naroff2008-07-241-3/+9
| | | | | | | | This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super'). Also added a couple FIXME's since I'm not happy with my fix to Sema. It would be nicer if the super handling for class/instance messages was the same (based on PreDefinedExpr). llvm-svn: 53994
OpenPOWER on IntegriCloud