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

69 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 6a6840326e Determinism is for wimps. <Wimper>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 03:51:44 +00:00
Douglas Gregor eb5758bbfd For code completion, note that injected-class-names found as part of
lookup in a member access expression always start a
nested-name-specifier. Additionally, rank names that start
nested-name-specifiers after other names.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 22:26:46 +00:00
Douglas Gregor 86d802e03a Print the results of code-completion for overloading by displaying the
signature of the function with the current parameter highlighted as a
placeholder.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82593 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:34:09 +00:00
Douglas Gregor 0594438e06 Separate the code-completion results for call completion from the
results for other, textual completion. For call completion, we now
produce enough information to show the function call argument that we
are currently on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:16:58 +00:00
Douglas Gregor 8e0a0e4e45 Make sure we don't try to add code-completion results without an
active shadow map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:31:26 +00:00
Douglas Gregor 3e7253f155 When code-completion finds a declaration only because it is usable as
the start of a nested-name-specifier, add the "::" after the
nested-name-specifier to the code-completion string.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:22:24 +00:00
Douglas Gregor 0563c2677c Tweak the code-completion results ranking and formation, so that
members found in base classes have the same ranking as members found
in derived classes. However, we will introduce an informative note for
members found in base classes, showing (as a nested-name-specifier)
the qualification to name the base class, to make it clear which
members are from bases.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:15:58 +00:00
Douglas Gregor b3d4525c65 Teach code-completion to introduce a ", ..." placeholder for variadic functions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:42:17 +00:00
Anders Carlsson 90756300f3 (With Doug's help) fix a crash in the code completion code that lead to a test failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 17:29:51 +00:00
Douglas Gregor 9c6a0e92db Implement code completion within a function call, triggered after the
opening parentheses and after each comma. We gather the set of visible
overloaded functions, perform "partial" overloading based on the set
of arguments that we have thus far, and return the still-viable
results sorted by the likelihood that they will be the best candidate.

Most of the changes in this patch are a refactoring of the overloading
routines for a function call, since we needed to separate out the
notion of building an overload set (common to code-completion and
normal semantic analysis) and then what to do with that overload
set. As part of this change, I've pushed explicit template arguments
into a few more subroutines.

There is still much more work to do in this area. Function templates
won't be handled well (unless we happen to deduce all of the template
arguments before we hit the completion point), nor will overloaded
function-call operators or calls to member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 15:41:20 +00:00
Douglas Gregor 791215b7a2 Code completion for ordinary names when we're starting a declaration, expression, or statement
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 20:51:25 +00:00
Douglas Gregor 456c4a17f4 When providing a code-completion suggestion for a hidden name, include
a nested-name-specifier that describes how to refer to that name. For
example, given:

  struct Base { int member; };
  struct Derived : Base { int member; };

the code-completion result for a member access into "Derived" will
provide both "member" to refer to Derived::member (no qualification needed) and
"Base::member" to refer to Base::member (qualification included).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 20:12:40 +00:00
Douglas Gregor b9d0ef7634 Enhance "case" code completion in C++ to suggest qualified names for
enumerators when either the user intentionally wrote a qualified name
(in which case we just use that nested-name-specifier to match
the user's code) or when this is the first "case" statement and we
need a qualified name to refer to an enumerator in a different scope.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 19:57:38 +00:00
Douglas Gregor 3e1005f085 Code completion for "case" statements within a switch on an expression
of enumeration type, providing the various unused enumerators as options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 18:10:23 +00:00
Douglas Gregor 86d9a52c24 Refactor and simplify the CodeCompleteConsumer, so that all of the
real work is performed within Sema. Addresses Chris's comments, but
still retains the heavyweight list-of-multimaps data structure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 16:56:56 +00:00
Douglas Gregor ed8d322b40 C++ code completion after the "operator" keyword. Provide overloaded
operators, type specifiers, type names, and nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:05:18 +00:00
Douglas Gregor 49f40bd0c9 Introduce four new code-completion hooks for C++:
- after "using", show anything that can be a nested-name-specifier.
  - after "using namespace", show any visible namespaces or namespace aliases
  - after "namespace", show any namespace definitions in the current scope
  - after "namespace identifier = ", show any visible namespaces or
    namespace aliases



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:03:04 +00:00
Douglas Gregor 374929f7e8 Implement code completion for tags, e.g., code completion after "enum"
will provide the names of various enumerations currently
visible. Introduced filtering of code-completion results when we build
the result set, so that we can identify just the kinds of declarations
we want.

This implementation is incomplete for C++, since we don't consider
that the token after the tag keyword could start a
nested-name-specifier. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 15:37:17 +00:00
Douglas Gregor 81b747b7fc Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 21:32:03 +00:00