diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 1af4b643eb178..0fc7aa7bccf3d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -136,10 +136,13 @@ class DbgVariable : public DbgEntity { DbgVariable(const DILocalVariable *V, const DILocation *IA) : DbgEntity(V, IA, DbgVariableKind) {} + bool isInitialized() const { + return !FrameIndexExprs.empty() || ValueLoc; + } + /// Initialize from the MMI table. void initializeMMI(const DIExpression *E, int FI) { - assert(FrameIndexExprs.empty() && "Already initialized?"); - assert(!ValueLoc.get() && "Already initialized?"); + assert(!isInitialized() && "Already initialized?"); assert((!E || E->isValid()) && "Expected valid expression"); assert(FI != std::numeric_limits::max() && "Expected valid index"); @@ -149,8 +152,7 @@ class DbgVariable : public DbgEntity { // Initialize variable's location. void initializeDbgValue(DbgValueLoc Value) { - assert(FrameIndexExprs.empty() && "Already initialized?"); - assert(!ValueLoc && "Already initialized?"); + assert(!isInitialized() && "Already initialized?"); assert(!Value.getExpression()->isFragment() && "Fragments not supported."); ValueLoc = std::make_unique(Value);