Skip to content

Commit 45302d3

Browse files
committed
[ClangImporter] Add a bunch of non-null assertions.
rdar://problem/23985987 has a crash report that implies that a null snuck in here at some point in the past. All the refactoring that's happened since then probably means it can't happen any more, but assertions are always good, right?
1 parent b7501e8 commit 45302d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4254,6 +4254,7 @@ namespace {
42544254
ArrayRef<ProtocolDecl *> protocols,
42554255
SmallVectorImpl<Decl *> &members,
42564256
ASTContext &Ctx) {
4257+
assert(dc);
42574258
const clang::ObjCInterfaceDecl *interfaceDecl = nullptr;
42584259
const ClangModuleUnit *declModule;
42594260
const ClangModuleUnit *interfaceModule;
@@ -4907,6 +4908,8 @@ namespace {
49074908

49084909
Decl *VisitObjCPropertyDecl(const clang::ObjCPropertyDecl *decl,
49094910
DeclContext *dc) {
4911+
assert(dc);
4912+
49104913
auto name = Impl.importFullName(decl).Imported.getBaseName();
49114914
if (name.empty())
49124915
return nullptr;
@@ -5626,6 +5629,7 @@ Decl *
56265629
ClangImporter::Implementation::importMirroredDecl(const clang::NamedDecl *decl,
56275630
DeclContext *dc,
56285631
ProtocolDecl *proto) {
5632+
assert(dc);
56295633
if (!decl)
56305634
return nullptr;
56315635

@@ -5930,6 +5934,7 @@ createUnavailableDecl(Identifier name, DeclContext *dc, Type type,
59305934

59315935
void
59325936
ClangImporter::Implementation::loadAllMembers(Decl *D, uint64_t unused) {
5937+
assert(D);
59335938
assert(D->hasClangNode());
59345939
auto clangDecl = cast<clang::ObjCContainerDecl>(D->getClangDecl());
59355940

0 commit comments

Comments
 (0)