[Lldb-commits] [PATCH] D61146: Set a CXXRecordDecl to not be passed in registers if DW_CC_pass_by_reference when loading from DWARF
Frederic Riss via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 1 10:24:07 PDT 2019
friss added a comment.
Correct me if I'm wrong, but the test seems overly complicated still. We are testing that we can get the return value of a type that needs to be passed by reference. Calling simple free function `Bounds bounds()` should trigger this code path, shouldn't it? I would be interested to know wether we do the right thing when passing such a struct by value in the source code too as Clang doesn't seem to differentiate return values and arguments. Something like:
// This structure has a non-trivial copy constructor so
// it needs to be passed by reference.
struct PassByRef {
PassByRef() = default;
PassByRef(const PassByRef &p);
int x = 11223344;
};
PassByRef returnPassByRef() { return PassByRef(); }
int takePassByRef(PassByRef p) {
return p.x;
}
int main() {
PassByRef p = returnPassByRef();
p.x = 42;
return takePassByRef(returnPassByRef())' // Break here
}
Break on the return and evaluate `returnPassByRef()` and `takePassByRef(p)`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61146/new/
https://reviews.llvm.org/D61146
More information about the lldb-commits
mailing list