]> granicus.if.org Git - clang/commitdiff
Thread a Scope pointer into BuildRecoveryCallExpr to help typo
authorDouglas Gregor <dgregor@apple.com>
Wed, 14 Apr 2010 20:27:54 +0000 (20:27 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 14 Apr 2010 20:27:54 +0000 (20:27 +0000)
correction find names when a call failed. Fixes
<rdar://problem/7853795>.

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

lib/Sema/Sema.h
lib/Sema/SemaExpr.cpp
lib/Sema/SemaOverload.cpp
test/FixIt/fixit.cpp

index eea0a2bf9e67db05e22b5419c00ec02bf846b24a..2ef74fc47768b6a2881605f0c0d6e5a4054519ab 100644 (file)
@@ -1271,7 +1271,7 @@ public:
                                    OverloadCandidateSet &CandidateSet,
                                    bool PartialOverloading = false);
     
-  OwningExprResult BuildOverloadedCallExpr(Expr *Fn,
+  OwningExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn,
                                            UnresolvedLookupExpr *ULE,
                                            SourceLocation LParenLoc,
                                            Expr **Args, unsigned NumArgs,
index 2a9af99493354df0ce882ed0020da3df62e4e0c1..09abf7b6c303bf5c10a7394f3e664a914f279556 100644 (file)
@@ -3558,7 +3558,7 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
   Expr *NakedFn = Fn->IgnoreParens();
   if (isa<UnresolvedLookupExpr>(NakedFn)) {
     UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(NakedFn);
-    return BuildOverloadedCallExpr(Fn, ULE, LParenLoc, Args, NumArgs,
+    return BuildOverloadedCallExpr(S, Fn, ULE, LParenLoc, Args, NumArgs,
                                    CommaLocs, RParenLoc);
   }
 
index c3d2e64f7bf79a75b4891710270419fbb75e5ac6..e039669257ba34bbfa97b30403bd1800d2f91525 100644 (file)
@@ -5639,7 +5639,7 @@ static Sema::OwningExprResult Destroy(Sema &SemaRef, Expr *Fn,
 ///
 /// Returns true if new candidates were found.
 static Sema::OwningExprResult
-BuildRecoveryCallExpr(Sema &SemaRef, Expr *Fn,
+BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
                       UnresolvedLookupExpr *ULE,
                       SourceLocation LParenLoc,
                       Expr **Args, unsigned NumArgs,
@@ -5661,7 +5661,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Expr *Fn,
 
   LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
                  Sema::LookupOrdinaryName);
-  if (SemaRef.DiagnoseEmptyLookup(/*Scope=*/0, SS, R))
+  if (SemaRef.DiagnoseEmptyLookup(S, SS, R))
     return Destroy(SemaRef, Fn, Args, NumArgs);
 
   assert(!R.empty() && "lookup results empty despite recovery");
@@ -5697,7 +5697,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Expr *Fn,
 /// resolution. Otherwise, emits diagnostics, deletes all of the
 /// arguments and Fn, and returns NULL.
 Sema::OwningExprResult
-Sema::BuildOverloadedCallExpr(Expr *Fn, UnresolvedLookupExpr *ULE,
+Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
                               SourceLocation LParenLoc,
                               Expr **Args, unsigned NumArgs,
                               SourceLocation *CommaLocs,
@@ -5730,7 +5730,7 @@ Sema::BuildOverloadedCallExpr(Expr *Fn, UnresolvedLookupExpr *ULE,
   // AddRecoveryCallCandidates diagnoses the error itself, so we just
   // bailout out if it fails.
   if (CandidateSet.empty())
-    return BuildRecoveryCallExpr(*this, Fn, ULE, LParenLoc, Args, NumArgs,
+    return BuildRecoveryCallExpr(*this, S, Fn, ULE, LParenLoc, Args, NumArgs,
                                  CommaLocs, RParenLoc);
 
   OverloadCandidateSet::iterator Best;
index 79c294b1d92921f169ce9d8750640f9ae152a652..f596226e9f104b736c644001a7c65843e56e4ecc 100644 (file)
@@ -40,3 +40,12 @@ class B : public A {
 
 void f() throw();
 void f(); // expected-warning{{missing exception specification}}
+
+namespace rdar7853795 {
+  struct A {
+    bool getNumComponents() const; // expected-note{{declared here}}
+    void dump() const { 
+      getNumComponenets(); // expected-error{{use of undeclared identifier 'getNumComponenets'; did you mean 'getNumComponents'?}}
+    }
+  };
+}