[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
Tue Jun 14 20:21:49 PDT 2022


nlee updated this revision to Diff 437011.
nlee added a comment.

Warn if:

- It is an assignment expression AND
- RHS is a function call expression AND
- The function returns by-const-value of a class or struct type AND
- The class or struct has non-trivial move assignment operator

Removed `default-ignore` flag and `make check-clang` passes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125402/new/

https://reviews.llvm.org/D125402

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/Misc/warning-wall.c
  clang/test/SemaCXX/warn-pessimizing-return-by-const.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125402.437011.patch
Type: text/x-patch
Size: 11266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220615/b1c0dce0/attachment.bin>


More information about the cfe-commits mailing list