Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | [Diagnostics] Refactor code for -Wsizeof-pointer-div, catch more cases; also ↵ | David Bolvansky | 2019-09-06 | 1 | -8/+10 |
| | | | | | | | | | | | | | | | | add -Wsizeof-array-div Previously, -Wsizeof-pointer-div failed to catch: const int *r; sizeof(r) / sizeof(int); Now fixed. Also introduced -Wsizeof-array-div which catches bugs like: sizeof(r) / sizeof(short); (Array element type does not match type of sizeof operand). llvm-svn: 371222 | ||||
* | [Diagnostics] Improve -Wsizeof-pointer-div | David Bolvansky | 2019-08-18 | 1 | -8/+16 |
| | | | | | | | Emit diag note with a location of pointer declaration. Revisited/added tests. llvm-svn: 369206 | ||||
* | [Diagnostics] Implement -Wsizeof-pointer-div | David Bolvansky | 2018-11-01 | 1 | -0/+28 |
Summary: void test(int *arr) { int arr_len = sizeof(arr) / sizeof(*arr); // warn, incorrect way to compute number of array elements } Enabled under -Wall (same behaviour as GCC) Reviewers: rsmith, MTC, aaron.ballman Reviewed By: aaron.ballman Subscribers: MTC, thakis, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D52949 llvm-svn: 345847 |