summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-06-04 01:30:59 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-06-04 01:30:59 +0000
commit5c0b13f3be07853f33cee92edbd7277389ae196e (patch)
tree9b915b761bd055fc2bd65e6341321d8da832dc12 /lib/CodeGen/AsmPrinter
parent1b68686365927cd9915406b91c8d3380d747c600 (diff)
downloadllvm-5c0b13f3be07853f33cee92edbd7277389ae196e.tar.gz
llvm-5c0b13f3be07853f33cee92edbd7277389ae196e.tar.bz2
llvm-5c0b13f3be07853f33cee92edbd7277389ae196e.tar.xz
DebugInfo: Partial revert r209984 due to more cases where abstract DbgVariables do not have associated DIEs.
Along with a test case to demonstrate that due to inlining order there are cases where abstract variable DIEs are not constructed since the abstract subprogram was built due to a previous inlining that optimized away those variables. This produces incorrect debug info (the 'missing' abstract variable causes the inlined instance of that variable to be emitted with a full description (name, line, file) rather than referencing the abstract origin), but this commit at least ensures that it doesn't crash... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfUnit.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index fddc7fa137..2325ab8444 100644
--- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1781,7 +1781,11 @@ 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();
+ // FIXME: any missing abstract variable missing a DIE will result in incorrect
+ // DWARF. More details in test/DebugInfo/missing-abstract-variable.ll for an
+ // example of why this is happening.
+ if (AbsVar && AbsVar->getDIE())
addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin, *AbsVar->getDIE());
else {
if (!Name.empty())