blob: 053d0ee31ca89bd10c229d923f8ea64763e6ffc8 [file] [log] [blame]
Dominic Chen184c6242017-03-03 18:02:02 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -Wno-incompatible-library-redeclaration -verify %s
Devin Coughlin684d19d2016-10-16 22:19:03 +00002
Hiroshi Inoue56939f72018-01-22 07:44:38 +00003// Various tests to make the analyzer is robust against custom
Devin Coughlin684d19d2016-10-16 22:19:03 +00004// redeclarations of memory routines.
5//
6// You wouldn't expect to see much of this in normal code, but, for example,
7// CMake tests can generate these.
8
9// expected-no-diagnostics
10
11char alloca();
12char malloc();
13char realloc();
14char kmalloc();
15char valloc();
16char calloc();
17
18char free();
19char kfree();
20
21void testCustomArgumentlessAllocation() {
22 alloca(); // no-crash
23 malloc(); // no-crash
24 realloc(); // no-crash
25 kmalloc(); // no-crash
26 valloc(); // no-crash
27 calloc(); // no-crash
28
29 free(); // no-crash
30 kfree(); // no-crash
31}
32