Fixed all my recent test cases to have the RUN command and
fixed consequence of these changes in clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42600 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index c44ca81..6bd0595 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1147,7 +1147,7 @@
   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 = new ObjcInterfaceDecl(SourceLocation(), 0, ClassName);
     IDecl->setNext(ClassName->getFETokenInfo<ScopedDecl>());
     ClassName->setFETokenInfo(IDecl);
     
@@ -1172,8 +1172,9 @@
                                     ObjcIvarDecl **ivars, unsigned numIvars) {
   assert(ImpDecl && "missing implementation decl");
   ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(ImpDecl->getIdentifier());
-  
-  if (!IDecl)
+  /// 2nd check is added to accomodate case of non-existing @interface decl.
+  /// (legacy objective-c @implementation decl without an @interface decl).
+  if (!IDecl || IDecl->ImplicitInterfaceDecl())
     return;
   assert(ivars && "missing @implementation ivars");
   
@@ -1289,8 +1290,8 @@
     CheckProtocolMethodDefs(PDecl, IncompleteImpl, InsMap, ClsMap);
   }
   if (IncompleteImpl)
-    Diag(IDecl->getLocation(), diag::warn_incomplete_impl_class, 
-         IDecl->getName());
+    Diag(IMPDecl->getLocation(), diag::warn_incomplete_impl_class, 
+         IMPDecl->getName());
 }
 
 /// ImplCategoryMethodsVsIntfMethods - Checks that methods declared in the
@@ -1339,7 +1340,7 @@
     CheckProtocolMethodDefs(PDecl, IncompleteImpl, InsMap, ClsMap);
   }
   if (IncompleteImpl)
-    Diag(CatClassDecl->getLocation(), diag::warn_incomplete_impl_category, 
+    Diag(CatImplDecl->getLocation(), diag::warn_incomplete_impl_category, 
          CatClassDecl->getCatName()->getName());
 }