Changes
Summary
- [llvm-c-test] Make include-all.c do what its name says it does The purpose of this file is to make sure that all includes in llvm-c works when included from a C source file (i.e no C++isms sneaked in). To do this it must actually include all the include files. Reviewed By: whitequark Differential Revision: https://reviews.llvm.org/D61567
Change Type | Path in Repository | Path in Workspace |
---|---|---|
![]() | /llvm/trunk/tools/llvm-c-test/include-all.c | trunk/tools/llvm-c-test/include-all.c |
Summary
- [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
Change Type | Path in Repository | Path in Workspace |
---|---|---|
![]() | /clang-tools-extra/trunk/clang-tidy/bugprone/SizeofExpressionCheck.cpp | trunk/clang-tidy/bugprone/SizeofExpressionCheck.cpp |
![]() | /clang-tools-extra/trunk/test/clang-tidy/bugprone-sizeof-expression.cpp | trunk/test/clang-tidy/bugprone-sizeof-expression.cpp |