[clang] [clang-tools-extra] [clang] Skip suggesting unqualified members in explicit-object member functions (PR #153760)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 16 18:17:51 PDT 2025
================
@@ -1428,6 +1428,16 @@ void ResultBuilder::AddResult(Result R, DeclContext *CurContext,
AdjustResultPriorityForDecl(R);
+ if (isa<FieldDecl>(R.Declaration)) {
+ // If result is a member in the context of an explicit-object member
+ // function, drop it because it must be accessed through the object
+ // parameter
+ if (auto *MethodDecl = dyn_cast<CXXMethodDecl>(CurContext);
----------------
HighCommander4 wrote:
Good catch, but I would say this is an unrelated bug:
```c++
struct A {
int foo(this A const&);
};
void bar(const A& a) {
a.^ // foo not offered
}
```
This scenario involves `CodeCompleteMemberReferencExpr`, so I don't think it needs to influence what we do in `CodeCompleteOrdinaryName`. Let's file it as another issue to look at later?
https://github.com/llvm/llvm-project/pull/153760
More information about the cfe-commits
mailing list