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



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to