]> granicus.if.org Git - clang/commitdiff
Fixed a 64bit code gen bug of a cateogory
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 13 Feb 2009 17:52:22 +0000 (17:52 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 13 Feb 2009 17:52:22 +0000 (17:52 +0000)
implementation with no category declaration!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64470 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/no-category-class.m [new file with mode: 0644]

index 103acab13a19999a22d4d7b839e4c0c72f614fb8..360eac0535adecd2dd649d4f1707a85fd4ac198e 100644 (file)
@@ -3849,17 +3849,23 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD)
                              Methods);
   const ObjCCategoryDecl *Category = 
     Interface->FindCategoryDeclaration(OCD->getIdentifier());
-  Values[4] = EmitProtocolList("\01l_OBJC_CATEGORY_PROTOCOLS_$_"
-                               + Interface->getNameAsString() + "_$_"
-                               + Category->getNameAsString(),
-                                Category->protocol_begin(),
-                                Category->protocol_end());
-  
-  std::string ExtName(Interface->getNameAsString() + "_$_" +
-                      OCD->getNameAsString());
-  Values[5] =
-    EmitPropertyList(std::string("\01l_OBJC_$_PROP_LIST_") + ExtName,
-                                OCD, Category, ObjCTypes);
+  if (Category) {
+    std::string ExtName(Interface->getNameAsString() + "_$_" +
+                        OCD->getNameAsString());
+    Values[4] = EmitProtocolList("\01l_OBJC_CATEGORY_PROTOCOLS_$_"
+                                 + Interface->getNameAsString() + "_$_"
+                                 + Category->getNameAsString(),
+                                 Category->protocol_begin(),
+                                 Category->protocol_end());
+    Values[5] =
+      EmitPropertyList(std::string("\01l_OBJC_$_PROP_LIST_") + ExtName,
+                       OCD, Category, ObjCTypes);
+  }
+  else {
+    Values[4] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListnfABIPtrTy);
+    Values[5] = llvm::Constant::getNullValue(ObjCTypes.PropertyListPtrTy);
+  }
+    
   llvm::Constant *Init = 
     llvm::ConstantStruct::get(ObjCTypes.CategorynfABITy, 
                               Values);
diff --git a/test/CodeGenObjC/no-category-class.m b/test/CodeGenObjC/no-category-class.m
new file mode 100644 (file)
index 0000000..c0f0efa
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+
+@interface NSObject
+@end
+
+@implementation NSObject(IBXLIFFIntegration)
+@end
+