aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaCodeComplete.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-06-15[Completion] Code complete the members for a dependent type after a '::'Alex Lorenz1-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
2017-06-07Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova1-0/+1
llvm-svn: 304872
2017-06-03Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova1-0/+2
llvm-svn: 304651
2017-05-11[CodeCompletion] Provide member completions for dependent expressions whoseAlex Lorenz1-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
2017-05-11[CodeCompletion] NFC, extract a function that generates memberAlex Lorenz1-30/+36
completion results for records llvm-svn: 302796
2017-05-09[CodeCompletion] Complete platform names in @available expressionsAlex Lorenz1-0/+17
rdar://32074504 llvm-svn: 302545
2017-03-28[libclang] Fix crash in member access code completion with implicit baseErik Verbruggen1-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
2017-03-13[CodeCompletion] Format block parameter placeholders in implicit propertyAlex Lorenz1-0/+9
setters using the block type information that's obtained from the property rdar://12604235 llvm-svn: 297628
2017-02-13[CodeCompletion] Code complete the '__auto_type' keywordAlex Lorenz1-2/+3
rdar://29219185 llvm-svn: 295003
2017-02-13[CodeCompletion] Code complete the missing C++11 keywordsAlex Lorenz1-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
2017-02-07P0091R3: Implement basic parsing support for C++17 deduction-guides.Richard Smith1-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
2017-01-24[CodeCompletion] Ensure that ObjC root class completes instanceAlex Lorenz1-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
2017-01-06[CodeCompletion] Block property setters: Use dynamic priority heuristicAlex Lorenz1-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
2017-01-03[CodeCompletion] Autocomplete NS_DESIGNATED_INITIALIZER in initializersAlex Lorenz1-0/+17
with arguments rdar://21014571 Differential Revision: https://reviews.llvm.org/D27039 llvm-svn: 290879
2016-12-08[CodeCompletion][ObjC] Use a parameterized NSSet return type forAlex Lorenz1-1/+1
keyPathsForValuesAffecting* KVO completion results rdar://23791701 llvm-svn: 289068
2016-12-08[CodeCompletion] Provide Objective-C class property completion resultsAlex Lorenz1-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
2016-11-23[CodeCompletion] Fix incorrect Objective-C block parameter formattingAlex Lorenz1-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
2016-11-09[CodeCompletion] Show block invocation results for block property settersAlex Lorenz1-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
2016-11-04[index] Expose FriendDeclOlivier Goffart1-0/+1
Differential Revision: https://reviews.llvm.org/D26285 llvm-svn: 285984
2016-11-04Remove no-op checks for a null CodeCompleter. We have alreadyChandler Carruth1-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
2016-10-18[CodeCompletion] Add a block property setter completion resultAlex Lorenz1-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
2016-10-18[CodeCompletion][NFC] Extract a function that formats block placeholders.Alex Lorenz1-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
2016-10-18[CodeCompletion][NFC] Extract a function that looks for block decl type locs.Alex Lorenz1-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
2016-10-12[CodeCompletion] Show protocol properties that are accessed through qualified idAlex Lorenz1-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
2016-07-01[CodeCompletion] Allow system headers providing private symbols with a ↵Argyrios Kyrtzidis1-13/+30
single underscore. rdar://24677150 llvm-svn: 274314
2016-06-24Use more ArrayRefsDavid Majnemer1-2/+2
No functional change is intended, just a small refactoring. llvm-svn: 273647
2016-06-09CIndex: add support for static_assertOlivier Goffart1-0/+1
Differential Revision: http://reviews.llvm.org/D18080 llvm-svn: 272273
2016-05-19Make Sema::getPrintingPolicy less ridiculously expensive. This used to performRichard Smith1-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
2016-05-13Prune four superfluous ExternalSemaSource.h includes and one forward ↵Yaron Keren1-1/+0
declaration in Sema.h where ExternalSemaSource.h was already included due to ExternalSemaSource:: member uses. llvm-svn: 269423
2016-05-11[MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko1-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
2016-05-06Revert r268727, it caused PR27666.Nico Weber1-3/+0
llvm-svn: 268736
2016-05-06[MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko1-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
2016-04-15Revert r266415, it broke parsing SDK headers (PR27367).Nico Weber1-3/+0
llvm-svn: 266431
2016-04-15[MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifierAndrey Bokhanko1-0/+3
This patch implements __unaligned as a type qualifier; before that, it was modeled as an attribute. Proper mangling of __unaligned is implemented as well. Some OpenCL code/tests are tangenially affected, as they relied on existing number and sizes of type qualifiers. Differential Revision: http://reviews.llvm.org/D18596 llvm-svn: 266415
2016-02-18[Parse] Code complete expressions in bracket declarators.Benjamin Kramer1-0/+4
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. llvm-svn: 261217
2016-01-28Class Property: class property and instance property can have the same name.Manman Ren1-3/+3
Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name of the property: ObjCPropertyDecl::findPropertyDecl, ObjCContainerDecl::FindPropertyDeclaration, ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass, ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl. ObjCPropertyQueryKind currently has 3 values: OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class This extra parameter specifies that we are looking for an instance property with the given name, or a class property with the given name, or any property with the given name (if both exist, the instance property will be returned). rdar://23891898 llvm-svn: 259070
2016-01-26Use instance_properties instead of properties. NFC.Manman Ren1-2/+2
All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258824
2015-12-29Model NamespaceAliasDecls as having their nominated namespace as an underlyingRichard Smith1-10/+7
declaration. This fixes an issue where we would reject (due to a claimed ambiguity) a case where lookup finds multiple NamespaceAliasDecls from different scopes that nominate the same namespace. The C++ standard doesn't make it clear that such a case is in fact valid (which I'm working on fixing), but there are no relevant rules that distinguish using declarations and namespace alias declarations here, so it makes sense to treat them the same way. llvm-svn: 256601
2015-12-24[Sema] ArrayRef-ize ParseObjCStringLiteral and ↵Craig Topper1-5/+5
CodeCompleteObjCProtocolReferences. NFC llvm-svn: 256397
2015-12-18Split RequireCompleteType into a function that actually requires that the typeRichard Smith1-2/+2
is complete (with an error produced if not) and a function that merely queries whether the type is complete. Either way we'll trigger instantiation if necessary, but only the former will diagnose and recover from missing module imports. The intent of this change is to prevent a class of bugs where code would call RequireCompleteType(..., 0) and then ignore the result. With modules, we must check the return value and use it to determine whether the definition of the type is visible. This also fixes a debug info quality issue: calls to isCompleteType do not trigger the emission of debug information for a type in limited-debug-info mode. This allows us to avoid emitting debug information for type definitions in more cases where we believe it is safe to do so. llvm-svn: 256049
2015-11-15[Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo ↵Craig Topper1-3/+3
on the AST context instead of Preprocessor. NFC llvm-svn: 253175
2015-11-15[libclang] Visit TypeAliasTemplateDeclSergey Kalinichev1-0/+1
This makes TypeAliasTemplateDecl accessible via LibClang and python bindings Differential Revision: http://reviews.llvm.org/D13844 llvm-svn: 253166
2015-10-22Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall1-1/+1
Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
2015-07-24[code-completion] Strip outer nullability annotations when completing method ↵Argyrios Kyrtzidis1-3/+6
implementations. The outer nullability is transferred from the declaration to the implementation so including them is redundant. The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well adding them in the implementation will become redundant and we should strip those as well. rdar://21737451 llvm-svn: 243119
2015-07-09[CodeCompletion] Don't crash on member inits of templated constructors.Benjamin Kramer1-3/+7
Also fixes a crash (on invalid) member functions with a colon initializer. PR23948. llvm-svn: 241811
2015-07-07[libclang] Replace ObjC generic parameters when code-completing method ↵Douglas Gregor1-1/+4
implementations. rdar://20643768 llvm-svn: 241559
2015-07-07[libclang] Fix code-completion of block parameters that are marked with ↵Douglas Gregor1-0/+5
nullability specifier. rdar://20755276 llvm-svn: 241558
2015-07-07[libclang] Replace ObjC generic parameters in code-completion results.Douglas Gregor1-38/+75
rdar://19369529 llvm-svn: 241557
2015-07-07Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor1-1/+3
Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
2015-06-24Replace __double_underscored type nullability qualifiers with ↵Douglas Gregor1-3/+3
_Uppercase_underscored Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596