diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 28 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/no-category-class.m | 8 |
2 files changed, 25 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 103acab13a1..360eac0535a 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/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); diff --git a/clang/test/CodeGenObjC/no-category-class.m b/clang/test/CodeGenObjC/no-category-class.m new file mode 100644 index 00000000000..c0f0efa941d --- /dev/null +++ b/clang/test/CodeGenObjC/no-category-class.m @@ -0,0 +1,8 @@ +// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s + +@interface NSObject +@end + +@implementation NSObject(IBXLIFFIntegration) +@end + |