brintos

brintos / llvm-project-archived public Read only

0
0
Text · 753 B · 5cbbf9f Raw
33 lines · c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc -Wno-incompatible-library-redeclaration -verify %s2 3// Various tests to make the analyzer is robust against custom4// 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-diagnostics10 11char alloca(void);12char malloc(void);13char realloc(void);14char kmalloc(void);15char valloc(void);16char calloc(void);17 18char free(void);19char kfree(void);20 21void testCustomArgumentlessAllocation(void) {22  alloca(); // no-crash23  malloc(); // no-crash24  realloc(); // no-crash25  kmalloc(); // no-crash26  valloc(); // no-crash27  calloc(); // no-crash28 29  free(); // no-crash30  kfree(); // no-crash31}32 33