[cfe-commits] r74258 - in /cfe/trunk: lib/Sema/SemaLookup.cpp test/SemaCXX/using-decl-pr4450.cpp
Anders Carlsson
andersca at mac.com
Thu Jun 25 20:37:09 PDT 2009
Author: andersca
Date: Thu Jun 25 22:37:05 2009
New Revision: 74258
URL: http://llvm.org/viewvc/llvm-project?rev=74258&view=rev
Log:
When creating LookupResults, see through UsingDecls. Fixes PR4450.
Added:
cfe/trunk/test/SemaCXX/using-decl-pr4450.cpp
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=74258&r1=74257&r2=74258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Jun 25 22:37:05 2009
@@ -325,7 +325,9 @@
if (ObjCCompatibleAliasDecl *Alias
= dyn_cast_or_null<ObjCCompatibleAliasDecl>(D))
D = Alias->getClassInterface();
-
+ if (UsingDecl *UD = dyn_cast_or_null<UsingDecl>(D))
+ D = UD->getTargetDecl();
+
LookupResult Result;
Result.StoredKind = (D && isa<OverloadedFunctionDecl>(D))?
OverloadedDeclSingleDecl : SingleDecl;
@@ -358,7 +360,9 @@
if (ObjCCompatibleAliasDecl *Alias
= dyn_cast_or_null<ObjCCompatibleAliasDecl>(D))
D = Alias->getClassInterface();
-
+ if (UsingDecl *UD = dyn_cast_or_null<UsingDecl>(D))
+ D = UD->getTargetDecl();
+
Result.StoredKind = SingleDecl;
Result.First = reinterpret_cast<uintptr_t>(D);
Result.Last = 0;
Added: cfe/trunk/test/SemaCXX/using-decl-pr4450.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-pr4450.cpp?rev=74258&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/using-decl-pr4450.cpp (added)
+++ cfe/trunk/test/SemaCXX/using-decl-pr4450.cpp Thu Jun 25 22:37:05 2009
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ void g();
+}
+
+namespace X {
+ using A::g;
+}
+
+void h()
+{
+ A::g();
+ X::g();
+}
More information about the cfe-commits
mailing list