]> granicus.if.org Git - clang/commitdiff
When providing completions for a member access expression in C++,
authorDouglas Gregor <dgregor@apple.com>
Thu, 14 Jan 2010 01:17:14 +0000 (01:17 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 14 Jan 2010 01:17:14 +0000 (01:17 +0000)
provided nested-name-specifier results for base classes (only), rather
than everything that could possibly be a nested-name-specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93398 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCodeComplete.cpp

index 3e8f749a054a36133a08a9dad5f10f7bda2f08d8..84f92cef26fc58b019a636e75eeab5eb133837fc 100644 (file)
@@ -664,6 +664,9 @@ bool ResultBuilder::IsMember(NamedDecl *ND) const {
   if (UsingShadowDecl *Using = dyn_cast<UsingShadowDecl>(ND))
     ND = Using->getTargetDecl();
 
+  if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(ND))
+    return Record->isInjectedClassName();
+    
   return isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND) ||
     isa<ObjCPropertyDecl>(ND);
 }
@@ -2148,14 +2151,6 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *BaseE,
         if (IsDependent)
           Results.MaybeAddResult(Result("template"));
       }
-
-      // We could have the start of a nested-name-specifier. Add those
-      // results as well.
-      // FIXME: We should really walk base classes to produce
-      // nested-name-specifiers so that we produce more-precise results.
-      Results.setFilter(&ResultBuilder::IsNestedNameSpecifier);
-      CollectLookupResults(S, Context.getTranslationUnitDecl(), 
-                           CurContext, Results);
     }
   } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) {
     // Objective-C property reference.