[cfe-commits] r42915 - in /cfe/trunk: Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj test/Parser/namelookup-bug-1.c test/Parser/namelookup-bug-2.c
Fariborz Jahanian
fjahanian at apple.com
Fri Oct 12 09:34:10 PDT 2007
Author: fjahanian
Date: Fri Oct 12 11:34:10 2007
New Revision: 42915
URL: http://llvm.org/viewvc/llvm-project?rev=42915&view=rev
Log:
Fixed a bug whereby, struct tag name matches a typedef/objc-class name
and hid them.
Added:
cfe/trunk/test/Parser/namelookup-bug-1.c
cfe/trunk/test/Parser/namelookup-bug-2.c
Modified:
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/clang.xcodeproj/project.pbxproj
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42915&r1=42914&r2=42915&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Fri Oct 12 11:34:10 2007
@@ -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;
}
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42915&r1=42914&r2=42915&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Oct 12 11:34:10 2007
@@ -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 = "";
Added: cfe/trunk/test/Parser/namelookup-bug-1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/namelookup-bug-1.c?rev=42915&view=auto
==============================================================================
--- cfe/trunk/test/Parser/namelookup-bug-1.c (added)
+++ cfe/trunk/test/Parser/namelookup-bug-1.c Fri Oct 12 11:34:10 2007
@@ -0,0 +1,7 @@
+// RUN: clang -verify %s
+
+typedef int Object;
+
+struct Object *pp;
+
+Object staticObject1;
Added: cfe/trunk/test/Parser/namelookup-bug-2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/namelookup-bug-2.c?rev=42915&view=auto
==============================================================================
--- cfe/trunk/test/Parser/namelookup-bug-2.c (added)
+++ cfe/trunk/test/Parser/namelookup-bug-2.c Fri Oct 12 11:34:10 2007
@@ -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;
+ }
+}
+
More information about the cfe-commits
mailing list