[Lldb-commits] [PATCH] D81471: [lldb] Add support for using integral const static data members in the expression evaluator

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 6 04:23:09 PDT 2022


labath added a comment.

My only complaint is about the restriction in CanTakeAddressOfLValue. It seems arbitrary. There's anything in C++ or DWARF that would prevent us from having constant-valued variables of class types. It's just that clang/llvm does not know how to emit the DW_AT_const_value for such variables (yet). Gcc does not seem to have that problem (it happily emits a block form for those). So, it feels to me this is just kicking the can down the road, and we will sooner or later need to come up with a better story for this.

I guess the condition we really want to express here is "does this expression refer to a constexpr variable (ideally one without a location)"? And the problem is that clang does not give us the means to detect that?

Is that really the case? Would it maybe be possible to use some c++ magic to get clang to do that for us. Write something like `if constexpr (__builtin_constant_p(user_expression)) do_something_rvalue_like(); else assume_regular_lvalue();` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81471



More information about the lldb-commits mailing list