[PATCH] D75041: [WIP][clang-tidy] Approximate implicit conversion issues for the 'cppcoreguidelines-avoid-adjacent-arguments-of-same-type' check
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 05:01:36 PST 2020
whisperity created this revision.
whisperity added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, martong, gamesh411, Szelethus, dkrupp, rnkovacs, kbarton, xazax.hun, nemanjai.
Herald added a project: clang.
whisperity added a parent revision: D69560: [clang-tidy] Add 'cppcoreguidelines-avoid-adjacent-arguments-of-same-type' check.
Herald added a subscriber: wuzish.
whisperity planned changes to this revision.
This patch adds an optional modelling of implicit conversions to the `cppcoreguidelines-avoid-adjacent-arguments-of-same-type` check. This will allow also diagnosing functions such as `void f(int i, double d);` to have a mix-up chance, i.e. `f(double_var, int_var);`. User-defined conversions are also attempted and supported.
Unfortunately, there isn't a sensible way (at least I found none) to ask `Sema` at //"frontend time"// whether or not the two args could be implicitly converted between one another, as we do not have the `Sema` instance anymore. Hence there is extra work done here to model the conversions - we believe the check's code under-approximates the real issue, but the current findings are valid semantically.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75041
Files:
clang-tools-extra/clang-tidy/cppcoreguidelines/AdjacentArgumentsOfSameTypeCheck.cpp
clang-tools-extra/clang-tidy/cppcoreguidelines/AdjacentArgumentsOfSameTypeCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-adjacent-arguments-of-same-type.rst
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type-cvr-on.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type-default.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type-implicits.c
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type-implicits.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type-verbose.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-avoid-adjacent-arguments-of-same-type.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75041.246182.patch
Type: text/x-patch
Size: 92195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200224/1717cc9c/attachment-0001.bin>
More information about the cfe-commits
mailing list