summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-09 11:48:06 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-09 12:05:47 +0000
commite3e72a2619ccec9654ef9ad45e1e926841fbaa58 (patch)
tree9d2d59f722752055ae0f8f35fdf4f086df564ab7 /clang/lib/CodeGen
parent15c7fa4d11eeb50095ae571c645427b9a267bdee (diff)
downloadbcm5719-llvm-e3e72a2619ccec9654ef9ad45e1e926841fbaa58.tar.gz
bcm5719-llvm-e3e72a2619ccec9654ef9ad45e1e926841fbaa58.zip
Fix "pointer is null" static analyzer warnings. NFCI.
Assert that the pointers are non-null before dereferencing them.
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 479cd8ec77c..a27b6d4ed63 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1236,6 +1236,7 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
// The first Interface we find may be a @class,
// which should only be treated as the source of
// truth in the absence of a true declaration.
+ assert(OID && "Failed to find ObjCInterfaceDecl");
const ObjCInterfaceDecl *OIDDef = OID->getDefinition();
if (OIDDef != nullptr)
OID = OIDDef;
@@ -3036,6 +3037,7 @@ llvm::Value *CGObjCGNU::GenerateProtocolRef(CodeGenFunction &CGF,
llvm::Constant *&protocol = ExistingProtocols[PD->getNameAsString()];
if (!protocol)
GenerateProtocol(PD);
+ assert(protocol && "Unknown protocol");
llvm::Type *T =
CGM.getTypes().ConvertType(CGM.getContext().getObjCProtoType());
return CGF.Builder.CreateBitCast(protocol, llvm::PointerType::getUnqual(T));
OpenPOWER on IntegriCloud