aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-06-05 22:57:10 +0000
committerSteve Naroff <snaroff@apple.com>2008-06-05 22:57:10 +0000
commitc7333881dcd00be87814d03c349dd96c815f2f05 (patch)
treebff23b222fde80139dcc9e5245eac520a886b12a /lib/Sema/SemaDeclObjC.cpp
parentfe4db8b8344453aab0a42d8e187471e7392b3662 (diff)
Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 84a8e82750..240e6c7a68 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -712,9 +712,18 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
// Check for another declaration kind with the same name.
Decl *PrevDecl = LookupDecl(IdentList[i], Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
- Diag(AtClassLoc, diag::err_redefinition_different_kind,
- IdentList[i]->getName());
- Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ // GCC apparently allows the following idiom:
+ //
+ // typedef NSObject < XCElementTogglerP > XCElementToggler;
+ // @class XCElementToggler;
+ //
+ // FIXME: Make an extension?
+ TypedefDecl *TDD = dyn_cast<TypedefDecl>(PrevDecl);
+ if (!TDD || !isa<ObjCInterfaceType>(TDD->getUnderlyingType())) {
+ Diag(AtClassLoc, diag::err_redefinition_different_kind,
+ IdentList[i]->getName());
+ Diag(PrevDecl->getLocation(), diag::err_previous_definition);
+ }
}
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl) { // Not already seen? Make a forward decl.