modern objc translator: avoid some duplicate declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153674 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 5b9a12f..ec7089a 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -5689,19 +5689,20 @@
   }
   // Also, for possibility of 'super' metadata class not having been defined yet.
   if (!rootClass) {
+    ObjCInterfaceDecl *SuperClass = CDecl->getSuperClass();
     Result += "\n";
     Result += "extern \"C\" ";
-    if (CDecl->getSuperClass()->getImplementation())
+    if (SuperClass->getImplementation())
       Result += "__declspec(dllexport) ";
     else
       Result += "__declspec(dllimport) ";
 
     Result += "struct _class_t "; 
     Result += VarName;
-    Result += CDecl->getSuperClass()->getNameAsString();
+    Result += SuperClass->getNameAsString();
     Result += ";\n";
     
-    if (metaclass) {
+    if (metaclass && RootClass != SuperClass) {
       Result += "extern \"C\" ";
       if (RootClass->getImplementation())
         Result += "__declspec(dllexport) ";