Commit Graph

14 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 0516803ca5 [code-completion] Fix crash when trying to do postfix completion of instance member inside a static function.
llvm-svn: 292052
2017-01-15 06:11:04 +00:00
Douglas Gregor 52ce62f069 Improve the sorting of code-completion results. We now always sort by
the "typed" text, first, then take into account
nested-name-specifiers, name hiding, etc. This means that the
resulting sort is actually alphabetical :)

llvm-svn: 93370
2010-01-13 23:24:38 +00:00
Douglas Gregor b3fa919c2d Extend code-completion results with the type of each result
llvm-svn: 91702
2009-12-18 18:53:37 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Douglas Gregor 0f622367d3 Add a function's cv-qualifiers to the code-completion results as an
informative chunk.

llvm-svn: 91139
2009-12-11 18:44:16 +00:00
Douglas Gregor 99fe2ad8c8 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.

llvm-svn: 91133
2009-12-11 17:31:05 +00:00
Daniel Dunbar 34546ce43d Remove RUN: true lines.
llvm-svn: 86432
2009-11-08 01:47:25 +00:00
Daniel Dunbar 8b57697954 Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Douglas Gregor e6688e653f Determinism is for wimps. <Wimper>
llvm-svn: 82962
2009-09-28 03:51:44 +00:00
Douglas Gregor e412a5a8f7 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.

llvm-svn: 82663
2009-09-23 22:26:46 +00:00
Douglas Gregor 5bf52697b0 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.
 

llvm-svn: 82586
2009-09-22 23:15:58 +00:00
Douglas Gregor ea9b03e6e2 Replace the -code-completion-dump option with
-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.

llvm-svn: 82571
2009-09-22 21:11:38 +00:00
Douglas Gregor 2af2f670d1 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).

llvm-svn: 82476
2009-09-21 20:12:40 +00:00
Douglas Gregor 2436e7116b 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".

llvm-svn: 82166
2009-09-17 21:32:03 +00:00