Add a defensive check for a nullptr.

llvm-svn: 256012
This commit is contained in:
Adrian Prantl 2015-12-18 19:44:31 +00:00
parent bef543635a
commit 8a634c1504
1 changed files with 7 additions and 5 deletions

View File

@ -3443,11 +3443,13 @@ void CGDebugInfo::EmitUsingDecl(const UsingDecl &UD) {
}
void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) {
auto Info = ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
DBuilder.createImportedDeclaration(
getCurrentContextDescriptor(cast<Decl>(ID.getDeclContext())),
getOrCreateModuleRef(Info, DebugTypeExtRefs),
getLineNumber(ID.getLocation()));
if (Module *M = ID.getImportedModule()) {
auto Info = ExternalASTSource::ASTSourceDescriptor(*ID.getImportedModule());
DBuilder.createImportedDeclaration(
getCurrentContextDescriptor(cast<Decl>(ID.getDeclContext())),
getOrCreateModuleRef(Info, DebugTypeExtRefs),
getLineNumber(ID.getLocation()));
}
}
llvm::DIImportedEntity *