Skip to content

Commit 9086590

Browse files
authored
[clang][analyzer] Remove checker 'alpha.core.CastSize' (#156350)
1 parent 7ac3e52 commit 9086590

File tree

11 files changed

+1
-453
lines changed

11 files changed

+1
-453
lines changed

clang/docs/analyzer/checkers.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,18 +2932,6 @@ the locking/unlocking of ``mtx_t`` mutexes.
29322932
mtx_lock(&mtx1); // warn: This lock has already been acquired
29332933
}
29342934
2935-
.. _alpha-core-CastSize:
2936-
2937-
alpha.core.CastSize (C)
2938-
"""""""""""""""""""""""
2939-
Check when casting a malloc'ed type ``T``, whether the size is a multiple of the size of ``T``.
2940-
2941-
.. code-block:: c
2942-
2943-
void test() {
2944-
int *x = (int *) malloc(11); // warn
2945-
}
2946-
29472935
.. _alpha-core-CastToStruct:
29482936
29492937
alpha.core.CastToStruct (C, C++)

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ def BoolAssignmentChecker : Checker<"BoolAssignment">,
257257
HelpText<"Warn about assigning non-{0,1} values to Boolean variables">,
258258
Documentation<HasDocumentation>;
259259

260-
def CastSizeChecker : Checker<"CastSize">,
261-
HelpText<"Check when casting a malloc'ed type T, whether the size is a "
262-
"multiple of the size of T">,
263-
Documentation<HasDocumentation>;
264-
265260
def CastToStructChecker : Checker<"CastToStruct">,
266261
HelpText<"Check for cast from non-struct pointer to struct pointer">,
267262
Documentation<HasDocumentation>;

clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ add_clang_library(clangStaticAnalyzerCheckers
1717
CStringChecker.cpp
1818
CStringSyntaxChecker.cpp
1919
CallAndMessageChecker.cpp
20-
CastSizeChecker.cpp
2120
CastToStructChecker.cpp
2221
CastValueChecker.cpp
2322
CheckObjCDealloc.cpp

clang/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp

Lines changed: 0 additions & 155 deletions
This file was deleted.

clang/test/Analysis/castsize.c

Lines changed: 0 additions & 26 deletions
This file was deleted.

clang/test/Analysis/malloc-annotations.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: -Wno-alloc-size \
33
// RUN: -analyzer-checker=core \
44
// RUN: -analyzer-checker=alpha.deadcode.UnreachableCode \
5-
// RUN: -analyzer-checker=alpha.core.CastSize \
65
// RUN: -analyzer-checker=unix.Malloc \
76
// RUN: -analyzer-checker=debug.ExprInspection \
87
// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true %s
@@ -221,15 +220,6 @@ void f7_realloc(void) {
221220
x[0] = 'a'; // expected-warning{{Use of memory after it is released}}
222221
}
223222

224-
void PR6123(void) {
225-
int *x = malloc(11); // expected-warning{{Cast a region whose size is not a multiple of the destination type size}}
226-
}
227-
228-
void PR7217(void) {
229-
int *buf = malloc(2); // expected-warning{{Cast a region whose size is not a multiple of the destination type size}}
230-
buf[1] = 'c'; // not crash
231-
}
232-
233223
void mallocCastToVoid(void) {
234224
void *p = malloc(2);
235225
const void *cp = p; // not crash

clang/test/Analysis/malloc-annotations.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// RUN: %clang_analyze_cc1 -verify \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-checker=alpha.deadcode.UnreachableCode \
4-
// RUN: -analyzer-checker=alpha.core.CastSize \
54
// RUN: -analyzer-checker=unix.Malloc \
65
// RUN: -analyzer-config unix.DynamicMemoryModeling:Optimistic=true %s
76

0 commit comments

Comments
 (0)