aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-13 17:52:22 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-13 17:52:22 +0000
commit943ed6ff5fafabc5ee1ea6a015908562688fbd47 (patch)
tree9948c4f016db7eb21c5c7f59dc64e72cd2fc8e6e /lib/CodeGen/CGObjCMac.cpp
parent55e5d8956be516d66db2196bd0ce3c30ebf5fbf0 (diff)
Fixed a 64bit code gen bug of a cateogory
implementation with no category declaration! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 103acab13a..360eac0535 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -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);