1 // RUN: %check_clang_tidy %s cppcoreguidelines-no-malloc %t \ 2 // RUN: -config='{CheckOptions: \ 3 // RUN: [{key: cppcoreguidelines-no-malloc.Allocations, value: "::malloc"},\ 4 // RUN: {key: cppcoreguidelines-no-malloc.Reallocations, value: ""},\ 5 // RUN: {key: cppcoreguidelines-no-malloc.Deallocations, value: ""}]}' \ 6 // RUN: -- 7 8 // Just ensure, the check will not crash, when no functions shall be checked. 9 10 using size_t = __SIZE_TYPE__; 11 12 void *malloc(size_t size); 13 14 void malloced_array() { 15 int *array0 = (int *)malloc(sizeof(int) * 20); 16 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc] 17 } 18