aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Parse/Action.h
AgeCommit message (Collapse)Author
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-10Fix a latent bug in MinimalActions (created by a recent name change).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42829 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-09Make sure methods with no return type default to "id".Steve Naroff
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-09rename some "Parse" actions to "ActOn". Move code around inChris Lattner
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-08Remove 2 protocol related actions from MinimalActions (protocols shouldn't ↵Steve Naroff
be recognized as types). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07move IdentifierTable.h from liblex to libbasic.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05This is the first patch toward supporting protocol conformingFariborz Jahanian
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-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-02Remove Action::ActOnImpleIvarVsClassIvars(), it is only called by Sema (not ↵Steve Naroff
Parser). Add Sema::CheckImplementationIvars() to replace the previous action. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42553 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-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-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-28Patch to warn on umimplemented methods coming from class's Fariborz Jahanian
protocols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42436 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-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-26This patch inserts ivars declared in @implementation in its object and verifies Fariborz Jahanian
that they conform(in type, name and numbers) to those declared in @interface. Test case highlights kind of checking we do here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42360 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-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-16Rename statement actions (from Parse-prefix to ActOn-prefix).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42000 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16Rename expression actions (from Parse-prefix to ActOn-prefix).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16Updated VC++ build system.Hartmut Kaiser
Silenced a couple of VC++ warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41994 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15Start converting Action methods from Parse-prefix to ActOn-prefix.Steve Naroff
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-14Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a ↵Steve Naroff
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-14Patch to store ivars into interface class object.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13Patch for collecting ivars before running action on them.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Fix the following bug submitted by Ted Kremenek:Steve Naroff
void func() { int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier. } This smallish bug resulted in a largish fix. Here are some highlights: - Needed to make sure ParseDeclarator is called *before* parsing any initializer. Removed the "Init" argument to ParseDeclarator. - Added AddInitializerToDecl() to the Action & Sema classes. In Sema, this hook is responsible for validating the initializer and installing it into the respective decl. - Moved several semantic checks from ParseDeclarator() to FinalizeDeclaratorGroup(). Previously, this hook was only responsible for reversing a list. Now it plays a much larger semantic role. All of the above changes ended up simplifying ParseDeclarator(), which is goodness... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11- Add an ObjcIvarDecl AST node (a subclass of FieldDecl).Steve Naroff
- Instantiate the node in Sema::ParseField(), based on the type of the TagDecl. - Add Sema::ObjcAddInstanceVariable(), responsible for adorning/adding the ObjcIvarDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10Early patch to collect objective-c methods inserts them inFariborz Jahanian
class object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06The goal of this commit is to get just enough Sema support to recognize ↵Steve Naroff
Objective-C classes as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very* preliminary. The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41752 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05Start implementing Actions interface for ObjC classes, instance variables, ↵Steve Naroff
and methods. Lot's of small changes to the parser. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31Fix a bug/missing-feature Ted noticed: the 'unused' warning should notChris Lattner
warn about the last stmt in a stmtexpr, f.e. there should be no warning for: int maxval_stmt_expr(int x, int y) { return ({int _a = x, _b = y; _a > _b ? _a : _b; }); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31add actions for deleting expr/stmt nodes.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41635 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30Pass the location of the type.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30add an action callback for __builtin_offsetofChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41606 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22Parse @encode expressions.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21Implement parsing and code generation of Objective-C string literals.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41238 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03Implement __builtin_choose_expr.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01- Finish hooking up support for __builtin_types_compatible_p().Steve Naroff
- Fix type printing code for recently added TypeOfExpr/TypeOfType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).Steve Naroff
Todo...still need to call the action from the parser... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40693 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24implement ast building and trivial semantic analysis of stmt exprs.Chris Lattner
This implements test/Sema/stmt_exprs.c git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22Refactor switch analysis to make it possible to detect duplicate case valuesAnders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40388 91177308-0d34-0410-b5e6-96231b3b80d8