diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-12-19 18:01:24 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-12-19 18:01:24 +0000 |
commit | b45d851bdd40863ff5e37eec07be93942c6e8daf (patch) | |
tree | 59a288872bdfe8344b18df466f3b5f62e18005dc /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 79f2b15eabe16880b03c92e68d16070c2e15943b (diff) | |
download | bcm5719-llvm-b45d851bdd40863ff5e37eec07be93942c6e8daf.tar.gz bcm5719-llvm-b45d851bdd40863ff5e37eec07be93942c6e8daf.zip |
[CodeComplete] Properly determine qualifiers of 'this' in a lambda
Summary:
The clang used to pick up the qualifiers of the lamba's call operator
(which is always const) and fail to show non-const methods of 'this' in
completion results.
Reviewers: kadircet
Reviewed By: kadircet
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55885
llvm-svn: 349655
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 773dd46ac46..f8d4e4bb0e5 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -3737,11 +3737,9 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, // If we are in a C++ non-static member function, check the qualifiers on // the member function to filter/prioritize the results list. - if (CXXMethodDecl *CurMethod = dyn_cast<CXXMethodDecl>(CurContext)) { - if (CurMethod->isInstance()) { - Results.setObjectTypeQualifiers(CurMethod->getTypeQualifiers()); - } - } + auto ThisType = getCurrentThisType(); + if (!ThisType.isNull()) + Results.setObjectTypeQualifiers(ThisType->getPointeeType().getQualifiers()); CodeCompletionDeclConsumer Consumer(Results, CurContext); LookupVisibleDecls(S, LookupOrdinaryName, Consumer, |