diff options
author | Adrian Prantl <aprantl@apple.com> | 2015-12-18 19:44:31 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2015-12-18 19:44:31 +0000 |
commit | 8a634c1504bc49dc3839e8ee8b31fcd8c0d06e83 (patch) | |
tree | 624aa2e63b23adb54e19121bb17e5c6c24790349 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | bef543635a26ebe96b59a7d3babf344ed264ed9c (diff) | |
download | bcm5719-llvm-8a634c1504bc49dc3839e8ee8b31fcd8c0d06e83.tar.gz bcm5719-llvm-8a634c1504bc49dc3839e8ee8b31fcd8c0d06e83.zip |
Add a defensive check for a nullptr.
llvm-svn: 256012
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c2ec03f34e4..581f2f9fa08 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -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 * |