Objc's compatibility-alias semantics and code
gen issue fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61901 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index eaa8b58..ff8acde 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -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: {
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index c32a806..68e7744 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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;