[clang] [clang] Add new warning: not eliding copy on return (missed NRVO) (PR #139973)

2025-05-16 Thread Grigory Pastukhov via cfe-commits
grigorypas wrote: @mizvekov Could you please merge if it is good to go? I don't have write access. https://github.com/llvm/llvm-project/pull/139973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [clang] Add new warning: not eliding copy on return (missed NRVO) (PR #139973)

2025-05-14 Thread Grigory Pastukhov via cfe-commits
https://github.com/grigorypas created https://github.com/llvm/llvm-project/pull/139973 This PR aims at adding warning similar to the one in GCC (-Wnrvo) that targets missed opportunities for Named Return Value Optimization (NRVO). The warning is not enabled by default. cc: @WenleiHe

[clang] [clang] Add new warning: not eliding copy on return (missed NRVO) (PR #139973)

2025-05-15 Thread Grigory Pastukhov via cfe-commits
https://github.com/grigorypas updated https://github.com/llvm/llvm-project/pull/139973 Rate limit ยท GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [clang] Add new warning: not eliding copy on return (missed NRVO) (PR #139973)

2025-05-15 Thread Grigory Pastukhov via cfe-commits
grigorypas wrote: > Can you also include a few tests which show whether we suppress the warning > on disabled branches of an 'if constexpr'? > > Beware we also have bugs and odd cases in this area: > > * It should be possible to NRVO a variable which you don't actually return, > by retuning i