summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Support code completion for parameter names in Objective-C methodDouglas Gregor2010-07-081-0/+15
| | | | | | declarations. llvm-svn: 107933
* Introduce a new code-completion point prior to an identifier in theDouglas Gregor2010-07-081-0/+11
| | | | | | | | | | | | selector of an Objective-C method declaration, e.g., given - (int)first:(int)x second:(int)y; this code completion point triggers at the location of "second". It will provide completions that fill out the method declaration for any known method, anywhere in the translation unit. llvm-svn: 107929
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-47/+47
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Make the "extra ';' inside a struct or union" diagnostic moreDouglas Gregor2010-06-161-1/+1
| | | | | | precise. Fixes PR7336. llvm-svn: 106170
* Minor tweaks on doug's objc recovery patch: the callerChris Lattner2010-05-311-6/+4
| | | | | | | | | | | | of isSimpleObjCMessageExpression checks the language, so change a dynamic check into an assert. isSimpleObjCMessageExpression is expensive, so only do it in the common case when it is likely to matter: when the [ of the postfix expr starts on a new line. This should avoid doing lookahead for every array expression. llvm-svn: 105229
* When we see the a '[' in a postfix expression in Objective-C, performDouglas Gregor2010-05-311-0/+15
| | | | | | | | | | | | | | | | | | | a simple, quick check to determine whether the expression starting with '[' can only be an Objective-C message send. If so, don't parse it as an array subscript expression. This improves recovery for, e.g., [a method1] [a method2] so that we now produce t.m:10:13: error: expected ';' after expression [a method] ^ instead of some mess about expecting ']'. llvm-svn: 105221
* Implement a code-completion hook for the receiver of an Objective-CDouglas Gregor2010-05-271-0/+7
| | | | | | | message. This completion gives better results than just using the "expression" completion, which is effectively what happened before. llvm-svn: 104895
* Improve code completion in failure cases in two ways:Douglas Gregor2010-05-251-24/+24
| | | | | | | | | | | 1) Suppress diagnostics as soon as we form the code-completion token, so we don't get any error/warning spew from the early end-of-file. 2) If we consume a code-completion token when we weren't expecting one, go into a code-completion recovery path that produces the best results it can based on the context that the parser is in. llvm-svn: 104585
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-051-5/+5
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* Cleanup error recovery for a missing '-'|'+'Fariborz Jahanian2010-04-261-32/+24
| | | | | | on a method declaration (radar 7822196). llvm-svn: 102383
* Rework Parser-Sema interface for Objective-C @catch exception objectDouglas Gregor2010-04-231-4/+2
| | | | | | | | | arguments. Rather than having the parser call ActOnParamDeclarator (which is a bit of a hack), call a new ActOnObjCExceptionDecl action. We'll be moving more functionality into this handler to perform earlier checking of @catch. llvm-svn: 102222
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-5/+12
| | | | | | | | | | statements. Instead of the @try having a single @catch, where all of the @catch's were chained (using an O(n^2) algorithm nonetheless), @try just holds an array of its @catch blocks. The resulting AST is slightly more compact (not important) and better represents the actual language semantics (good). llvm-svn: 102221
* Implement parsing for message sends in Objective-C++. Message sends inDouglas Gregor2010-04-211-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Objective-C++ have a more complex grammar than in Objective-C (surprise!), because (1) The receiver of an instance message can be a qualified name such as ::I or identity<I>::type. (2) Expressions in C++ can start with a type. The receiver grammar isn't actually ambiguous; it just takes a bit of work to parse past the type before deciding whether we have a type or expression. We do this in two places within the grammar: once for message sends and once when we're determining whether a []'d clause in an initializer list is a message send or a C99 designated initializer. This implementation of Objective-C++ message sends contains one known extension beyond GCC's implementation, which is to permit a typename-specifier as the receiver type for a class message, e.g., [typename compute_receiver_type<T>::type method]; Note that the same effect can be achieved in GCC by way of a typedef, e.g., typedef typename computed_receiver_type<T>::type Computed; [Computed method]; so this is merely a convenience. Note also that message sends still cannot involve dependent types or values. llvm-svn: 102031
* Migrate the responsibility for turning the receiver name in anDouglas Gregor2010-04-211-23/+9
| | | | | | | | | Objective-C class message expression into a type from the parser (which was doing so in two places) to Action::getObjCMessageKind() which, in the case of Sema, reduces the number of name lookups we need to perform. llvm-svn: 102026
* Rework the Parser-Sema interaction for Objective-C messageDouglas Gregor2010-04-211-23/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sends. Major changes include: - Expanded the interface from two actions (ActOnInstanceMessage, ActOnClassMessage), where ActOnClassMessage also handled sends to "super" by checking whether the identifier was "super", to three actions (ActOnInstanceMessage, ActOnClassMessage, ActOnSuperMessage). Code completion has the same changes. - The parser now resolves the type to which we are sending a class message, so ActOnClassMessage now accepts a TypeTy* (rather than an IdentifierInfo *). This opens the door to more interesting types (for Objective-C++ support). - Split ActOnInstanceMessage and ActOnClassMessage into parser action functions (with their original names) and semantic functions (BuildInstanceMessage and BuildClassMessage, respectively). At present, this split is onyl used by ActOnSuperMessage, which decides which kind of super message it has and forwards to the appropriate Build*Message. In the future, Build*Message will be used by template instantiation. - Use getObjCMessageKind() within the disambiguation of Objective-C message sends vs. array designators. Two notes about substandard bits in this patch: - There is some redundancy in the code in ParseObjCMessageExpr and ParseInitializerWithPotentialDesignator; this will be addressed shortly by centralizing the mapping from identifiers to type names for the message receiver. - There is some #if 0'd code that won't likely ever be used---it handles the use of 'super' in methods whose class does not have a superclass---but could be used to model GCC's behavior more closely. This code will die in my next check-in, but I want it in Subversion. llvm-svn: 102021
* Fix crash on invalid code where a @throw statement is not followed by a ';'Ted Kremenek2010-04-201-1/+2
| | | | llvm-svn: 101941
* Feed proper source-location information into Sema::LookupSingleResult,Douglas Gregor2010-04-151-3/+3
| | | | | | | | in case it ends up doing something that might trigger diagnostics (template instantiation, ambiguity reporting, access reporting). Noticed while working on PR6831. llvm-svn: 101412
* Fix a -pedantic spurious warning involving @dynamic.Fariborz Jahanian2010-04-141-1/+5
| | | | llvm-svn: 101284
* Introduce a parsing action to distinguish between class, instance, andDouglas Gregor2010-04-141-10/+11
| | | | | | | | super message sends in Objective-C. No actual functionality change here, but it provides a hook so that Sema can typo-correct the receiver in some cases. llvm-svn: 101207
* fix a bug I noticed by inspection, correcting two reject-valid bugs.Chris Lattner2010-04-121-1/+0
| | | | llvm-svn: 101026
* Have the parser decide whether a message to super is a variable orChris Lattner2010-04-121-2/+4
| | | | | | type, instead of having sema do it. llvm-svn: 101016
* fix PR6811 by not parsing 'super' as a magic expression inChris Lattner2010-04-111-6/+13
| | | | | | | | | | | | | LookupInObjCMethod. Doing so allows all sorts of invalid code to slip through to codegen. This patch does not change the AST representation of super, though that would now be a natural thing to do since it can only be in the receiver position and in the base of a ObjCPropertyRefExpr. There are still several ugly areas handling super in the parser, but this is definitely a step in the right direction. llvm-svn: 100959
* Patch to implement gcc's cstyle arguments in objcFariborz Jahanian2010-04-081-4/+13
| | | | | | methods. wip. llvm-svn: 100734
* Implement code completion for Objective-C method declarations andDouglas Gregor2010-04-071-0/+12
| | | | | | | | | | | | | | | | definitions, e.g., after - or - (id) we'll find all of the "likely" instance methods that one would want to declare or define at this point. In the latter case, we only produce results whose return types match "id". llvm-svn: 100587
* Patch to not build ivar ASTs when they are ilegallyFariborz Jahanian2010-04-061-1/+2
| | | | | | declared in categories. llvm-svn: 100577
* Improve diagnosing when a method type does not start with '-'|'+'Fariborz Jahanian2010-04-021-27/+41
| | | | | | when parsing. Fixes radar 7822196. llvm-svn: 100248
* Issue better syntax error when objc's messagingFariborz Jahanian2010-03-311-2/+5
| | | | | | ares are not separated by ':' (radar 7030268). llvm-svn: 100040
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-2/+2
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-311-2/+2
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-311-2/+2
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Fixes access rues for ivars declared in classFariborz Jahanian2010-03-221-1/+1
| | | | | | implementations (radar 7547942). llvm-svn: 99198
* Don't consume tokens past the end-of-file in an @interface. FixesDouglas Gregor2010-03-161-0/+4
| | | | | | <rdar://problem/7735566>. llvm-svn: 98613
* Early support for declaring ivars in class extensions. wip.Fariborz Jahanian2010-02-221-4/+8
| | | | llvm-svn: 96819
* Allow GNU attributes to appear in an Objective-C method declarationTed Kremenek2010-02-181-4/+10
| | | | | | | before the selector name (but after the return type). Among other things, this allows IBAction to be implemented with an attribute. llvm-svn: 96623
* Issue a bettter diagnostics for incorrect property setter name.Fariborz Jahanian2010-02-151-1/+2
| | | | | | (radar 7647953). llvm-svn: 96284
* Clean up ownership of 'AttributeList' objects in Parser. ApparentlyTed Kremenek2010-02-111-6/+13
| | | | | | | | | | | | | | | | | | | | | we would just leak them all over the place, with no clear ownership of these objects at all. AttributeList objects would get leaked on both error and non-error paths. Note: I introduced the usage of llvm::OwningPtr<AttributeList> to manage these objects, which is particularly useful for methods with multiple return sites. In at least one method I used them even when they weren't strictly necessary because it clarified the ownership semantics and made the code easier to read. Should the excessive 'take()' and 'reset()' calls become a performance issue we can always re-evaluate. Note+1: I believe I have not introduced any double-frees, but it would be nice for someone to review this. This fixes <rdar://problem/7635046>. llvm-svn: 95847
* Simplify setting of DeclContext for @catch variableFariborz Jahanian2010-02-031-0/+1
| | | | | | (per Doug's comment). llvm-svn: 95169
* Fix DeclContext of an objective-c @catch variableFariborz Jahanian2010-02-031-0/+1
| | | | | | declaration. Fixes radar 7590273. llvm-svn: 95164
* Keep track of the source locations for each protocol reference inDouglas Gregor2010-01-161-0/+3
| | | | | | | | Objective-C classes, protocol definitions, forward protocol declarations, and categories. This information isn't actually used yet; that's coming next. llvm-svn: 93636
* Code-completion for @public, @protected, @private, @package.Douglas Gregor2010-01-131-0/+12
| | | | llvm-svn: 93361
* Whenever completing ordinary names for an Objective-C source, alsoDouglas Gregor2010-01-131-0/+8
| | | | | | | | | | | provide completions for @ keywords. Previously, we only provided @-completions after an @ was actually typed, which is useful but probably not the common case. Also, make sure a few Objective-C 2.0 completions only show up when Objective-C 2.0 support is enabled (the default). llvm-svn: 93354
* Change ObjCContainerDecl to contain the entire range for the '@end'Ted Kremenek2010-01-071-8/+11
| | | | | | | | | | | piece of the declaration. The '@' and the 'end' are separate tokens, and require two SourceLocations to accurately track. This change was motivated because ObjCContainerDecl::getSourceRange() would previously not return the entire range of the declaration (the 'end' would be left off). llvm-svn: 92891
* Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename ↵Anders Carlsson2009-12-161-1/+1
| | | | | | Action::FullExpr to Action::MakeFullExpr to avoid name clashes. llvm-svn: 91494
* reduce nesting.Chris Lattner2009-12-071-3/+9
| | | | llvm-svn: 90769
* Code completion for Objective-C @ keywords that are statements or expressionsDouglas Gregor2009-12-071-1/+10
| | | | llvm-svn: 90757
* Code completion for Objective-C @ directivesDouglas Gregor2009-12-071-1/+15
| | | | llvm-svn: 90756
* remove some extraneous syntax: sourceloc implicitly converts to sourcerange.Chris Lattner2009-12-061-2/+2
| | | | llvm-svn: 90710
* Lift the ObjCPropertyCallback out of local scope to unbreak VS2005 builds.John McCall2009-12-031-55/+59
| | | | | | | Make it an inner class of Parser to assuage access control. No functionality change. llvm-svn: 90491
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-4/+4
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Objective-C code completion within properties after "setter = " orDouglas Gregor2009-11-191-2/+15
| | | | | | "getter = ", to provide suitable method names. llvm-svn: 89334
OpenPOWER on IntegriCloud