summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Sema] Ignore decls in namespaces when global decls are not wanted.Eric Liu2017-12-131-4/+7
| | | | | | | | | | | | | | Summary: ... in qualified code completion and decl lookup. Reviewers: ilya-biryukov, arphaman Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40562 llvm-svn: 320563
* [SemaCodeComplete] Allow passing out scope specifiers in qualified-id ↵Eric Liu2017-12-121-7/+19
| | | | | | | | | | | | | | completions via completion context. Reviewers: ilya-biryukov, arphaman Reviewed By: arphaman Subscribers: nik, cfe-commits Differential Revision: https://reviews.llvm.org/D40563 llvm-svn: 320471
* [completion] complete ObjC interface names in an expressionAlex Lorenz2017-11-141-2/+9
| | | | | | | | Objective-C interfaces can be used in a class property expression. rdar://26982192 llvm-svn: 318129
* Avoid printing some redundant name qualifiers in completionIlya Biryukov2017-11-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adjusted PrintingPolicy inside code completion to avoid printing some redundant name qualifiers. Before this change, typedefs that were written unqualified in source code were printed with qualifiers in completion. For example, in the following code struct foo { typedef int type; type method(); }; completion item for `method` had return type of `foo::type`, even though the original code used `type` without qualifiers. After this change, the completion item has return type `type`, as originally written in the source code. Note that this change does not suppress qualifiers written by the user. For example, in the following code typedef int type; struct foo { typedef int type; ::type method(foo::type); }; completion item for `method` has return type of `::type` and parameter type of `foo::type`, as originally written in the source code. Reviewers: arphaman, bkramer, klimek Reviewed By: arphaman Subscribers: mgorny, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D38538 llvm-svn: 317677
* Test commitIvan Donchevskii2017-10-271-1/+1
| | | | llvm-svn: 316758
* Fix overloaded static functions in SemaCodeCompleteBenjamin Kramer2017-10-261-1/+3
| | | | | | | | | | | | | | | | | | | | | https://bugs.llvm.org/show_bug.cgi?id=33904 Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument. struct Bar { static void foo(); static void foo(int); }; int main() { Bar b; b.foo(/*complete here*/); // did not work before Bar::foo(/*complete here*/); // worked fine } Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D36390 llvm-svn: 316646
* [code completion] Complete ObjC methods in @implementation without leadingAlex Lorenz2017-10-241-10/+17
| | | | | | | | '-'/'+' prefix rdar://12040840 llvm-svn: 316458
* Do not add a colon chunk to the code completion of class inheritance access ↵Erik Verbruggen2017-10-241-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | modifiers With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables IncludeCodePatterns in completion options) code completion after colon currently suggests access modifiers with 2 completion chunks which is incorrect. Example: class A : <Cursor>B { } Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)' but the correct line is just 'NotImplemented:{TypedText public} (40)' The fix introduces more specific scope that occurs between ':' and '{' It allows us to determine when we don't need to add ':' as a second chunk to the public/protected/private access modifiers. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D38618 llvm-svn: 316436
* Resolve a defect in C++17 copy omission.Richard Smith2017-09-261-1/+2
| | | | | | | | | | | | When selecting constructors for initializing an object of type T from a single expression of class type U, also consider conversion functions of U that convert to T (rather than modeling such conversions as calling a conversion function and then calling a constructor). This approach is proposed as the resolution for the defect, and is also already implemented by GCC. llvm-svn: 314231
* Set completion priority of destructors and operators to CCP_Unlikely.Ilya Biryukov2017-09-221-2/+13
| | | | | | | | | | | | | | | | | | | Summary: It will move destructors and operators to the end of completion list. Destructors and operators are currently very high on the completion list, as they have the same priority as member functions. However, they are clearly not something users usually choose in completion lists. Reviewers: arphaman, erikjv, bkramer, krasimir Reviewed By: arphaman Subscribers: eraman, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D38081 llvm-svn: 314019
* Don't show deleted function (constructor) candidates for code completionErik Verbruggen2017-09-081-1/+4
| | | | | | | | | | | In case of copy constructor is implicitly deleted it's still shown. PR34402 describes a way to reproduce that. Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D37435 llvm-svn: 312785
* Fixed failing assert in code completion.Ilya Biryukov2017-07-211-4/+1
| | | | | | | | | | | | | | | | 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 llvm-svn: 308722
* Fix compilation problem introduced in r308433Erik Verbruggen2017-07-191-1/+1
| | | | llvm-svn: 308438
* Add default values for function parameter chunksErik Verbruggen2017-07-191-3/+40
| | | | | | | | | | | 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 llvm-svn: 308433
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter. Hopefully the bots will stay appeased. Thanks! llvm-svn: 308190
* Revert changes from my previous refactoring - will need to fix dependencies ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | in clang's extra tooling (such as clang-tidy etc.). Sorry about that. llvm-svn: 308158
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-3/+3
| | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. Thanks! llvm-svn: 308157
* [Completion] Code complete the members for a dependent type after a '::'Alex Lorenz2017-06-151-3/+7
| | | | | | | | | | 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 llvm-svn: 305511
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-071-0/+1
| | | | llvm-svn: 304872
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+2
| | | | llvm-svn: 304651
* [CodeCompletion] Provide member completions for dependent expressions whoseAlex Lorenz2017-05-111-1/+12
| | | | | | | | | | | | | | 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 llvm-svn: 302797
* [CodeCompletion] NFC, extract a function that generates memberAlex Lorenz2017-05-111-30/+36
| | | | | | completion results for records llvm-svn: 302796
* [CodeCompletion] Complete platform names in @available expressionsAlex Lorenz2017-05-091-0/+17
| | | | | | rdar://32074504 llvm-svn: 302545
* [libclang] Fix crash in member access code completion with implicit baseErik Verbruggen2017-03-281-1/+4
| | | | | | | | | | 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. llvm-svn: 298903
* [CodeCompletion] Format block parameter placeholders in implicit propertyAlex Lorenz2017-03-131-0/+9
| | | | | | | | setters using the block type information that's obtained from the property rdar://12604235 llvm-svn: 297628
* [CodeCompletion] Code complete the '__auto_type' keywordAlex Lorenz2017-02-131-2/+3
| | | | | | rdar://29219185 llvm-svn: 295003
* [CodeCompletion] Code complete the missing C++11 keywordsAlex Lorenz2017-02-131-11/+74
| | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 295001
* P0091R3: Implement basic parsing support for C++17 deduction-guides.Richard Smith2017-02-071-0/+1
| | | | | | | | | | | We model deduction-guides as functions with a new kind of name that identifies the template whose deduction they guide; the bulk of this patch is adding the new name kind. This gives us a clean way to attach an extensible list of guides to a class template in a way that doesn't require any special handling in AST files etc (and we're going to need these functions we come to performing deduction). llvm-svn: 294266
* [CodeCompletion] Ensure that ObjC root class completes instanceAlex Lorenz2017-01-241-30/+28
| | | | | | | | | | | | | | | methods from protocols and categories as well Code completion results for class methods already include instance methods from Objective-C root classes. This commit ensures that the results also include instance methods from protocols that the root class implements and root class categories as well. rdar://28012953 Differential Revision: https://reviews.llvm.org/D27257 llvm-svn: 292932
* [CodeCompletion] Block property setters: Use dynamic priority heuristicAlex Lorenz2017-01-061-1/+9
| | | | | | | | | | | | | | Now when completing blocks properties that return void the block call completion result shows up before the setter, otherwise the setter completion shows up before the block call completion. We normally want to use the result of the block call, so one typically wouldn't call a block that returns a non-void type in a standalone statement. rdar://28846153 Differential Revision: https://reviews.llvm.org/D26034 llvm-svn: 291232
* [CodeCompletion] Autocomplete NS_DESIGNATED_INITIALIZER in initializersAlex Lorenz2017-01-031-0/+17
| | | | | | | | | | with arguments rdar://21014571 Differential Revision: https://reviews.llvm.org/D27039 llvm-svn: 290879
* [CodeCompletion][ObjC] Use a parameterized NSSet return type forAlex Lorenz2016-12-081-1/+1
| | | | | | | | keyPathsForValuesAffecting* KVO completion results rdar://23791701 llvm-svn: 289068
* [CodeCompletion] Provide Objective-C class property completion resultsAlex Lorenz2016-12-081-33/+80
| | | | | | | | | | | | This commit provides class property code completion results. It supports explicit and implicit class properties, but the special block completion is done only for explicit properties right now. rdar://25636195 Differential Revision: https://reviews.llvm.org/D27053 llvm-svn: 289058
* [CodeCompletion] Fix incorrect Objective-C block parameter formattingAlex Lorenz2016-11-231-4/+8
| | | | | | | | | | This commit fixes an incorrectly formatted Objective-C block parameter placeholder in a code completion result. The incorrect parameter had a redundant leading parenthesis. rdar://25224416 llvm-svn: 287771
* [CodeCompletion] Show block invocation results for block property settersAlex Lorenz2016-11-091-34/+91
| | | | | | | | | | | | This commit changes the code completion results for block property setters: The default block property result is now a block invocation rather than a simple property reference. rdar://28846196 Differential Revision: https://reviews.llvm.org/D26071 llvm-svn: 286363
* [index] Expose FriendDeclOlivier Goffart2016-11-041-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D26285 llvm-svn: 285984
* Remove no-op checks for a null CodeCompleter. We have alreadyChandler Carruth2016-11-041-2/+2
| | | | | | | | | | | | dereferenced the pointer at this point, and these routines are exclusively called after the parser encounters a code completion token. Other code completion routines called at that point do not check for null either, so this is clearly the current invariant expected in the code. This fixes another PVS-Studio found issue. llvm-svn: 285980
* [CodeCompletion] Add a block property setter completion resultAlex Lorenz2016-10-181-22/+67
| | | | | | | | | | | | | | | | | | This commit changes code completion results for Objective-C block properties: clang now suggests an additional completion result that displays the block property together with '=' and the block literal placeholder for the appropriate readwrite block properties. This commit uses a simple heuristic to determine when it's appropriate to suggest a setter completion for block properties: the additional block setter completion is provided iff the member access that's being completed is a standalone statement. rdar://28481726 Differential Revision: https://reviews.llvm.org/D25520 llvm-svn: 284472
* [CodeCompletion][NFC] Extract a function that formats block placeholders.Alex Lorenz2016-10-181-12/+35
| | | | | | | | | | This commit extracts a new function named `formatBlockPlaceholder` from the function `FormatFunctionParameter` so that it can be reused in follow-up commits that improve code completion for block property setters. Differential Revision: https://reviews.llvm.org/D25519 llvm-svn: 284468
* [CodeCompletion][NFC] Extract a function that looks for block decl type locs.Alex Lorenz2016-10-181-37/+50
| | | | | | | | | | This commit extracts a new function named `findTypeLocationForBlockDecl` from the function `FormatFunctionParameter` so that it can be reused in follow-up commits that improve code completion for block property setters. Differential Revision: https://reviews.llvm.org/D25519 llvm-svn: 284467
* [CodeCompletion] Show protocol properties that are accessed through qualified idAlex Lorenz2016-10-121-11/+12
| | | | | | | | | | | | 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 llvm-svn: 284007
* [CodeCompletion] Allow system headers providing private symbols with a ↵Argyrios Kyrtzidis2016-07-011-13/+30
| | | | | | | | single underscore. rdar://24677150 llvm-svn: 274314
* Use more ArrayRefsDavid Majnemer2016-06-241-2/+2
| | | | | | No functional change is intended, just a small refactoring. llvm-svn: 273647
* CIndex: add support for static_assertOlivier Goffart2016-06-091-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D18080 llvm-svn: 272273
* Make Sema::getPrintingPolicy less ridiculously expensive. This used to performRichard Smith2016-05-191-1/+0
| | | | | | | | | | an identifier table lookup, *and* copy the LangOptions (including various std::vector<std::string>s). Twice. We call this function once each time we start parsing a declaration specifier sequence, and once for each call to Sema::Diag. This reduces the compile time for a sample .c file from the linux kernel by 20%. llvm-svn: 270009
* Prune four superfluous ExternalSemaSource.h includes and one forward ↵Yaron Keren2016-05-131-1/+0
| | | | | | | | declaration in Sema.h where ExternalSemaSource.h was already included due to ExternalSemaSource:: member uses. llvm-svn: 269423
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-111-0/+3
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367 and PR27666. Differential Revision: http://reviews.llvm.org/D20103 llvm-svn: 269220
* Revert r268727, it caused PR27666.Nico Weber2016-05-061-3/+0
| | | | llvm-svn: 268736
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-061-0/+3
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367. Differential Revision: http://reviews.llvm.org/D19654 llvm-svn: 268727
* Revert r266415, it broke parsing SDK headers (PR27367).Nico Weber2016-04-151-3/+0
| | | | llvm-svn: 266431
OpenPOWER on IntegriCloud