DebugInfo: Don't call DIBuilder::retainType(nullptr)

An upcoming LLVM commit will make calling
`DIBuilder::retainType(nullptr)` illegal (actually, it already was, but
it wasn't verified).  Check for null before calling.

This triggered in test/CodeGenObjC/debug-info-block-helper.m.

llvm-svn: 233443
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-27 22:58:05 +00:00
parent d5c60d032f
commit 5043f91657
1 changed files with 4 additions and 3 deletions

View File

@ -3432,7 +3432,8 @@ void CGDebugInfo::finalize() {
void CGDebugInfo::EmitExplicitCastType(QualType Ty) {
if (CGM.getCodeGenOpts().getDebugInfo() < CodeGenOptions::LimitedDebugInfo)
return;
llvm::DIType DieTy = getOrCreateType(Ty, getOrCreateMainFile());
// Don't ignore in case of explicit cast where it is referenced indirectly.
DBuilder.retainType(DieTy);
if (llvm::DIType DieTy = getOrCreateType(Ty, getOrCreateMainFile()))
// Don't ignore in case of explicit cast where it is referenced indirectly.
DBuilder.retainType(DieTy);
}