r256012 - Add a defensive check for a nullptr.
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 18 11:44:31 PST 2015
Author: adrian
Date: Fri Dec 18 13:44:31 2015
New Revision: 256012
URL: http://llvm.org/viewvc/llvm-project?rev=256012&view=rev
Log:
Add a defensive check for a nullptr.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=256012&r1=256011&r2=256012&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 18 13:44:31 2015
@@ -3443,11 +3443,13 @@ void CGDebugInfo::EmitUsingDecl(const Us
}
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 *
More information about the cfe-commits
mailing list