https://github.com/steakhal requested changes to this pull request.
My gut instinct is that it is a lot more difficult to implement this *right*. A couple edge-cases that inhibit copy elision: - `return std::move(Obj)` - here the std::move inhibits copy elision - Multiple return paths (using `if` or a ternary expr) that return different variables - Returning function parameters - they can't be elided. - Returning global or local static variables. I think we should at least demonstrate these cases in tests because I think the current approach will not properly align on the expected behavior. Of course, we can tradeoff correctness for simplicity- but I'll let you make that tradeoff. Maybe you could ask an agent to look into how copy-elision is lowered to codegen (llvm-ir) and try to mimic it in this checker. I think it should do a pretty good job. https://github.com/llvm/llvm-project/pull/200481 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
