When in an Objective-C instance method, super is a valid code-completion result
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90758 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index cfeefff..73e0ab0 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1356,9 +1356,23 @@
}
void Sema::CodeCompleteOrdinaryName(Scope *S) {
+ typedef CodeCompleteConsumer::Result Result;
ResultBuilder Results(*this, &ResultBuilder::IsOrdinaryName);
unsigned NextRank = CollectLookupResults(S, Context.getTranslationUnitDecl(),
0, CurContext, Results);
+
+ Results.EnterNewScope();
+ AddTypeSpecifierResults(getLangOptions(), NextRank, Results);
+
+ if (getLangOptions().ObjC1) {
+ // Add the "super" keyword, if appropriate.
+ if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(CurContext))
+ if (Method->getClassInterface()->getSuperClass())
+ Results.MaybeAddResult(Result("super", NextRank));
+ }
+
+ Results.ExitScope();
+
if (CodeCompleter->includeMacros())
AddMacroResults(PP, NextRank, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());