]> granicus.if.org Git - clang/commitdiff
When we're in the context of an Objective-C message send's receiver,
authorDouglas Gregor <dgregor@apple.com>
Fri, 15 Oct 2010 13:35:25 +0000 (13:35 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 15 Oct 2010 13:35:25 +0000 (13:35 +0000)
typo correction prefers "super" over other, equivalent completions. I
believe this will fix the regression on the buildbot.

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

lib/Sema/SemaLookup.cpp

index f12ac22f3de5783d49e7e7b9bf39d865d505e305..9056e79574edf0784fd64c3620bd4bfb022435c3 100644 (file)
@@ -2704,6 +2704,10 @@ public:
   unsigned size() const { return BestResults.size(); }
   bool empty() const { return BestResults.empty(); }
 
+  bool &operator[](llvm::StringRef Name) {
+    return BestResults[Name];
+  }
+
   unsigned getBestEditDistance() const { return BestEditDistance; }  
 };
 
@@ -3119,7 +3123,15 @@ DeclarationName Sema::CorrectTypo(LookupResult &Res, Scope *S, CXXScopeSpec *SS,
   // If only a single name remains, return that result.
   if (Consumer.size() == 1)
     return &Context.Idents.get(Consumer.begin()->getKey());  
-
+  else if (Consumer.size() > 1 && CTC == CTC_ObjCMessageReceiver 
+           && Consumer["super"]) {
+    // Prefix 'super' when we're completing in a message-receiver
+    // context.
+    Res.suppressDiagnostics();
+    Res.clear();
+    return &Context.Idents.get("super");
+  }
+           
   Res.suppressDiagnostics();
   Res.setLookupName(Typo);
   Res.clear();