diff options
author | John McCall <rjmccall@apple.com> | 2016-11-29 21:57:00 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2016-11-29 21:57:00 +0000 |
commit | 843dfccdc5095687856c7f8cd3e85372d38a2ea2 (patch) | |
tree | a87e24b61f6349a239f3fccfcca1a56fbc3d5ca7 /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | 8700d91ddb8da084c89d52c683e9a326bd1c8179 (diff) | |
download | bcm5719-llvm-843dfccdc5095687856c7f8cd3e85372d38a2ea2.tar.gz bcm5719-llvm-843dfccdc5095687856c7f8cd3e85372d38a2ea2.zip |
getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.
llvm-svn: 288203
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 06b77a0914f..1d25f3b0545 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2760,8 +2760,6 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { std::vector<llvm::Constant*> MethodTypesExt, OptMethodTypesExt; for (const auto *MD : PD->instance_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); - if (!C) - return GetOrEmitProtocolRef(PD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { OptInstanceMethods.push_back(C); @@ -2774,8 +2772,6 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { for (const auto *MD : PD->class_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); - if (!C) - return GetOrEmitProtocolRef(PD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { OptClassMethods.push_back(C); @@ -3076,8 +3072,6 @@ CGObjCMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) { ObjCTypes.SelectorPtrTy), GetMethodVarType(MD) }; - if (!Desc[1]) - return nullptr; return llvm::ConstantStruct::get(ObjCTypes.MethodDescriptionTy, Desc); @@ -5178,9 +5172,8 @@ llvm::Constant *CGObjCCommonMac::GetMethodVarType(const FieldDecl *Field) { llvm::Constant *CGObjCCommonMac::GetMethodVarType(const ObjCMethodDecl *D, bool Extended) { - std::string TypeStr; - if (CGM.getContext().getObjCEncodingForMethodDecl(D, TypeStr, Extended)) - return nullptr; + std::string TypeStr = + CGM.getContext().getObjCEncodingForMethodDecl(D, Extended); llvm::GlobalVariable *&Entry = MethodVarTypes[TypeStr]; if (!Entry) @@ -5201,8 +5194,8 @@ llvm::Constant *CGObjCCommonMac::GetPropertyName(IdentifierInfo *Ident) { llvm::Constant * CGObjCCommonMac::GetPropertyTypeString(const ObjCPropertyDecl *PD, const Decl *Container) { - std::string TypeStr; - CGM.getContext().getObjCEncodingForPropertyDecl(PD, Container, TypeStr); + std::string TypeStr = + CGM.getContext().getObjCEncodingForPropertyDecl(PD, Container); return GetPropertyName(&CGM.getContext().Idents.get(TypeStr)); } @@ -6633,8 +6626,6 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( std::vector<llvm::Constant*> MethodTypesExt, OptMethodTypesExt; for (const auto *MD : PD->instance_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); - if (!C) - return GetOrEmitProtocolRef(PD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { OptInstanceMethods.push_back(C); @@ -6647,8 +6638,6 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( for (const auto *MD : PD->class_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); - if (!C) - return GetOrEmitProtocolRef(PD); if (MD->getImplementationControl() == ObjCMethodDecl::Optional) { OptClassMethods.push_back(C); @@ -6814,8 +6803,6 @@ CGObjCNonFragileABIMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) { llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()), ObjCTypes.SelectorPtrTy); Desc[1] = GetMethodVarType(MD); - if (!Desc[1]) - return nullptr; // Protocol methods have no implementation. So, this entry is always NULL. Desc[2] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); |