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

69 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor ef96eac2b8 When code completion of an overload set fails, produce results for ordinary name lookup instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 19:06:04 +00:00
Douglas Gregor a61a87980d Add a function's cv-qualifiers to the code-completion results as an
informative chunk.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:44:16 +00:00
Douglas Gregor d1cd31aeb8 Teach code completion to instantiate templates when it needs to
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:28:39 +00:00
Douglas Gregor ce82196076 Member function templates can occur after . or ->
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91137 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:14:22 +00:00
Douglas Gregor 7628294ee8 Tweak code-completion results by suppressing class template
specializations and class template partial specializations (they're
never named directly). Also, member access expressions only refer to
value declarations (fields, functions, enumerators, etc.) and
Objective-C property declarations; filter out everything else.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 17:31:05 +00:00
Douglas Gregor e29ffaae9b Class template (partial) specializations should not show up in code completion results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 16:18:54 +00:00
Douglas Gregor 2a7925c4ab When in an Objective-C instance method, super is a valid code-completion result
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 09:54:55 +00:00
Douglas Gregor 9a0c85e640 Code completion for Objective-C @ keywords that are statements or expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 09:51:25 +00:00
Douglas Gregor c464ae8444 Code completion for Objective-C @ directives
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 09:27:33 +00:00
Douglas Gregor d490f953e8 PointerUnion == PointerUnion does not do what I thought it did. Also, fix a thinko in a PointerUnion::get call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 21:27:58 +00:00
Douglas Gregor fbcb5d60d0 Switch the std::multimap shadow map used in code completion to an
llvm::DenseMap, for a 20% performance improvement in the
Cocoa-big-list performance benchmark.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 20:23:50 +00:00
Benjamin Kramer 0e7049fc6f Avoid trashing two temporary strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 10:22:15 +00:00
Benjamin Kramer f42d4886ae strcasecmp is unportable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 10:07:04 +00:00
Douglas Gregor 2b0cc12cf1 Improve the performance of code completion by 2.2x when completing for ordinary names with Cocoa.h included, by drastically improving the performance of our results sorting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 09:08:56 +00:00
Douglas Gregor 2b4074f1d3 Switch the clang-to-CIndex interface for code-completion to a binary format, for a massive speedup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 05:55:20 +00:00
John McCall 7dafdf5117 Remove all of Sema's explicit uses of OverloadedFunctionDecl except for
those associated with TemplateNames.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 22:55:35 +00:00
Benjamin Kramer 660cc18ba2 Remove useless c_str() calls in SemaCodeComplete.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 20:18:50 +00:00
John McCall f7a1a744eb Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and
DependentScopeDeclRefExpr support storing templateids.  Unite the common   
code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr.

This gets us to a point where we don't need to store function templates in
the AST using TemplateNames, which is critical to ripping out OverloadedFunction.

Also resolves a few FIXMEs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 19:00:30 +00:00
John McCall d5532b6cff Encapsulate "an array of TemplateArgumentLocs and two angle bracket locations" into
a new class.  Use it pervasively throughout Sema.

My fingers hurt.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23 01:53:49 +00:00
John McCall 7453ed4cb2 Consider a FunctionTemplate to be an overload all on its lonesome. Track
this information through lookup rather than rederiving it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 00:44:51 +00:00
John McCall ba13543329 "Incremental" progress on using expressions, by which I mean totally ripping
into pretty much everything about overload resolution in order to wean
BuildDeclarationNameExpr off LookupResult::getAsSingleDecl().  Replace  
UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the
idea of a non-member lookup that we haven't totally resolved yet, whether by
overloading, argument-dependent lookup, or (eventually) the presence of   
a function template in the lookup results.  

Incidentally fixes a problem with argument-dependent lookup where we were 
still performing ADL even when the lookup results contained something from
a block scope.  

Incidentally improves a diagnostic when using an ObjC ivar from a class method.
This just fell out from rewriting BuildDeclarationNameExpr's interaction with
lookup, and I'm too apathetic to break it out.

The only remaining uses of OverloadedFunctionDecl that I know of are in
TemplateName and MemberExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 08:51:07 +00:00
Douglas Gregor 4ad9685b3e Objective-C code completion within properties after "setter = " or
"getter = ", to provide suitable method names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 07:41:15 +00:00
Douglas Gregor d3c6854153 Improve code completion for Objective-C message sends, so that we
provide completion results before each keyword argument, e.g.,

  [foo Method:arg WithArg1:arg1 WithArg2:arg2]

