Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / memprof / TestCases / interface_test.cpp
blobaa3b24fa4c640b6ed42399d90a4d2e04fad8fb82
1 // Check that user may include MemProf interface header.
2 // Also check that interfaces declared in the sanitizer's allocator_interface
3 // are defined for MemProf.
4 // RUN: %clangxx_memprof %s -o %t -DMEMPROF && %run %t
5 // RUN: %clangxx_memprof -x c %s -o %t -DMEMPROF && %run %t
6 // RUN: %clang %s -pie -o %t && %run %t
7 // RUN: %clang -x c %s -pie -o %t && %run %t
8 #include <sanitizer/allocator_interface.h>
9 #include <sanitizer/memprof_interface.h>
10 #include <stdlib.h>
12 int main() {
13 int *p = (int *)malloc(10 * sizeof(int));
14 #ifdef MEMPROF
15 __sanitizer_get_estimated_allocated_size(8);
16 __sanitizer_get_ownership(p);
17 __sanitizer_get_allocated_size(p);
18 __sanitizer_get_current_allocated_bytes();
19 __sanitizer_get_heap_size();
20 __sanitizer_get_free_bytes();
21 __sanitizer_get_unmapped_bytes();
22 // malloc and free hooks are tested by the malloc_hook.cpp test.
23 #endif
24 return 0;