DebugInfo: Simplify/narrow null-check for getOrCreateType
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 14 Nov 2013 22:25:02 +0000 (22:25 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 14 Nov 2013 22:25:02 +0000 (22:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

index 857b41415ab3fda6a17f9bbeda4cd24b2422fabc..44706d7647d382c6aa4dbfcb4a2cf665b32c0bb1 100644 (file)
@@ -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()));