We now complete before "WithArg1" and before "WithArg2", in addition
to completing before "Method".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89290 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 01:08:35 +00:00
Douglas Gregor 988358f218 Improve the accuracy of code completion for the attributes of an @property declaration, so that we don't produce completions for attributes that would conflict with already-specified attributes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 00:14:45 +00:00
Douglas Gregor 54f016150a Improve code-completion results for the flags in an @property
declaration by providing patterns for "getter = <method>" and "setter
= <method>". As part of this, invented a new "pattern" result kind
that is merely a semantic string. The "pattern" result kind should
help with other kinds of code templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 00:01:57 +00:00
Douglas Gregor a93b108e02 Rename CodeCompleteObjCProperty to something more specific. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 23:08:07 +00:00
Douglas Gregor 424b2a546d Code completion after @dynamic
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 22:56:13 +00:00
Douglas Gregor 322328b8a6 Code completion for Objective-C @synthesized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 22:32:06 +00:00
Douglas Gregor 33ced0b855 Implement code completion for Objective-C category names in @interface
and @implementation declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 19:08:43 +00:00
Douglas Gregor 3b49aca913 Code completion for Objective-C class names after @interface,
@implementation, and in the declaration of the superclass of an
@interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 16:26:39 +00:00
Douglas Gregor 083128f6b1 Code completion after @property, providing the names of forward-declared properties
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 04:49:41 +00:00
Douglas Gregor 55385fe3e7 Code completion for Objective-C properly lists
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 04:19:12 +00:00
Douglas Gregor 95ac6556a5 Code completion for member accesses that involve Objective-C properties and instance variables
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 01:29:26 +00:00
Douglas Gregor f74a419b72 Finish code completion for Objective-C message sends
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 00:06:18 +00:00
Douglas Gregor 60b01cc448 Rename Objective-C message send completion functions to indicate that we're referring to message sends
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 23:31:36 +00:00
Douglas Gregor 36ecb04619 Refactor code-completion support for message sends, collecting the
code to find and add Objective-C methods (starting at an
ObjCContainerDecl) into a single, static function. Also, make sure
that we search into the implementations of classes and categories to
find even more methods.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 23:22:23 +00:00
Douglas Gregor 24a069f5eb Implement code completion for Objective-C message sends to "super".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 17:59:40 +00:00
Douglas Gregor 9630eb6e37 Augment code-completion results to provide argument names and
placeholder arguments for Objective-C message sends. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 16:44:22 +00:00
John McCall 9488ea120e Instead of hanging a using declaration's target decls directly off the using
decl, create shadow declarations and put them in scope like normal.
Work in progress.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:59:44 +00:00
Daniel Dunbar 3a2838d142 Rework Sema code completion interface.
- Provide Sema in callbacks, instead of requiring it in constructor. This
   eliminates the need for a factory function. Clients now just pass the object
   to consume the results in directly.

 - CodeCompleteConsumer is cheap to construct, so building it whenever we are
   doing code completion is reasonable.

Doug, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 08:58:20 +00:00
Douglas Gregor ff4393c1ce Make sure that we look into nested, transparent declaration contexts
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 21:35:27 +00:00
Steve Naroff c4df6d2c05 Add basic code completion support for ObjC messages.
Still a work in progress...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 02:08:14 +00:00
Douglas Gregor 0c8296dfb4 Various improvements to Clang's code-completion infrastructure:
- Introduce more code-completion string "chunk" kinds that describe
  symbols, the actual text that the user is expected to type, etc.
  - Make the generation of macro results optional, since it can be
  slow
  - Make code-completion accessible through the C API, marshalling the
  code-completion results through a temporary file (ick) to maintain
  process separation.

The last doesn't have tests yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:00:49 +00:00
Douglas Gregor 3f7c7f4865 Include macros in code-completion results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-30 16:50:04 +00:00
John McCall 833ca991c1 Track source information for template arguments and template specialization
types.  Preserve it through template instantiation.  Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 08:12:44 +00:00
Douglas Gregor a2813cec26 Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g., 

  namespace N { int i; }
  int j = N::i;

Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.

Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 18:54:35 +00:00
Daniel Dunbar e013d685c6 Move clients to use IdentifierInfo::getNameStart() instead of getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-18 20:26:12 +00:00
Douglas Gregor f52cedee87 Minor tweaks for code-completion:
- Filter out unnamed declarations
  - Filter out declarations whose names are reserved for the
  implementation (e.g., __bar, _Foo) 
  - Place OVERLOAD: or COMPLETION: at the beginning of each
  code-completion result, so we can easily separate them from other
  compilation results.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 22:16:47 +00:00
Steve Naroff 7f5111212f - Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS (compare was system dependent). Worked on Linux, failed on Mac OS (which caused the recently added testcase to fail on Linux).
- Sort results in testcase.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 23:45:10 +00:00
Steve Naroff ece8e71d12 Add code completion support for ObjC property declarations/attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 21:55:05 +00:00