From 3edc63a579b462ad6ce0d82395042f0d7c7f28d6 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 4 May 2018 16:10:43 +0000 Subject: DwarfCompileUnit: Fix another assertion failure on malformed input that is not rejected by the Verifier. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Björn Pettersson for providing a reproducer! llvm-svn: 331535 --- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 4a5c7b324d6..32b6657c2fd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -234,7 +234,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( // 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()) + if (DwarfExpr->isUnknownLocation()) DwarfExpr->setMemoryLocationKind(); DwarfExpr->addExpression(Expr); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h index 7d6d45e64d6..952b0d99a95 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -212,6 +212,7 @@ public: void addUnsignedConstant(const APInt &Value); bool isMemoryLocation() const { return LocationKind == Memory; } + bool isUnknownLocation() const { return LocationKind == Unknown; } /// Lock this down to become a memory location description. void setMemoryLocationKind() { -- cgit v1.2.3