aboutsummaryrefslogtreecommitdiff
path: root/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-10-12 16:34:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-10-12 16:34:10 +0000
commitbece4ac257d85e51d94212a51eb7405818247e7e (patch)
tree7bc43c039282566b37a7964c099eee34e4cd08ff /Sema/SemaDecl.cpp
parent075878af57a14fb4e8b9313b0187c7782a2f9006 (diff)
Fixed a bug whereby, struct tag name matches a typedef/objc-class name
and hid them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaDecl.cpp')
-rw-r--r--Sema/SemaDecl.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 0a63cb9106..7e0a51f5c5 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -28,12 +28,17 @@
using namespace clang;
Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
- if (Decl *IIDecl = II.getFETokenInfo<Decl>())
- if (isa<TypedefDecl>(IIDecl) || isa<ObjcInterfaceDecl>(IIDecl))
- return IIDecl;
- else if (ObjcCompatibleAliasDecl *ADecl =
- dyn_cast<ObjcCompatibleAliasDecl>(IIDecl))
- return ADecl->getClassInterface();
+ Decl *IIDecl = II.getFETokenInfo<Decl>();
+ // Find first occurance of none-tagged declaration
+ while(IIDecl && IIDecl->getIdentifierNamespace() != Decl::IDNS_Ordinary)
+ IIDecl = cast<ScopedDecl>(IIDecl)->getNext();
+ if (!IIDecl)
+ return 0;
+ if (isa<TypedefDecl>(IIDecl) || isa<ObjcInterfaceDecl>(IIDecl))
+ return IIDecl;
+ if (ObjcCompatibleAliasDecl *ADecl =
+ dyn_cast<ObjcCompatibleAliasDecl>(IIDecl))
+ return ADecl->getClassInterface();
return 0;
}