DebugInfo: partially revert cleanup committed in r209680
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 27 May 2014 20:20:43 +0000 (20:20 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 27 May 2014 20:20:43 +0000 (20:20 +0000)
I'm not sure exactly where/how we end up with an abstract DbgVariable
with a null DIE, but we do... looking into it & will add a test and/or
fix when I figure it out.

Currently shows up in selfhost or compiler-rt builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209683 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfUnit.cpp

index 4bf0b1878473dacd2dca69599ec31031a76e4070..a70c0f7c11ae428a82796864e8cdf0415d6ce218 100644 (file)
@@ -1781,7 +1781,8 @@ std::unique_ptr<DIE> DwarfUnit::constructVariableDIEImpl(const DbgVariable &DV,
 
   // Define variable debug information entry.
   auto VariableDie = make_unique<DIE>(DV.getTag());
-  if (DbgVariable *AbsVar = DV.getAbstractVariable())
+  DbgVariable *AbsVar = DV.getAbstractVariable();
+  if (AbsVar && AbsVar->getDIE())
     addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, *AbsVar->getDIE());
   else {
     if (!Name.empty())