[llvm] r194737 - DebugInfo: Simplify/narrow null-check for getOrCreateType

David Blaikie dblaikie at gmail.com
Thu Nov 14 14:25:02 PST 2013


Author: dblaikie
Date: Thu Nov 14 16:25:02 2013
New Revision: 194737

URL: http://llvm.org/viewvc/llvm-project?rev=194737&view=rev
Log:
DebugInfo: Simplify/narrow null-check for getOrCreateType

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=194737&r1=194736&r2=194737&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Nov 14 16:25:02 2013
@@ -877,10 +877,12 @@ DIE *CompileUnit::getOrCreateContextDIE(
 /// 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()));





More information about the llvm-commits mailing list