[PATCH] D97311: [DebugInfo] Introduce DIConstant metadata for representing named constants

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 17:23:29 PST 2021


aprantl added a comment.

Yeah that's just because

`void DwarfCompileUnit::addLocationAttribute()`

checks for

`    if (GlobalExprs.size() == 1 && Expr && Expr->isConstant()) {`

and

  bool DIExpression::isConstant() const {
    // Recognize DW_OP_constu C DW_OP_stack_value (DW_OP_LLVM_fragment Len Ofs)?.
    if (getNumElements() != 3 && getNumElements() != 6)
      return false;
    if (getElement(0) != dwarf::DW_OP_constu ||
        getElement(2) != dwarf::DW_OP_stack_value)
      return false;
    if (getNumElements() == 6 && getElement(3) != dwarf::DW_OP_LLVM_fragment)
      return false;
    return true;
  }

We could probably just make `addLocationAttribute()` also accept `DIExpression::isSignedConstant()` and handle that appropriately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97311/new/

https://reviews.llvm.org/D97311



More information about the llvm-commits mailing list