[cfe-commits] r42600 - in /cfe/trunk: Sema/ clang.xcodeproj/ include/clang/AST/ test/Sema/

Fariborz Jahanian fjahanian at apple.com
Wed Oct 3 17:22:33 PDT 2007


Author: fjahanian
Date: Wed Oct  3 19:22:33 2007
New Revision: 42600

URL: http://llvm.org/viewvc/llvm-project?rev=42600&view=rev
Log:
Fixed all my recent test cases to have the RUN command and
fixed consequence of these changes in clang.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/test/Sema/category-1.m
    cfe/trunk/test/Sema/class-def-test-1.m
    cfe/trunk/test/Sema/class-impl-1.m
    cfe/trunk/test/Sema/class-proto-1.m
    cfe/trunk/test/Sema/conflicting-ivar-test-1.m
    cfe/trunk/test/Sema/forward-class-1.m
    cfe/trunk/test/Sema/ivar-sem-check-1.m
    cfe/trunk/test/Sema/method-undef-category-warn-1.m
    cfe/trunk/test/Sema/method-undefined-warn-1.m
    cfe/trunk/test/Sema/objc-legacy-implementation-1.m
    cfe/trunk/test/Sema/protocol-test-1.m
    cfe/trunk/test/Sema/protocol-test-2.m
    cfe/trunk/test/Sema/undef-protocol-methods-1.m
    cfe/trunk/test/Sema/undef-superclass-1.m

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Wed Oct  3 19:22:33 2007
@@ -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());
 }
 

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Wed Oct  3 19:22:33 2007
@@ -737,6 +737,7 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Oct  3 19:22:33 2007
@@ -132,6 +132,11 @@
   ObjcMethodDecl *lookupInstanceMethod(Selector &Sel);
   ObjcMethodDecl *lookupClassMethod(Selector &Sel);
   
+  /// ImplicitInterfaceDecl - check that this is an implicitely declared
+  /// ObjcInterfaceDecl node. This is for legacy objective-c @implementation
+  /// declaration without an @interface declaration.
+  bool ImplicitInterfaceDecl() const { return getLocation().isInvalid(); }
+  
   static bool classof(const Decl *D) {
     return D->getKind() == ObjcInterface;
   }
@@ -502,6 +507,8 @@
   ObjcMethodDecl **ClassMethods; // Null if category is not implementing any
   int NumClassMethods;  // -1 if category is not implementing any
   
