diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-26 18:17:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-26 18:17:04 +0000 |
commit | e42805d07c4540826bebebb532fb31d6dc97020f (patch) | |
tree | d06842c92b6ed68d8732bad3dfb0e22d62701f3b /llvm/lib/CodeGen/AsmPrinter | |
parent | 6bb5a41f99445a9c067a699028d0d62a89953d12 (diff) | |
download | bcm5719-llvm-e42805d07c4540826bebebb532fb31d6dc97020f.tar.gz bcm5719-llvm-e42805d07c4540826bebebb532fb31d6dc97020f.zip |
Fix a bug that prevents global variables from having a DW_OP_deref.
For local variables the first DW_OP_deref is consumed by turning the
location kind into a memeory location, but that only makes sense for
values that are in a register to begin with, which cannot happen for
global variables that are attached to a symbol.
rdar://problem/39741860
llvm-svn: 330970
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 2eb0157f1e0..d893db42006 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -230,8 +230,9 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( addOpAddress(*Loc, Sym); } } - if (Expr) - DwarfExpr->addExpression(Expr); + // Global variables attached to symbols are memory locations. + DwarfExpr->setMemoryLocationKind(); + DwarfExpr->addExpression(Expr); } if (Loc) addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize()); |