Patch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
objective-c code with no @interface declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42319 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 9a52874..5470eb4 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1105,6 +1105,14 @@
   
   ObjcImplementationDecl* IMPDecl = 
     new ObjcImplementationDecl(AtClassImplLoc, ClassName, SDecl);
+  if (!IDecl) {
+    // Legacy case of @implementation with no corresponding @interface.
+    // Build, chain & install the interface decl into the identifier.
+    IDecl = new ObjcInterfaceDecl(AtClassImplLoc, 0, ClassName);
+    IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>());
+    ClassName->setFETokenInfo(IDecl);
+    
+  }
   
   // Check that there is no duplicate implementation of this class.
   bool err = false;