diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 2eb0157f1e0..4a5c7b324d6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -230,8 +230,13 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( addOpAddress(*Loc, Sym); } } - if (Expr) - DwarfExpr->addExpression(Expr); + // Global variables attached to symbols are memory locations. + // It would be better if this were unconditional, but malformed input that + // mixes non-fragments and fragments for the same variable is too expensive + // to detect in the verifier. + if (!DwarfExpr->isMemoryLocation()) + DwarfExpr->setMemoryLocationKind(); + DwarfExpr->addExpression(Expr); } if (Loc) addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize()); |

