No need to spell out \brief. LLVM uses autobrief in the doxygen settings.
this comment should go into the header instead.
This is for the backend to decide and discard. We shouldn't have any DWARF version specific code here. (E.g.: what if we generate CodeView debug info?)
After landing https://reviews.llvm.org/D31439, DwarfExpression can actually drop locations that can not be expressed in the requested DWARF version.
Okay then I think there should be an assert(AddrDispShift != 0 && "...") here to make sure we change the ?: condition should this ever change in the future.
Are you sure you want the DW_OP_stack_value at position 0? Shouldn't it go either at the end of the expression or just before a DW_OP_llvm_fragment operation?
I think I would prefer std::next() over the +1.