[cfe-commits] r168317 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaCXX/typo-correction.cpp

Kaelyn Uhrain rikka at google.com
Mon Nov 19 10:49:53 PST 2012


Author: rikka
Date: Mon Nov 19 12:49:53 2012
New Revision: 168317

URL: http://llvm.org/viewvc/llvm-project?rev=168317&view=rev
Log:
When adding a NamedDecl to a correction, add the underlying Decl (via
getUnderlyingDecl()) so that derivatives of
CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry
about being thrown by UsingDecls and such.

Modified:
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/SemaCXX/typo-correction.cpp

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=168317&r1=168316&r2=168317&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Mon Nov 19 12:49:53 2012
@@ -4094,7 +4094,7 @@
   if (isKeyword())
     CorrectionDecls.clear();
 
-  CorrectionDecls.push_back(CDecl);
+  CorrectionDecls.push_back(CDecl->getUnderlyingDecl());
 
   if (!CorrectionName)
     CorrectionName = CDecl->getDeclName();

Modified: cfe/trunk/test/SemaCXX/typo-correction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction.cpp?rev=168317&r1=168316&r2=168317&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction.cpp Mon Nov 19 12:49:53 2012
@@ -236,3 +236,17 @@
    return status; // expected-error-re{{use of undeclared identifier 'status'$}}
  }
 }
+
+namespace PR13387 {
+struct A {
+  void CreateFoo(float, float); // expected-note {{'CreateFoo' declared here}}
+  void CreateBar(float, float);
+};
+struct B : A {
+  using A::CreateFoo;
+  void CreateFoo(int, int);
+};
+void f(B &x) {
+  x.Createfoo(0,0); // expected-error {{no member named 'Createfoo' in 'PR13387::B'; did you mean 'CreateFoo'?}}
+}
+}





More information about the cfe-commits mailing list