Commit Graph

31 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis e159a73c76 [test] Follow-up for r243119, also add a test case using property methods.
llvm-svn: 243455
2015-07-28 17:38:51 +00:00
Argyrios Kyrtzidis ac4803bb45 [test] Attempt to fix failing test in non-darwin bots.
llvm-svn: 243120
2015-07-24 17:18:25 +00:00
Argyrios Kyrtzidis f0917ab7c1 [code-completion] Strip outer nullability annotations when completing method implementations.
The outer nullability is transferred from the declaration to the implementation so including them is redundant.
The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well
adding them in the implementation will become redundant and we should strip those as well.

rdar://21737451

llvm-svn: 243119
2015-07-24 17:00:19 +00:00
Douglas Gregor 7fa93c7730 [libclang] When inferring nonnull use the contextual keyword for the code-completion results,
when appropriate.

rdar://20742295

llvm-svn: 241560
2015-07-07 06:20:31 +00:00
Douglas Gregor e9d95f1ecc Handle Objective-C type arguments.
Objective-C type arguments can be provided in angle brackets following
an Objective-C interface type. Syntactically, this is the same
position as one would provide protocol qualifiers (e.g.,
id<NSCopying>), so parse both together and let Sema sort out the
ambiguous cases. This applies both when parsing types and when parsing
the superclass of an Objective-C class, which can now be a specialized
type (e.g., NSMutableArray<T> inherits from NSArray<T>).

Check Objective-C type arguments against the type parameters of the
corresponding class. Verify the length of the type argument list and
that each type argument satisfies the corresponding bound.

Specializations of parameterized Objective-C classes are represented
in the type system as distinct types. Both specialized types (e.g.,
NSArray<NSString *> *) and unspecialized types (NSArray *) are
represented, separately.

llvm-svn: 241542
2015-07-07 03:57:35 +00:00
Douglas Gregor 86b4268153 Code completion for nullability type specifiers.
Another part of rdar://problem/18868820.

llvm-svn: 240159
2015-06-19 18:27:52 +00:00
Argyrios Kyrtzidis f8d46fb6eb [code-completion] Add a couple of test cases suggested by Jordan, and a FIXME.
llvm-svn: 202995
2014-03-05 19:10:31 +00:00
Argyrios Kyrtzidis 0692508670 [AST] A "Class<P>" type should not have '*' when printed out.
rdar://14309030

llvm-svn: 202941
2014-03-05 06:47:57 +00:00
Argyrios Kyrtzidis 9ae3956f22 [libclang] Remove the ParentKind cursor kind from code-completion results.
This is to reduce dependency to cursors for the code-completion results.

llvm-svn: 164705
2012-09-26 16:39:56 +00:00
Douglas Gregor 9b4f370095 When code completion walks the members of a protocol or interface,
make sure that we walk the definition. Fixes <rdar://problem/11427742>.

llvm-svn: 158357
2012-06-12 13:44:08 +00:00
Douglas Gregor 2997914ed0 Include the Objective-C parameter- and return-passing qualifiers when
providing code completions for Objective-C method declarations. Fixes
<rdar://problem/11164498>.

llvm-svn: 154421
2012-04-10 18:35:07 +00:00
Douglas Gregor 78254c8880 Introduce a new libclang API to determine the parent context of a code
completion item. For example, if the code completion itself represents
a declaration in a namespace (say, std::vector), then this API
retrieves the cursor kind and name of the namespace (std). Implements
<rdar://problem/11121951>.

llvm-svn: 153545
2012-03-27 23:34:16 +00:00
Douglas Gregor af2a6ae429 Selector::getIdentifierInfoForSlot() can return NULL values, a fact
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
2011-02-18 22:29:55 +00:00
Douglas Gregor f34a6f0fef Implement a special code-completion pattern for "IBAction". Fixes
<rdar://problem/8767704>.

llvm-svn: 125604
2011-02-15 22:19:42 +00:00
Douglas Gregor 0787b3224d Tweak code-completion result priorities, so that exact and similar
type matches have a bigger impact. The impetus for this change was
that, when initializing an enumeration value, we want enumerators of
that enumeration type to have a higher priority than, e.g., unrelated
local variables.

llvm-svn: 116774
2010-10-19 00:03:23 +00:00
Douglas Gregor 8e3e8743fb Introduce code completion results for Objective-C methods, both when
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
2010-10-18 21:05:04 +00:00
Douglas Gregor 1b035bbe3a When providing code completions of Objective-C method declarations
(after - or +), always traverse superclasses and all categories. The
programmer may want to complete a method from *anywhere*.

llvm-svn: 116723
2010-10-18 18:21:28 +00:00
Douglas Gregor 36e3b5c79e Switch c-index-test from clang_codeComplete() over to
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
2010-10-11 21:37:58 +00:00
Douglas Gregor 5fb901deee Code completion has no reason to prefer values over types, especially
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
2010-09-20 23:11:55 +00:00
Douglas Gregor e9e641cce1 Swap the priorities of constants and types, so that we prefer types.
llvm-svn: 114086
2010-09-16 16:21:35 +00:00
Douglas Gregor 1099865124 Revert "Move the sorting of code-completion results out of the main path and
into the clients", because the C standard library sucks. Where's my
stable sort, huh?

llvm-svn: 112121
2010-08-26 00:30:24 +00:00
Douglas Gregor ebb7c84891 Move the sorting of code-completion results out of the main path and
into the clients, e.g., the printing code-completion consumer and
c-index-test. Clients may want to re-sort the results anyway.

llvm-svn: 112095
2010-08-25 22:15:42 +00:00
Douglas Gregor 416b575edc When performing completions involving Objective-C method declarations
(e.g., for message sends or method declaration/definition
completions), adjust methods that come from a base class.

llvm-svn: 112013
2010-08-25 01:08:01 +00:00
Douglas Gregor 45140a9040 In code-completion contexts where both types and other values are
present, prefer values to types, since it's more common to compute
with values than it is to declare new entities or perform type
casts. So, tweak the ranking of types vs. other declarations and
constants accordingly.

llvm-svn: 111998
2010-08-24 23:40:45 +00:00
Douglas Gregor 99fa264a67 Provide code completion results for the context-sensitive Objective-C
keywords "in", "out", "inout", "byref", "bycopy", and "oneway".

llvm-svn: 111884
2010-08-24 01:06:58 +00:00
Douglas Gregor 7116a8c19a When generating code completion patterns for method declarations, give
the resulting pattern the appropriate cursor kind of an instance or
class method declaration.

llvm-svn: 111237
2010-08-17 16:06:07 +00:00
Douglas Gregor b0ce9b79ba 1 != I. Fix the formulation of code-completion patterns for
Objective-C method declarations with > 2 parameters.

llvm-svn: 111233
2010-08-17 15:53:35 +00:00
Douglas Gregor 4587969555 Support code completion for parameter names in Objective-C method
declarations.

llvm-svn: 107933
2010-07-08 23:37:41 +00:00
Douglas Gregor 95887f9c5b Introduce a new code-completion point prior to an identifier in the
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
2010-07-08 23:20:03 +00:00
Douglas Gregor d37c59dae7 Don't put method bodies into code completions unless code patterns are
turned on.

llvm-svn: 104909
2010-05-28 00:57:46 +00:00
Douglas Gregor 636a61e0d2 Implement code completion for Objective-C method declarations and
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
2010-04-07 00:21:17 +00:00