]> granicus.if.org Git - clang/commitdiff
Use the real CXXScopeSpec when setting the correction SourceRange.
authorKaelyn Takata <rikka@google.com>
Wed, 28 Jan 2015 00:46:09 +0000 (00:46 +0000)
committerKaelyn Takata <rikka@google.com>
Wed, 28 Jan 2015 00:46:09 +0000 (00:46 +0000)
Otherwise, in the most important case and the only case where SS and
TempSS are different (which is when the CXXScopeSpec should be dropped,
and TempSS is NULL) the wrong SourceRange will be used in the fixit for
the typo correction. Fixes the remaining issue in PR20626.

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

lib/Sema/SemaLookup.cpp
test/FixIt/typo-location-bugs.cpp

index c4fe0589c4ba641c7f3609aa91e3dc2adbc6dfd0..d75eb2c24290e0e6fb8a9a07ae9c5e1d7bf0fcb6 100644 (file)
@@ -3587,7 +3587,7 @@ retry_lookup:
         QualifiedResults.push_back(Candidate);
       break;
     }
-    Candidate.setCorrectionRange(TempSS, Result.getLookupNameInfo());
+    Candidate.setCorrectionRange(SS.get(), Result.getLookupNameInfo());
     return true;
   }
   return false;
index e44664d49adbbb845d6ba384a62af7a4d6bc8e40..c7111a801066d32d110937864eba95be549c8445 100644 (file)
@@ -34,3 +34,16 @@ void test(B b) {
   b.f(1);  // expected-error{{too many arguments to function call, expected 0, have 1; did you mean 'A::f'?}}
 }
 }
+
+namespace PR20626 {
+class A {
+public:
+  void Foo(){};  // expected-note{{'Foo' declared here}}
+};
+class B {};
+class C : public A, public B {
+  void Run() {
+    B::Foo();  // expected-error{{no member named 'Foo' in 'PR20626::B'; did you mean simply 'Foo'?}}
+  }
+};
+}