diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-08 01:10:55 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-01-08 01:10:55 +0000 |
commit | 17290c363836ffef497381e4803f3796ed1bbd22 (patch) | |
tree | d7652669a2d9b7ef073a5b08f031accb00db83d4 | |
parent | e0a2cf332c0af06ed3ca57a39ae5d4f32e64dc73 (diff) | |
download | bcm5719-llvm-17290c363836ffef497381e4803f3796ed1bbd22.tar.gz bcm5719-llvm-17290c363836ffef497381e4803f3796ed1bbd22.zip |
Objc's compatibility-alias semantics and code
gen issue fix.
llvm-svn: 61901
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 9 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/compatibility-alias.m | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index eaa8b58b41d..ff8acde9951 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1065,7 +1065,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { break; } case Decl::ObjCCompatibleAlias: - ErrorUnsupported(D, "Objective-C compatible alias"); + // compatibility-alias is a directive and has no code gen. break; case Decl::LinkageSpec: { diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index c32a806b7d1..68e7744582c 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -159,6 +159,15 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc, } // Check for class declaration Decl *CDeclU = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope); + if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(CDeclU)) { + QualType T = TDecl->getUnderlyingType(); + if (T->isObjCInterfaceType()) { + if (NamedDecl *IDecl = T->getAsObjCInterfaceType()->getDecl()) { + ClassName = IDecl->getIdentifier(); + CDeclU = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope); + } + } + } ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU); if (CDecl == 0) { Diag(ClassLocation, diag::warn_undef_interface) << ClassName; diff --git a/clang/test/CodeGenObjC/compatibility-alias.m b/clang/test/CodeGenObjC/compatibility-alias.m new file mode 100644 index 00000000000..0982a90b708 --- /dev/null +++ b/clang/test/CodeGenObjC/compatibility-alias.m @@ -0,0 +1,8 @@ +// RUN: clang -emit-llvm -o %t %s + +@interface Int1 @end + +typedef Int1 Int1Typedef; +@compatibility_alias Int1Alias Int1Typedef; + +@implementation Int1Alias @end |