From 41e1a18885b8ef29219b7102ad25cd480c4a3f55 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 14 Nov 2013 22:25:02 +0000 Subject: [PATCH] DebugInfo: Simplify/narrow null-check for getOrCreateType git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194737 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 857b41415ab..44706d7647d 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -877,10 +877,12 @@ DIE *CompileUnit::getOrCreateContextDIE(DIScope Context) { /// getOrCreateTypeDIE - Find existing DIE or create new DIE for the /// given DIType. DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) { - DIType Ty(TyNode); - if (!Ty.isType()) + if (!TyNode) return NULL; + DIType Ty(TyNode); + assert(Ty.isType()); + // Construct the context before querying for the existence of the DIE in case // such construction creates the DIE. DIE *ContextDIE = getOrCreateContextDIE(resolve(Ty.getContext()));