[PATCH] D112648: [clang-tidy] Improve fix-its for `modernize-pass-by-value` check

Adrian Vogelsgesang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 27 11:58:38 PDT 2021


avogelsgesang created this revision.
Herald added subscribers: carlosgalvezp, xazax.hun.
avogelsgesang requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This commit improves the fix-its of `modernize-pass-by-value` in two ways:

1. No longer propose partial fixes. In the presence of `using`/`typedef`, we failed to rewrite the function signature but still adjusted the function body. This led to incorrect, partial fix-its. Instead, the check now simply doesn't offer any fixes at all in such a situation
2. The check unconditionally added a whitespace after the new type name. This is necessary, e.g., for LLVM's code style where the `&` is directly attached to the variable name. For other code styles, we don't want this whitespace, though. The check now checks if a whitespace is already present and if so doesn't introduce a 2nd duplicated whitespace


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112648

Files:
  clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/modernize-pass-by-value.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112648.382745.patch
Type: text/x-patch
Size: 4519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211027/d099a1cb/attachment.bin>


More information about the cfe-commits mailing list