summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit19a8b90763995b18552ea9841e3b2be9bf3a96ac (patch)
treec78e5574e9b6f05454b1a12273dea67f89cc4993 /llvm/lib/CodeGen
parenta2d602560beb335cd443ccc03a41ecf714f337bb (diff)
downloadbcm5719-llvm-19a8b90763995b18552ea9841e3b2be9bf3a96ac.tar.gz
bcm5719-llvm-19a8b90763995b18552ea9841e3b2be9bf3a96ac.zip
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... llvm-svn: 210143
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index fddc7fa137f..2325ab8444e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/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())
OpenPOWER on IntegriCloud