[PATCH] D41697: [DebugInfo][Metadata] Add support for a DIExpression as 'count' field of DISubrange.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 09:32:40 PST 2018

aprantl added a comment.

First the easy part: Extending DISubrange to support DIExpressions is fine, if we do this, I think that it would be better to also use a DIExpression for constants so we can avoid having two ways of representing the same thing. Writing an autoupgrade for the metadata loader should be trivial. This part LGTM, thanks!

It is unclear to me what the intent of allowing a DIExpression here is: Are you planning to combine a DIExpression with a "count"-variable? DIExpressions can't reference a DIVariable at the moment, DIVariables are an implicit first element of the expression and for this reason a DIExpression can also only reference a single DIVariable. Are you planning to extend DIExpressions to take DIVariables as operands to support your use-case? I'm asking because it would be generally useful to be able to do something like:

  !1 = !DILocalVariable(name: "basepointer")
  !2 = !DILocalVariable(name: "offset")
  !3 = !DIExpression(!1, !2, DW_OP_plus, DW_OP_deref)


More information about the llvm-commits mailing list