Fixed a bug whereby, struct tag name matches a typedef/objc-class name

and hid them.

llvm-svn: 42915
This commit is contained in:
Fariborz Jahanian 2007-10-12 16:34:10 +00:00
parent b213da2a70
commit d52cd41630
4 changed files with 33 additions and 6 deletions

View File

@ -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;
}

View File

@ -742,6 +742,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";

View File

@ -0,0 +1,7 @@
// RUN: clang -verify %s
typedef int Object;
struct Object *pp;
Object staticObject1;

View File

@ -0,0 +1,14 @@
// RUN: clang -verify %s
typedef int Object;
struct Object {int i1; } *P;
void foo() {
struct Object { int i2; } *X;
Object:
{
Object a;
}
}