aboutsummaryrefslogtreecommitdiff
path: root/Parse/ParseObjc.cpp
AgeCommit message (Collapse)Author
2007-10-311) More additions for objective-c's qualifier type.Fariborz Jahanian
2) Fixed a test failure (which should have failed all along!). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31Fix two rewriter bugs:Steve Naroff
- For @class, don't generate multiple typedefs. - Handle the following edge case interface... @interface NSMiddleSpecifier : NSObject {} @end ...which was incorrectly being rewritten to... struct _interface_NSMiddleSpecifier { struct _interface_NSObject _NSObject; }; {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43580 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30- Add location info to category/protocol AST'sSteve Naroff
- Rewrite categories. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30Remove a couple FIXME's for rewriting ObjC interfaces (which are now being ↵Steve Naroff
rewritten properly). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30More support for rewriting ObjC intefaces. Still some edge cases to handle...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43493 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29Remove a bunch of TODO's that have been done for quite some time...Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29This commit contains lot's of small tweaks to how we pass around and store ↵Steve Naroff
SourceLocation's for interfaces/protocols/categories/implementations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26Start rewriting ObjC interfaces. As a start, we comment out all the methods. ↵Steve Naroff
This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-19add NL at end of fileGabor Greif
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43178 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17Implementation of AST for @protocol expression.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43075 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Fix location processing of @selector: the range should include the @ sign.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Fix location processing of @encode: the range should include the @ sign.Chris Lattner
@selector probably gets this wrong also. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43048 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Fix problem dumping/printing method names with null selector.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43039 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16Patch to implement AST generation for objective-c's @selector expression.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15Patch to parse @selector expressions.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15Fix a parser bug with message expressions - need to call ↵Steve Naroff
ParsePostfixExpressionSuffix(). Now were correctly allow the following... i = [str rangeOfString:@"]"].length; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43012 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14- Added Sema::AddFactoryMethodToGlobalPool and ↵Steve Naroff
Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow us to efficiently lookup a method from a selector given no type information (for the "id" data type). - Fixed some funky "} else {" indentation in Sema::ActOnAddMethodsToObjcDecl(). I'd prefer we stay away from this style...it wastes space and isn't any easier to read (from my perspective, at least:-) - Changed Parser::ParseObjCInterfaceDeclList() to only call Action::ActOnAddMethodsToObjcDecl() when it actually has methods to add (since most interface have methods, this is a very minor cleanup). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11This patch implementa objective-c's @compatibilty-alias declaration.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42883 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11Patch to create protocol conforming class types.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10Remove Scope argument from ObjC actions that either don't need it or can now ↵Steve Naroff
use TUScope. Also improve a recently added comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42826 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09swtich to Token::is/isNotChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42798 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08Added a new class for Interfaces qualified by protocol list.Fariborz Jahanian
Protocols are now sorted and made unique in the list. Enhanced pretty printer for @interface (So, I can see the protocol list). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08Several small patches to do pretty printing for objective-c top-level declsFariborz Jahanian
(minimal printing), Derive ObjcClassDecl from Decl. Ted may want to take note of the change I made to CFGRecStmtDeclVisitor.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42764 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07simplify the interfaces to create selectors: getSelector can take any Chris Lattner
number of arguments now and does the right thing, but the nullary/unary accessors are preserved as convenience functions. This allows us to slightly simplify clients. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42716 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05Layering refinements for selectors (suggested by Chris). Specifics...Steve Naroff
- Add SelectorTable, which enables us to remove MultiKeywordSelector from the public header. - Remove FoldingSet from IdentifierInfo.h and Preprocessor.h. - Remove Parser::ObjcGetUnarySelector and Parser::ObjcGetKeywordSelector, they are subsumed by SelectorTable. - Add MultiKeywordSelector to IdentifierInfo.cpp. - Move a bunch of selector related methods from ParseObjC.cpp to IdentifierInfo.cpp. - Added some comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04this patch accomodates clattner's comments on expression processing in ↵Fariborz Jahanian
@try-statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03Finish renaming ObjC declaration actions.Steve Naroff
Add comments. Switch to new indentation style for the Action class. Since many actions take many arguments, the new style will... - make it easier to add/remove arguments without messing up the indentation... - make it easier to add comments to each argument (see ActOnMethodDeclaration for an example)... - in general, just makes it easier to see what is being passed. The rest of Actions will be converted "lazily"...there is no immediate need to hack all the existing methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02Rename several ObjC action methods to use the "ActOn" prefix (still a few ↵Steve Naroff
more to do). Remove Action::ObjCStartCategoryInterface/ObjCFinishInterface - they are unused. . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42559 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02This patch introduces the ObjcCategoryImplDecl class and does the checking ↵Fariborz Jahanian
related to unimplemented methods in category implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02Use Identifier::getLength() instead of strlen() in Selector::getName() and ↵Steve Naroff
MultiKeywordSelector::getName(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42524 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29This patch fixes all issues mentioned in clattner's feedback of Fariborz Jahanian
September 28, 2007 4:39:24 PM PDT Please let me know if I missed anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42473 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29Removed use of hash table for class decls and do a name look up directly.Fariborz Jahanian
There is still an issue if doing ScopedLookup is an overkill and we can just access the decl using the identifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42463 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Add some comments to MultiKeywordSelector, make all methods private, add a ↵Steve Naroff
friend, move some methods around. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.Steve Naroff
This motivated implementing a devious clattner inspired solution:-) This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema). This change was critical to make now, before we have too many clients. I still need to add some comments to the Selector class...will likely add later today/tomorrow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42452 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27Patch to use case-stmt for keywords used as selectgor names.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27Patch for method implementation. It populates ObjcImplementationDecl object ↵Fariborz Jahanian
with method implementation declarations . It checks and warns on those methods declared in class interface and not implemented. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42412 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27Fix some use of uninit variables issues, reported by Anton.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42396 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference ↵Steve Naroff
is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits: #1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable. #2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%. #3: It results in many API simplifications. Here are some highlights: - Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages). - Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo). - Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured). I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later. Thanks to Chris for talking this through with me and suggesting this approach. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42395 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25This patch introduces a new class to keep track of class implementation ↵Fariborz Jahanian
info. It also adds more semantic checks for class and protocol declarations. Test cases are good indications of kind of checking being done in this patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42311 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21This patch instantiates objects for forward protocols and in general handles ↵Fariborz Jahanian
use of protocols referenced in @protocol declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42191 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19Patch to parse objective-c's @try-statement and @throw-statement.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42148 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18Progress on message expressions...Steve Naroff
- Add ObjcMessageExpr AST node and associated constructors. - Add SourceLocation's to ActOnKeywordMessage/ActOnUnaryMessage API. - Instantiate message expressions... - Replace alloca usage with SmallString. Next step, installing a correct type, among other tweaks... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42116 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18Patch for object creation and handling of category declarations.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42104 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18Uses more description name for method implementation kind argument.Fariborz Jahanian
Moves such argument as the last argument and uses defaul value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Patch to remove ObjcProtoMethodDecl and use ObjcMethodDeclFariborz Jahanian
instead for @protocol method decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42070 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Patch to add objective-c's @protocl type declaration.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42060 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Finish defining Action API for message expressions.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42059 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17- Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ↵Steve Naroff
ObjcKeywordMessage. - Removed helper ObjcGetSelectorInfo(), moving the code directly into ObjcBuildMethodDeclaration(). - Many refinements to ParseObjCMessageExpression(). - Add ActOnMessageExpression(). Next step, finish the message actions and (finally) create/instantiate an ObjcMessageExpr AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17Fix a few 80 column violations.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42028 91177308-0d34-0410-b5e6-96231b3b80d8