Граф коммитов

121 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner d19144b244 resolve a fixme, by moving __builtin_va_list to a more logical
place and making it correctly parameterized on the target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42830 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 17:48:53 +00:00
Steve Naroff 640db42222 Fix a latent bug in MinimalActions (created by a recent name change).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 17:45:44 +00:00
Steve Naroff e440eb8158 Remove Scope argument from ObjC actions that either don't need it or can now 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-10 17:32:04 +00:00
Steve Naroff b216c8861c Make sure methods with no return type default to "id".
This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).

Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.

Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 22:01:59 +00:00
Chris Lattner 90ae68aae9 avoid a noop virtual method call on the hot scope poping path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42809 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 20:37:18 +00:00
Chris Lattner df19526177 swtich to Token::is/isNot
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42798 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:51:17 +00:00
Chris Lattner 4e1d99a8a4 switch more code to use Token::is/isNot where possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:41:39 +00:00
Chris Lattner 04d6666eee switch some more of the parser over to using Token::is and isNot
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:33:22 +00:00
Chris Lattner 0007322266 Add two new Token helper functions, "is" and "isNot". This allows us to write
stuff like this:

       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.isNot(tok::comma))
         break;
instead of:
       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.getKind() != tok::comma)
         break;

There is obviously no functionality change, but the code reads a bit better and is 
more terse.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:23:58 +00:00
Chris Lattner b652cea7d7 rename some "Parse" actions to "ActOn". Move code around in
ParseFunctionDefinition so that ActOnFunctionDefBody is always
called if ActOnStartOfFunctionDef is called.  This fixes a crash
reported by Nuno Lopes.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:14:05 +00:00
Steve Naroff 71e99080e7 Remove 2 protocol related actions from MinimalActions (protocols shouldn't be recognized as types).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 23:10:47 +00:00
Fariborz Jahanian e37882ad33 Added a new class for Interfaces qualified by protocol list.
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-08 23:06:41 +00:00
Fariborz Jahanian ab0aeb0bf3 Several small patches to do pretty printing for objective-c top-level decls
(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-08 18:53:38 +00:00
Chris Lattner c7229c338c move IdentifierTable.h from liblex to libbasic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 08:58:51 +00:00
Chris Lattner ff38491c18 simplify the interfaces to create selectors: getSelector can take any
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-07 02:00:24 +00:00
Fariborz Jahanian 245f92a886 This is the first patch toward supporting protocol conforming
objective-c types. It also removes use of Scope* parameter in
getObjCProtocolDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05 21:01:53 +00:00
Steve Naroff 29238a0bf7 Layering refinements for selectors (suggested by Chris). Specifics...
- 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-05 18:42:47 +00:00
Fariborz Jahanian b384d329e0 this patch accomodates clattner's comments on expression processing in @try-statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04 20:19:06 +00:00
Chris Lattner c97c20446a minor cleanup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42596 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 22:03:06 +00:00
Steve Naroff 3a165b066e Finish renaming ObjC declaration actions.
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-03 21:00:46 +00:00
Steve Naroff 37e58d104d Rename several ObjC action methods to use the "ActOn" prefix (still a few 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-02 22:39:18 +00:00
Fariborz Jahanian 8f3fde00ad This patch introduces the ObjcCategoryImplDecl class and does the checking 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-02 16:38:50 +00:00
Steve Naroff 4db1089437 Use Identifier::getLength() instead of strlen() in Selector::getName() and MultiKeywordSelector::getName().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42524 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02 02:01:22 +00:00
Fariborz Jahanian 3a63da7053 This patch fixes all issues mentioned in clattner's feedback of
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-29 18:24:58 +00:00
Fariborz Jahanian 9d048ff59f Removed use of hash table for class decls and do a name look up directly.
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-29 00:54:24 +00:00
Steve Naroff 5b6b72f53a Add some comments to MultiKeywordSelector, make all methods private, add a friend, move some methods around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28 23:39:26 +00:00
Steve Naroff bcfb06ac6d Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.
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-28 22:22:11 +00:00
Fariborz Jahanian d064951b0d Patch to use case-stmt for keywords used as selectgor names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 19:52:15 +00:00
Fariborz Jahanian d0b015461a Patch for method implementation. It populates ObjcImplementationDecl object 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-27 18:57:03 +00:00
Chris Lattner 271f1a6373 Fix some use of uninit variables issues, reported by Anton.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42396 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-27 15:15:46 +00:00
Steve Naroff 68d331a78e Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference 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-27 14:38:14 +00:00
Fariborz Jahanian 095ffca8c5 Removed a few TODOs on things which are done.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 17:03:44 +00:00
Fariborz Jahanian ccb4f31424 This patch introduces a new class to keep track of class implementation 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-25 18:38:09 +00:00
Fariborz Jahanian 894c57f565 This patch instantiates objects for forward protocols and in general handles 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-21 15:40:54 +00:00
Fariborz Jahanian 397fcc117e Patch to parse objective-c's @try-statement and @throw-statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42148 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 19:14:32 +00:00
Steve Naroff 563477da25 Progress on message expressions...
- 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-18 23:55:05 +00:00
Fariborz Jahanian fd225cc227 Patch for object creation and handling of category declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42104 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 20:26:58 +00:00
Fariborz Jahanian 00933591a2 Uses more description name for method implementation kind argument.
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-18 00:25:23 +00:00
Fariborz Jahanian 146fbb0c8b Patch to remove ObjcProtoMethodDecl and use ObjcMethodDecl
instead for @protocol method decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42070 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 22:36:42 +00:00
Fariborz Jahanian 25e077d59a Patch to add objective-c's @protocl type declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42060 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:07:36 +00:00
Steve Naroff 708391a0e6 Finish defining Action API for message expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42059 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 21:01:15 +00:00
Steve Naroff 37387c9328 - Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and 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-17 20:25:27 +00:00
Steve Naroff d16245b6d4 Fix a few 80 column violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42028 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 15:07:43 +00:00
Steve Naroff 8c9f13e494 Fixes/tweaks that prevent "defaults-i.m" from compiling.
- Allow classnames as the receiver (removing a FIXME from ParseObjCMessageExpression).
- Added a FIXME to ParseObjCMessageExpression()...we need to return a message expr AST node!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42001 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 16:16:00 +00:00
Steve Naroff 1b273c4037 Rename statement actions (from Parse-prefix to ActOn-prefix).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42000 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 14:56:35 +00:00
Steve Naroff f69936d1ba Rename expression actions (from Parse-prefix to ActOn-prefix).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 03:34:24 +00:00
Steve Naroff 08d92e46d2 Start converting Action methods from Parse-prefix to ActOn-prefix.
The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15 18:49:24 +00:00
Steve Naroff f13271f840 Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a visibility argument.
Remove Action::ObjcAddVisibilityToIvars(). No need for an extra API when it is trivial to add this info to the previous hook.

In general, I want to start migrating away from having Actions prefixed with "Parse" (which is confusing, since the Action API doesn't do any parsing, per se).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 23:09:53 +00:00
Fariborz Jahanian b04a02184c Patch to store ivars into interface class object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 21:08:27 +00:00
Fariborz Jahanian e267ab6246 Semantic analysis for objective-c ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 16:27:55 +00:00