[cfe-commits] r61901 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaDeclObjC.cpp test/CodeGenObjC/compatibility-alias.m
Fariborz Jahanian
fjahanian at apple.com
Wed Jan 7 17:10:55 PST 2009
Author: fjahanian
Date: Wed Jan 7 19:10:55 2009
New Revision: 61901
URL: http://llvm.org/viewvc/llvm-project?rev=61901&view=rev
Log:
Objc's compatibility-alias semantics and code
gen issue fix.
Added:
cfe/trunk/test/CodeGenObjC/compatibility-alias.m
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=61901&r1=61900&r2=61901&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Jan 7 19:10:55 2009
@@ -1065,7 +1065,7 @@
break;
}
case Decl::ObjCCompatibleAlias:
- ErrorUnsupported(D, "Objective-C compatible alias");
+ // compatibility-alias is a directive and has no code gen.
break;
case Decl::LinkageSpec: {
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=61901&r1=61900&r2=61901&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Jan 7 19:10:55 2009
@@ -159,6 +159,15 @@
}
// 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;
Added: cfe/trunk/test/CodeGenObjC/compatibility-alias.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/compatibility-alias.m?rev=61901&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/compatibility-alias.m (added)
+++ cfe/trunk/test/CodeGenObjC/compatibility-alias.m Wed Jan 7 19:10:55 2009
@@ -0,0 +1,8 @@
+// RUN: clang -emit-llvm -o %t %s
+
+ at interface Int1 @end
+
+typedef Int1 Int1Typedef;
+ at compatibility_alias Int1Alias Int1Typedef;
+
+ at implementation Int1Alias @end
More information about the cfe-commits
mailing list