[PATCH] D106361: [clang-tidy] Fix crash and handle AttributedTypes in 'bugprone-easily-swappable-parameters'

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 20 07:10:17 PDT 2021


whisperity created this revision.
whisperity added reviewers: aaron.ballman, vabridgers.
whisperity added a project: clang-tools-extra.
Herald added subscribers: martong, gamesh411, Szelethus, rnkovacs, xazax.hun.
whisperity requested review of this revision.
Herald added a subscriber: cfe-commits.

A downstream user identified a way to crash the check by running on code that involve `AttributedType`s. This patch fixes the check to first and foremost not crash, but also improves the logic handling qualifiers.

If the types contain any additional (not just CVR) qualifiers that are not the same, they will not be deemed mixable. The logic for CVR mixing, and the **`QualifiersMix`** check option remain unchanged.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106361

Files:
  clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-len2.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-qualifiermixing.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106361.360113.patch
Type: text/x-patch
Size: 29024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210720/28b8c786/attachment-0001.bin>


More information about the cfe-commits mailing list