+  SourceLocation Loc;
+  
   public:
     ObjcCategoryImplDecl(SourceLocation L, IdentifierInfo *Id,
                          ObjcInterfaceDecl *classInterface,
@@ -510,7 +517,7 @@
     ClassInterface(classInterface),
     ObjcCatName(catName),
     InstanceMethods(0), NumInstanceMethods(-1),
-    ClassMethods(0), NumClassMethods(-1) {}
+    ClassMethods(0), NumClassMethods(-1), Loc(L) {}
         
     ObjcInterfaceDecl *getClassInterface() const { 
       return ClassInterface; 
@@ -528,6 +535,8 @@
         ObjcMethodDecl **insMethods, unsigned numInsMembers,
         ObjcMethodDecl **clsMethods, unsigned numClsMembers);
   
+  SourceLocation getLocation() const { return Loc; }
+  
   static bool classof(const Decl *D) {
     return D->getKind() == ObjcCategoryImpl;
   }

Modified: cfe/trunk/test/Sema/category-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/category-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/category-1.m (original)
+++ cfe/trunk/test/Sema/category-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface MyClass1 @end
 
 @protocol p1,p2,p3;

Modified: cfe/trunk/test/Sema/class-def-test-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/class-def-test-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/class-def-test-1.m (original)
+++ cfe/trunk/test/Sema/class-def-test-1.m Wed Oct  3 19:22:33 2007
@@ -1,8 +1,10 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @protocol SUPER;
 
 @interface SUPER <SUPER> @end // expected-error {{cannot find protocol definition for 'SUPER', referenced by 'SUPER'}}
 
-typedef int INTF; //  expected-error {{previou sdefinition is here}}
+typedef int INTF; //  expected-error {{previous definition is here}}
 
 @interface INTF @end // expected-error {{redefinition of 'INTF' as different kind of symbol}}
 

Modified: cfe/trunk/test/Sema/class-impl-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/class-impl-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/class-impl-1.m (original)
+++ cfe/trunk/test/Sema/class-impl-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 typedef int INTF3; // expected-error {{previous definition is here}}
 
 @interface SUPER @end // expected-error {{previous definition is here}}

Modified: cfe/trunk/test/Sema/class-proto-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/class-proto-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/class-proto-1.m (original)
+++ cfe/trunk/test/Sema/class-proto-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface INTF1 @end
 
 @protocol p1,p2,p3;

Modified: cfe/trunk/test/Sema/conflicting-ivar-test-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/conflicting-ivar-test-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/conflicting-ivar-test-1.m (original)
+++ cfe/trunk/test/Sema/conflicting-ivar-test-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface INTF 
 {
 @public

Modified: cfe/trunk/test/Sema/forward-class-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/forward-class-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/forward-class-1.m (original)
+++ cfe/trunk/test/Sema/forward-class-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @class FOO, BAR;
 @class FOO, BAR;
 

Modified: cfe/trunk/test/Sema/ivar-sem-check-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ivar-sem-check-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/ivar-sem-check-1.m (original)
+++ cfe/trunk/test/Sema/ivar-sem-check-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 struct S;
 typedef int FOO();
 
@@ -6,9 +8,11 @@
 	struct F {} JJ;
 	int arr[];  // expected-error {{field 'arr' has incomplete type}}
 	struct S IC;  // expected-error {{field 'IC' has incomplete type}}
-	struct T { struct T {} X; }YYY; // expected-error {{nested redefinition of 'struct'}}
+	struct T { // expected-error {{previous definition is here}}
+	  struct T {} X;  // expected-error {{nested redefinition of 'struct'}}
+	}YYY; 
 	FOO    BADFUNC;  // expected-error {{field 'BADFUNC' declared as a function}}
-	int kaka;
+	int kaka;	// expected-error {{previous definition is here}}
 	int kaka;	// expected-error {{duplicate member 'kaka'}}
 	char ch[];	// expected-error {{field 'ch' has incomplete type}}
 }

Modified: cfe/trunk/test/Sema/method-undef-category-warn-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/method-undef-category-warn-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/method-undef-category-warn-1.m (original)
+++ cfe/trunk/test/Sema/method-undef-category-warn-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface MyClass1 
 @end
 
@@ -10,17 +12,17 @@
 - (void) meth2;	// expected-warning {{method definition for 'meth2' not found}}
 @end
 
- at implementation MyClass1(CAT)
+ at implementation MyClass1(CAT) // expected-warning {{incomplete implementation of category 'CAT'}}
 - (void) Pmeth1{}
- at end  // expected-warning {{incomplete implementation of category 'CAT'}}
+ at end
 
 @interface MyClass1(DOG) <P>
 - (void)ppp;  // expected-warning {{method definition for 'ppp' not found}}
 @end
 
- at implementation MyClass1(DOG)
+ at implementation MyClass1(DOG) // expected-warning {{incomplete implementation of category 'DOG'}}
 - (void) Pmeth {}
- at end  // expected-warning {{incomplete implementation of category 'DOG'}}
+ at end
 
 @implementation MyClass1(CAT1)
 @end

Modified: cfe/trunk/test/Sema/method-undefined-warn-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/method-undefined-warn-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/method-undefined-warn-1.m (original)
+++ cfe/trunk/test/Sema/method-undefined-warn-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface INTF
 - (void) meth;
 - (void) meth : (int) arg1;
@@ -6,12 +8,11 @@
 + (void) cls_meth1 : (int) arg1; // expected-warning {{method definition for 'cls_meth1:' not found}}
 @end
 
- at implementation INTF
+ at implementation INTF 	// expected-warning {{incomplete implementation of class 'INTF'}}
 - (void) meth {}
 - (void) meth : (int) arg2{}
 - (void) cls_meth1 : (int) arg2{}
- at end	// expected-warning {{incomplete implementation of class 'INTF'}}
-
+ at end
 
 @interface INTF1
 - (void) meth;
@@ -21,12 +22,11 @@
 + (void) cls_meth1 : (int) arg1; // expected-warning {{method definition for 'cls_meth1:' not found}}
 @end
 
- at implementation INTF1
+ at implementation INTF1 // expected-warning {{incomplete implementation of class 'INTF1'}}
 - (void) meth {}
 - (void) meth : (int) arg2{}
 - (void) cls_meth1 : (int) arg2{}
- at end // expected-warning {{incomplete implementation of class 'INTF1'}}
-
+ at end
 
 @interface INTF2
 - (void) meth;

Modified: cfe/trunk/test/Sema/objc-legacy-implementation-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-legacy-implementation-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/objc-legacy-implementation-1.m (original)
+++ cfe/trunk/test/Sema/objc-legacy-implementation-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @implementation INTF // expected-warning {{cannot find interface declaration for 'INTF'}}
 @end
 

Modified: cfe/trunk/test/Sema/protocol-test-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/protocol-test-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/protocol-test-1.m (original)
+++ cfe/trunk/test/Sema/protocol-test-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @protocol PROTO1
 @required 
 - (int) FooBar;

Modified: cfe/trunk/test/Sema/protocol-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/protocol-test-2.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/protocol-test-2.m (original)
+++ cfe/trunk/test/Sema/protocol-test-2.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @interface INTF1 @end
 
 @protocol p1,p2,p3;

Modified: cfe/trunk/test/Sema/undef-protocol-methods-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/undef-protocol-methods-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/undef-protocol-methods-1.m (original)
+++ cfe/trunk/test/Sema/undef-protocol-methods-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @protocol P1
 - (void) P1proto; // expected-warning {{method definition for 'P1proto' not found}}
 + (void) ClsP1Proto; // expected-warning {{method definition for 'ClsP1Proto' not found}}
@@ -15,17 +17,17 @@
 @end
 
 @protocol PROTO<P1, P3>
-- (void) meth;			// expected-warning {{method definition for 'meth' not found
-- (void) meth : (int) arg1;	// expected-warning {{method definition for 'meth:' not found
-+ (void) cls_meth : (int) arg1; // expected-warning {{method definition for 'cls_meth:' not found
+- (void) meth;			// expected-warning {{method definition for 'meth' not found}}
+- (void) meth : (int) arg1;	// expected-warning {{method definition for 'meth:' not found}}
++ (void) cls_meth : (int) arg1; // expected-warning {{method definition for 'cls_meth:' not found}}
 @end
 
 @interface INTF <PROTO>
 @end
 
- at implementation INTF
+ at implementation INTF   // expected-warning {{incomplete implementation of class 'INTF'}}
 - (void) DefP1proto{}
 
 + (void) DefClsP3Proto{}
 
- at end // expected-warning {{ncomplete implementation of class 'INTF'}}
+ at end

Modified: cfe/trunk/test/Sema/undef-superclass-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/undef-superclass-1.m?rev=42600&r1=42599&r2=42600&view=diff

==============================================================================
--- cfe/trunk/test/Sema/undef-superclass-1.m (original)
+++ cfe/trunk/test/Sema/undef-superclass-1.m Wed Oct  3 19:22:33 2007
@@ -1,3 +1,5 @@
+// RUN: clang -fsyntax-only -verify %s
+
 @class SUPER, Y;
 
 @interface INTF :SUPER  // expected-error {{cannot find interface declaration for 'SUPER', superclass of 'INTF'}}





More information about the cfe-commits mailing list