summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Make helpers static.Benjamin Kramer2011-03-261-3/+3
| | | | llvm-svn: 128339
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-1/+0
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* When code-completing a case statement for a switch on a value ofDouglas Gregor2011-02-181-3/+4
| | | | | | | enumeration type, prioritize the enumeration constants and don't provide completions for any other expressions. Fixes <rdar://problem/7283668>. llvm-svn: 125991
* Selector::getIdentifierInfoForSlot() can return NULL values, a factDouglas Gregor2011-02-181-13/+11
| | | | | | | | | | | | that was ignored in a few places (most notably, code completion). Introduce Selector::getNameForSlot() for the common case where we only care about the name. Audit all uses of getIdentifierInfoForSlot(), switching many over to getNameForSlot(), fixing a few crashers. Fixed <rdar://problem/8939352>, a code-completion crasher. llvm-svn: 125977
* I will not hold on to temporary StringRefs.Douglas Gregor2011-02-171-50/+51
| | | | | | | | | | | | | | | I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. I will not hold on to temporary StringRefs. llvm-svn: 125718
* Implement code completion results for the Objective-C Key-Value CodingDouglas Gregor2011-02-171-12/+655
| | | | | | (KVC) and Key-Value Observing (KVO) protocols. llvm-svn: 125696
* When trying to provide a code completion item for a call to "super" inDouglas Gregor2011-02-161-1/+12
| | | | | | | Objective-C, also look in the categories and class extensions of our superclasses. Fixes <rdar://problem/8853540>. llvm-svn: 125628
* Teach code completion to cope with block types written without aDouglas Gregor2011-02-151-5/+7
| | | | | | | prototype, e.g., ^() rather than ^(void). Fixes <rdar://problem/8875712>. llvm-svn: 125608
* Implement a special code-completion pattern for "IBAction". FixesDouglas Gregor2011-02-151-1/+22
| | | | | | <rdar://problem/8767704>. llvm-svn: 125604
* When code-completing within a list of declaration specifiers,Douglas Gregor2011-02-151-0/+8
| | | | | | | | separately handle the case of a local declaration-specifier list, including all types in the set of options. Fixes <rdar://problem/8790735> and <rdar://problem/8662831>. llvm-svn: 125594
* Create a special allocator class for code completion, so that all ofDouglas Gregor2011-02-011-76/+66
| | | | | | | the string copying goes through a single place that can have associated state. llvm-svn: 124698
* Provide constant strings for certain common code completion strings,Douglas Gregor2011-02-011-22/+90
| | | | | | eliminating the need to copy those strings. llvm-svn: 124683
* Allocate CodeCompletionString and all of its components in aDouglas Gregor2011-02-011-764/+789
| | | | | | | | | | | | BumpPtrAllocator, rather than manually new/delete'ing them. This optimization also allows us to avoid allocating memory for and copying constant strings (e.g., "return", "class"). This also required embedding the priority and availability of results within the code completion string, to avoid extra memory allocation within libclang. llvm-svn: 124673
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-1/+1
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Fix a major inconsistency in the representation of Objective-CDouglas Gregor2010-12-211-32/+2
| | | | | | | | | | | | | | | | | | | | classes, categories, protocols, and class extensions, where the methods and properties of these entities would be inserted into the DeclContext in an ordering that doesn't necessarily reflect source order. The culprits were Sema::ActOnMethodDeclaration(), which did not perform the insertion of the just-created method declaration into the DeclContext for these Objective-C entities, and Sema::ActOnAtEnd(), which inserted all method declarations at the *end* of the DeclContext. With this fix in hand, clean up the code-completion actions for property setters/getters that worked around this brokenness in the AST. Fixes <rdar://problem/8062781>, where this problem manifested as poor token-annotation information, but this would have struck again in many other places. llvm-svn: 122347
* Added missing IgnoreParens().Abramo Bagnara2010-12-141-4/+1
| | | | llvm-svn: 121795
* Added ParenType type node.Abramo Bagnara2010-12-101-0/+3
| | | | llvm-svn: 121488
* Eliminate duplicate code completions for properties.Douglas Gregor2010-12-091-11/+25
| | | | llvm-svn: 121424
* Don't walk the translation unit context to produce protocol names whenDouglas Gregor2010-12-091-17/+26
| | | | | | | | | | global code completions are disabled (e.g., because they are cached). Also, make sure that forward-declared protocols are visited when we look for all visible names within a declaration context. Previously, we would end up with duplicate completions for protocols. llvm-svn: 121416
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-3/+4
| | | | | | | | | | | | | | | | used in a constructor initializer list: struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. llvm-svn: 120900
* Do not produce "purely informative" code completion results forDouglas Gregor2010-11-171-22/+35
| | | | | | | Objective-C message sends, which have only whitespace in their TypedText chunk. Such results have no purpose. llvm-svn: 119569
* Revert the fix for PR8013.Douglas Gregor2010-11-091-4/+0
| | | | | | | | | | | | | That bug concerned the well-formedness of code such as (&ovl)(a, b, c). GCC rejects the code, while EDG accepts it. On further study of the standard, I see no support for EDG's position: in particular, C++ [over.over] does not list this as a context where we can take the address of an overloaded function, C++ [over.call.func] does not reference the address-of operator at any point, and C++ [expr.call] claims that the function argument in a call is either a function lvalue or a pointer-to-function; (&ovl) is neither. llvm-svn: 118620
* Handle overload resolution when calling an overloaded function setDouglas Gregor2010-11-091-0/+4
| | | | | | with, e.g., (&f)(a, b, c). Fixes PR8013. llvm-svn: 118508
* Teach code completion not to include out-of-line declarations andDouglas Gregor2010-11-091-1/+8
| | | | | | | definitions in its results. The original declarations will be visible wherever they are declared. llvm-svn: 118484
* If an instance method messages is sending to an expression of type Class,Douglas Gregor2010-11-081-8/+15
| | | | | | | | and we statically can compute a bound on the actual type (e.g., because it's a send to the the magic "class" instance method), code complete as if we were performing a class message send to that class. llvm-svn: 118443
* Teach code completion to provide property results when the propertyDouglas Gregor2010-11-021-9/+43
| | | | | | can be used to automatically synthesize an ivar. llvm-svn: 118052
* Fix the translation of the PCC_ForInit code-completion context forDouglas Gregor2010-10-181-2/+8
| | | | | | | | C++/C99/Objective-C, so that we properly include types. This fix affects global caching of code-completion results; without caching, the behavior was already correct. llvm-svn: 116757
* Introduce code completion results for Objective-C methods, both whenDouglas Gregor2010-10-181-6/+8
| | | | | | | | | declaring methods and when sending messages to them, by bringing all of the selector into TypedCheck chunks in the completion result. This way, we can improve the sorting of these results to account for the full selector name rather than just the first chunk. llvm-svn: 116746
* When providing code completions of Objective-C method declarationsDouglas Gregor2010-10-181-48/+28
| | | | | | | (after - or +), always traverse superclasses and all categories. The programmer may want to complete a method from *anywhere*. llvm-svn: 116723
* Eliminate the use of ObjCSuperExpr in code completion.Douglas Gregor2010-10-131-11/+9
| | | | llvm-svn: 116436
* Switch c-index-test from clang_codeComplete() over toDouglas Gregor2010-10-111-2/+4
| | | | | | | | | | clang_codeCompleteAt(). This uncovered a few issues with the latter: - ASTUnit wasn't saving/restoring diagnostic state appropriately between reparses and code completions. - "Overload" completions weren't being passed through to the client llvm-svn: 116241
* Fix the mapping of vertical-space cursor kinds to produce a newline,Douglas Gregor2010-10-081-0/+1
| | | | | | rather than a space. llvm-svn: 116097
* When providing a block literal as a code completion for aDouglas Gregor2010-10-021-0/+5
| | | | | | | | function/method argument, include the parameter name and always include parentheses (even for zero-parameter blocks). Otherwise, the block literal placeholder '^' can look very weird. llvm-svn: 115444
* Synchronize globally-cached code completion results with the resultsDouglas Gregor2010-09-231-75/+106
| | | | | | | | | | | | | | provided when the optimization is disabled. In particular, split the completion context CCC_Other into two contexts: CCC_Other, which means that it's an undisclosed context for which any other results are unwelcome, and CCC_Recovery, which is used in recovery cases. Since we're now using the completion context within the completion results builder, make sure that it's always set to something. Fixes <rdar://problem/8470644>. llvm-svn: 114704
* Add code completion for C++ constructors wherever we see the class (orDouglas Gregor2010-09-211-11/+112
| | | | | | class template) and are in a context where we can have a value. llvm-svn: 114441
* When providing code completions for an argument in an Objective-CDouglas Gregor2010-09-211-7/+71
| | | | | | | | | | | | message send, e.g., [[NSString alloc] initWithCString:<CC> look up all of the possible methods and determine the preferred type for the argument expression based on the type of the corresponding parameter. llvm-svn: 114379
* Refactor code completion for expressions that occur as arguments inDouglas Gregor2010-09-201-6/+20
| | | | | | | | Objective-C message sends. There is no functionality change here; this is prep work for using the parameter types to help guide the expression results when code-completing the argument. llvm-svn: 114375
* Code completion has no reason to prefer values over types, especiallyDouglas Gregor2010-09-201-1/+1
| | | | | | | | at the statement level or in Objective-C message receivers. Therefore, just give types and declarations the same basic priority, and adjust from there. llvm-svn: 114374
* Slight refactoring in code-completion results generation, placing theDouglas Gregor2010-09-201-38/+50
| | | | | | | various priority adjustments for preferences (based on selectors, types) in a single function to make extension easier. llvm-svn: 114370
* Get rid of the lame attempt to prioritize "void" functions atDouglas Gregor2010-09-201-12/+3
| | | | | | | statement context; it really isn't helpful in practice (remember printf!) and we'll be doing other adjustments for statements very soon. llvm-svn: 114358
* Tweak priorities for some types and macros:Douglas Gregor2010-09-201-4/+16
| | | | | | | | | | - In Objective-C, we prefer BOOL to bool for historic reasons; slightly penalize "bool". - Treat Nil macro as a NULL pointer constant. - Treat YES, NO, true, and false macros as constants. - Treat the bool macro as a type. llvm-svn: 114356
* Continue parsing more postfix expressions, even after semanticDouglas Gregor2010-09-181-3/+5
| | | | | | errors. Improves code completion in yet another case. llvm-svn: 114255
* Don't add two code-completion results for the same selector; itDouglas Gregor2010-09-161-16/+42
| | | | | | | doesn't add any value. Instead, we'll just take the first method with that selector that we find and create a completion for it. llvm-svn: 114082
* When collecting Objective-C methods for message send completions, beDouglas Gregor2010-09-161-0/+11
| | | | | | sure to visit the protocols of protocols. llvm-svn: 114079
* Implement code completion for Objective-C class message sends that areDouglas Gregor2010-09-161-32/+71
| | | | | | | | | | | | | | | | | | | | | | | | | missing the opening bracket '[', e.g., NSArray <CC> at function scope. Previously, we would only give trivial completions (const, volatile, etc.), because we're in a "declaration name" scope. Now, we also provide completions for class methods of NSArray, e.g., alloc Note that we already had support for this after the first argument, e.g., NSArray method:x <CC> would get code completion for class methods of NSArray whose selector starts with "method:". This was already present because we recover as if NSArray method:x were a class message send missing the opening bracket (which was committed in r114057). llvm-svn: 114078
* Improve code completion for Objective-C message sends when the openingDouglas Gregor2010-09-151-15/+8
| | | | | | | | | | | | | | | | | | | | | | | '[' is missing. Prior commits improving recovery also improved code completion beyond the first selector, e.g., at or after the "to" in calculator add:x to:y but not after "calculator". We now provide the same completions for calculator <CC> that we would for [calculator <CC> if "calculator" is an expression whose type is something that can receive Objective-C messages. This code completion works for instance and super message sends, but not class message sends. llvm-svn: 113976
* Introduce a new code-completion context for a parenthesizedDouglas Gregor2010-09-141-6/+13
| | | | | | | | expression, e.g., after the '(' that could also be a type cast. Here, we provide types as code-completion results in C/Objective-C (C++ already had them), although we wouldn't in a normal expression context. llvm-svn: 113904
* Teach libclang to walk the base and member initializers of aDouglas Gregor2010-09-091-1/+2
| | | | | | | | constructor, in source order. Also introduces a new reference kind for class members, which is used here (for member initializers) and will also be used for designated initializers and offsetof. llvm-svn: 113545
* When providing a completion for a function/method parameter of blockDouglas Gregor2010-09-081-16/+21
| | | | | | pointer type, actually provide a usable block literal expression. llvm-svn: 113431
* zap dead code.Chris Lattner2010-09-041-6/+2
| | | | llvm-svn: 113074
OpenPOWER on IntegriCloud