[clang] [clang-tools-extra] [clang] Skip suggesting unqualified members in explicit-object member functions (PR #153760)

Mythreya Kuricheti via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 16 16:13:09 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);
----------------
MythreyaK wrote:

Good catch, yeah, I failed to consider this :thinking:. 

Is storing it with a call to `setObjectTypeQualifiers` fine? Or is introducing a new get-set pair better? 

https://github.com/llvm/llvm-project/pull/153760


More information about the cfe-commits mailing list