summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-c-test
diff options
context:
space:
mode:
authorAdam Balogh <adam.balogh@ericsson.com>2019-05-06 10:41:37 +0000
committerAdam Balogh <adam.balogh@ericsson.com>2019-05-06 10:41:37 +0000
commit62468003ef97cdf4ea47b8646fe76bc33dfc073a (patch)
treef8fc3d61025df93c62380cb3eb248a1575f600cd /llvm/tools/llvm-c-test
parent97fbc2abfeceabf05cc339b5079d96f25fa380d7 (diff)
downloadbcm5719-llvm-62468003ef97cdf4ea47b8646fe76bc33dfc073a.tar.gz
bcm5719-llvm-62468003ef97cdf4ea47b8646fe76bc33dfc073a.zip
[clang-tidy] Extend bugprone-sizeof-expression check to detect sizeof misuse in pointer arithmetic
Some programmers tend to forget that subtracting two pointers results in the difference between them in number of elements of the pointee type instead of bytes. This leads to codes such as `size_t size = (p - q) / sizeof(int)` where `p` and `q` are of type `int*`. Or similarily, `if (p - q < buffer_size * sizeof(int)) { ... }`. This patch extends `bugprone-sizeof-expression` to detect such cases. Differential Revision: https://reviews.llvm.org/D61422 llvm-svn: 360032
Diffstat (limited to 'llvm/tools/llvm-c-test')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud