summaryrefslogtreecommitdiffstats
path: root/test/CodeCompletion
Commit message (Collapse)AuthorAgeFilesLines
* Merging r308722:Hans Wennborg2017-08-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r308722 | ibiryukov | 2017-07-21 02:24:00 -0700 (Fri, 21 Jul 2017) | 13 lines Fixed failing assert in code completion. Summary: The code was accessing uninstantiated default argument. This resulted in failing assertion at ParmVarDecl::getDefaultArg(). Reviewers: erikjv, klimek, bkramer, krasimir Reviewed By: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D35682 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@310395 91177308-0d34-0410-b5e6-96231b3b80d8
* Add default values for function parameter chunksErik Verbruggen2017-07-191-1/+1
| | | | | | | | | | | | | Append optional chunks with their default values. For example: before - "int i", after - "int i = 10" Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D33644 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308433 91177308-0d34-0410-b5e6-96231b3b80d8
* [Completion] Code complete the members for a dependent type after a '::'Alex Lorenz2017-06-151-0/+18
| | | | | | | | | | | This commit is a follow up to r302797 which added support for dependent completions after the '.' and '->' operators. This commit adds support for dependent completions after the '::' operator. Differential Revision: https://reviews.llvm.org/D34173 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305511 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeCompletion] Provide member completions for dependent expressions whoseAlex Lorenz2017-05-111-0/+80
| | | | | | | | | | | | | | | type is a TemplateSpecializationType or InjectedClassNameType Fixes PR30847. Partially fixes PR20973 (first position only). PR17614 is still not working, its expression has the dependent builtin type. We'll have to teach the completion engine how to "resolve" dependent expressions to fix it. rdar://29818301 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302797 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Fix crash in member access code completion with implicit baseErik Verbruggen2017-03-281-0/+14
| | | | | | | | | | | | If there is an unresolved member access AST node, and the base is implicit, do not access/use it for generating candidate overloads for code completion results. Fixes PR31093. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298903 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Fix incorrect token caching that occurs when lexing _PragmaAlex Lorenz2017-02-241-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in macro argument pre-expansion mode when skipping a function body This commit fixes a token caching problem that currently occurs when clang is skipping a function body (e.g. when looking for a code completion token) and at the same time caching the tokens for _Pragma when lexing it in macro argument pre-expansion mode. When _Pragma is being lexed in macro argument pre-expansion mode, it caches the tokens so that it can avoid interpreting the pragma immediately (as the macro argument may not be used in the macro body), and then either backtracks over or commits these tokens. The problem is that, when we're backtracking/committing in such a scenario, there's already a previous backtracking position stored in BacktrackPositions (as we're skipping the function body), and this leads to a situation where the cached tokens from the pragma (like '(' 'string_literal' and ')') will remain in the cached tokens array incorrectly even after they're consumed (in the case of backtracking) or just ignored (in the case when they're committed). Furthermore, what makes it even worse, is that because of a previous backtracking position, the logic that deals with when should we call ExitCachingLexMode in CachingLex no longer works for us in this situation, and more tokens in the macro argument get cached, to the point where the EOF token that corresponds to the macro argument EOF is cached. This problem leads to all sorts of issues in code completion mode, where incorrect errors get presented and code completion completely fails to produce completion results. rdar://28523863 Differential Revision: https://reviews.llvm.org/D28772 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296140 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeCompletion] Code complete the '__auto_type' keywordAlex Lorenz2017-02-131-0/+5
| | | | | | | rdar://29219185 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295003 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeCompletion] Code complete the missing C++11 keywordsAlex Lorenz2017-02-132-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | This commit adds context sensitive code completion support for the C++11 keywords that currently don't have completion results. The following keywords are supported by this patch: alignas constexpr static_assert noexcept (as a function/method qualifier) thread_local The following special identifiers are also supported: final (as a method qualifier or class qualifier) override rdar://29219185 Differential Revision: https://reviews.llvm.org/D28286 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295001 91177308-0d34-0410-b5e6-96231b3b80d8
* [code-completion] Fix crash when trying to do postfix completion of instance ↵Argyrios Kyrtzidis2017-01-151-1/+13
| | | | | | member inside a static function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292052 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix heuristics skipping invalid ctor-initializers with C++11Olivier Goffart2016-11-031-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Use better heuristics to detect if a '{' might be the start of the constructor body or not. Especially when there is a completion token. Fix the test 'test/CodeCompletion/ctor-initializer.cpp ' when clang defaults to c++11 The problem was is how we recover invalid code in the ctor-init part as we skip the function body. In particular, we want to know if a '{' is the begining of the body. In C++03, we always consider it as the beginng of the body. The problem was that in C++11, it may be the start of an initializer, so we skip over it, causing further parse errors later. (It is important that we are able to parse correctly the rest of the class definition, to know what are the class member, for example) This commit is improving the heuristics to decide if the '{' is starting a function body. The rules are the following: If we are not in a template argument, and that the previous tokens are not an identifier, or a >, then it is much more likely to be the function body. We verify that further by checking the token after the matching '}' The commit also fix the behavior when there is a code_completion token in the ctor-initializers. Differential Revision: https://reviews.llvm.org/D21502 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285883 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeCompletion] Show protocol properties that are accessed through qualified idAlex Lorenz2016-10-121-0/+24
| | | | | | | | | | | | | This commit improves code completion for properties that are declared in Objective-C protocols by making sure that properties show up in completions when they are accessed through a qualified id. rdar://24426041 Differential Revision: https://reviews.llvm.org/D25436 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284007 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement filtering for code completion of identifiers.Vassil Vassilev2016-07-271-2/+2
| | | | | | | | | Patch by Cristina Cristescu and Axel Naumann! Agreed on post commit review (D17820). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276878 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeCompletion] Allow system headers providing private symbols with a ↵Argyrios Kyrtzidis2016-07-012-2/+5
| | | | | | | | single underscore. rdar://24677150 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274314 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a few issues while skipping function bodiesOlivier Goffart2016-06-161-0/+41
| | | | | | | | | | | | | | | | | | | | - In functions with try { } catch { }, only the try block would be skipped, not the catch blocks - The template functions would still be parsed. - The initializers within a constructor would still be parsed. - The inline functions within class would still be stored, only to be discared later. - Invalid code with try would assert (as in "int foo() try assert_here") This attempt to do even less while skipping function bodies. Differential Revision: http://reviews.llvm.org/D20821 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272963 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix CodeCompletion & TypoCorrection when combining a PCH with ModulesBen Langmuir2016-05-044-0/+44
| | | | | | | | | | | | | | This commit fixes the IdentifierIterator to actually include identifiers from a PCH or precompiled preamble when there is also a global module index. This was causing code-completion (outside of C++) and typo-correction to be missing global identifiers defined in the PCH/preamble. Typo-correction has been broken since we first started using the module index, whereas code-completion only started relying on identifier iterator in r232793. rdar://problem/25642879 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268471 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix ObjCMethodDecl::findPropertyDecl for class properties.Jordan Rose2016-03-111-0/+25
| | | | | | | This affects code completion and a few other things; hopefully the code completion test is sufficient to catch regressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263295 91177308-0d34-0410-b5e6-96231b3b80d8
* [Parse] Code complete expressions in bracket declarators.Benjamin Kramer2016-02-181-0/+9
| | | | | | | | | | Currently we return no results when completing inside of the brackets in a 'char foo[]' declaration. Let the generic expression completion code handle it instead. We could get fancier here (e.g. filter non-constant expressions in contexts where VLAs are not allowed), but it's a strict improvement over the existing version. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261217 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tests] Modified Lit Tests to be C++11 compatibileCharles Li2015-08-272-5/+257
| | | | | | | | | This 2nd patch should not change the test results, but it is useful if clang's default C++ language is ever changed from gnu++98. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246183 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix code completion tests to use an explicit modules cache pathReid Kleckner2015-07-202-2/+2
| | | | | | | | Otherwise the stale module cache data may cause the test to fail. These two tests are new and are the only instances of c-index-test with -fmodules that doesn't have an explicit module cache path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242710 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Iterating over all macros should include those from modules.Jordan Rose2015-06-242-0/+21
| | | | | | | | | | | | So, iterate over the list of macros mentioned in modules, and make sure those are in the master table. This isn't particularly efficient, but hopefully it's something that isn't done too often. PR23929 and rdar://problem/21480635 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240571 91177308-0d34-0410-b5e6-96231b3b80d8
* When completing Objective-C instance method invocations, perform a ↵Anders Carlsson2014-02-281-0/+46
| | | | | | contextual conversion to an Objective-C pointer type of the target expression if needed. This fixes code completion of method invocations where the target is a smart pointer that has an explicit conversion operator to an Objective-C type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202529 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix FileCheck --check-prefix lines.Tim Northover2013-08-1219-26/+26
| | | | | | | | | | Various tests had sprung up over the years which had --check-prefix=ABC on the RUN line, but "CHECK-ABC:" later on. This happened to work before, but was strictly incorrect. FileCheck is getting stricter soon though. Patch by Ron Ofir. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188174 91177308-0d34-0410-b5e6-96231b3b80d8
* PR14381: Never skip constexpr function bodies when code-completing. We may needRichard Smith2012-11-191-0/+13
| | | | | | | them in order to parse the rest of the file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168327 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Remove the ParentKind cursor kind from code-completion results.Argyrios Kyrtzidis2012-09-261-1/+1
| | | | | | This is to reduce dependency to cursors for the code-completion results. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164705 91177308-0d34-0410-b5e6-96231b3b80d8
* Macro history (de-)serialization. Deserialization currently reads only the ↵Alexander Kornienko2012-09-252-0/+19
| | | | | | | | | | | | | | | | latest macro definition. Needs more work. Summary: Passes all tests (+ the new one with code completion), but needs a thorough review in part related to modules. Reviewers: doug.gregor Reviewed By: alexfh CC: cfe-commits, rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D41 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164610 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the spacing of the code completion result for NSDictionaryDouglas Gregor2012-08-171-1/+1
| | | | | | | | literals match the spacing introduced by the ObjC modernizer. Fixes the rest of <rdar://problem/11889572>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162084 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assertion failure when code completing an auto variable's initialiser.Peter Collingbourne2012-07-271-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160857 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unnecessary spacing around Objective-C object literal codeDouglas Gregor2012-07-171-3/+3
| | | | | | | completions. Fixes <rdar://problem/11889572>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160407 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko2012-07-021-0/+33
| | | | | | | | | | | | | | | | | | attached to a declaration in the completion string. Since extracting comments isn't free, a new code completion option is introduced. A new code completion option that enables including brief comments into CodeCompletionString should be a, err, code completion option. But because ASTUnit caches global declarations during parsing before even completion consumer is created, the option is duplicated as a translation unit option (in both libclang and ASTUnit, like the option to cache code completion results). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159539 91177308-0d34-0410-b5e6-96231b3b80d8
* [completion] Add completions for @"..." and @(...), and tidy up @[] and @{}.Jordan Rose2012-06-151-0/+17
| | | | | | | | | | | | | Specifically, @[] and @{} didn't have a type associated with them; we now use "NSArray *" and "NSDictionary *", respectively. @"" has the type "NSString *". @(), unfortunately, has type "id", since it (currently) may be either an NSNumber or an NSString. Add a test for all the Objective-C at-expression completions. <rdar://problem/11507708&11507668&11507711> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158533 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'env' in hopes of making this test pass on Windows.Nick Lewycky2012-04-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154785 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the all_lookups_iterator for PCH as a follow-up to r153970. ThisNick Lewycky2012-04-162-0/+8
| | | | | | | | | | | | includes a patch from Matthias Kleine with a regression testcase! Adds a new iterator 'data_iterator' to OnDiskHashTable which doesn't try to reconstruct the external_key from the internal_key, which is useful for traits that don't store enough information to do that mapping in their key. Also deletes the 'item_iterator' from OnDiskHashTable as dead code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154784 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide result types for code completions that describe built-inDouglas Gregor2011-10-182-20/+20
| | | | | | | expressions (this, sizeof, etc.). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142424 91177308-0d34-0410-b5e6-96231b3b80d8
* Support code-completion for C++ inline methods and ObjC buffering methods.Argyrios Kyrtzidis2011-09-041-7/+4
| | | | | | | | | | | | | | Previously we would cut off the source file buffer at the code-completion point; this impeded code-completion inside C++ inline methods and, recently, with buffering ObjC methods. Have the code-completion inserted into the source buffer so that it can be buffered along with a method body. When we actually hit the code-completion point the cut-off lexing or parsing. Fixes rdar://10056932&8319466 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139086 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.Argyrios Kyrtzidis2011-04-231-0/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130042 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't suggest dynamic_cast or typeid as code completion results whenDouglas Gregor2011-04-121-2/+56
| | | | | | | | | RTTI is disabled. Similarly, don't suggest throw or try as code completion results when C++ exceptions are disabled. Fixes <rdar://problem/9193560>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129346 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when code-completing after "#include <". It would be farDouglas Gregor2010-12-091-0/+3
| | | | | | | | better to actually produce a decent set of completions by checking the system include paths, but not today. Fixes PR8744. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121431 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the fix for PR8013.Douglas Gregor2010-11-091-4/+2
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118620 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle overload resolution when calling an overloaded function setDouglas Gregor2010-11-091-2/+4
| | | | | | | with, e.g., (&f)(a, b, c). Fixes PR8013. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118508 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for code completion on stdin.Dan Gohman2010-10-261-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117414 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the mapping of vertical-space cursor kinds to produce a newline,Douglas Gregor2010-10-081-1/+1
| | | | | | | rather than a space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116097 91177308-0d34-0410-b5e6-96231b3b80d8
* When provide code completions for a variadic Objective-C methodDouglas Gregor2010-08-311-1/+1
| | | | | | | | | declaration send or a variadic function call, collapse the ", ..." into the parameter before it, so that we don't get a second placeholder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112579 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing code completion for a case statement in a switch whoseDouglas Gregor2010-07-281-2/+19
| | | | | | | | condition is not of enumeration type, provide code-completion results containing all values of integral or enumeral type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109677 91177308-0d34-0410-b5e6-96231b3b80d8
* Only filter out names reserved for the implementation (e.g., __blah orDouglas Gregor2010-07-142-4/+10
| | | | | | | | _Foo) from code-completion results when they come from a system header. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108338 91177308-0d34-0410-b5e6-96231b3b80d8
* Make -code-completion-patterns only cover multi-line codeDouglas Gregor2010-05-282-30/+34
| | | | | | | | completions. Plus, tweak a few completion patterns to better reflect the language grammar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104905 91177308-0d34-0410-b5e6-96231b3b80d8
* Only enable code patterns (e.g., try { statements } catch (...) {Douglas Gregor2010-05-253-6/+6
| | | | | | | statements }) in the code-completion results if explicitly requested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104637 91177308-0d34-0410-b5e6-96231b3b80d8
* when code completing inside a C-style block comment, don't emit errors aboutChris Lattner2010-05-161-0/+7
| | | | | | | | | a missing */ since we truncated the file. This fixes rdar://7948776 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103913 91177308-0d34-0410-b5e6-96231b3b80d8
* When code completion produces an overload set as its results (e.g.,Douglas Gregor2010-04-061-0/+1
| | | | | | | | | while we're completing in the middle of a function call), also produce "ordinary" name results that show what can be typed at that point. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100558 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not produce semicolons at the end of code-completion resultsDouglas Gregor2010-04-061-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100557 91177308-0d34-0410-b5e6-96231b3b80d8
* Only prove macros as code-completion results when we're in a caseDouglas Gregor2010-04-061-4/+0
| | | | | | | | | statement or for ordinary names. This means that we won't show macros when completing, e.g., member expressions such as "p->". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100555 91177308-0d34-0410-b5e6-96231b3b80d8