[PATCH] D125402: [clang][diag] warn if function returns class type by-const-value
Namgoo Lee via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 11 10:15:27 PDT 2022
nlee created this revision.
nlee added a reviewer: lattner.
Herald added a project: All.
nlee requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Returning class or struct by value with const qualifier should be avoided since it prevents move semantics.
clang-tidy has readability-const-return-type that catches this case, but it also impacts move semantics, not just readability.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125402
Files:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaType.cpp
clang/test/Misc/warning-wall.c
clang/test/SemaCXX/warn-return-by-const-value.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125402.428688.patch
Type: text/x-patch
Size: 3658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220511/fb9303e9/attachment.bin>
More information about the cfe-commits
mailing list