blob: 451ab57b8f643248d312c34091be2b51fbaad320 [file] [log] [blame]
// Check that user may include MemProf interface header.
// Also check that interfaces declared in the sanitizer's allocator_interface
// are defined for MemProf.
// RUN: %clang_memprof %s -o %t -DMEMPROF && %run %t
// RUN: %clang_memprof -x c %s -o %t -DMEMPROF && %run %t
// RUN: %clang %s -pie -o %t && %run %t
// RUN: %clang -x c %s -pie -o %t && %run %t
#include <sanitizer/allocator_interface.h>
#include <sanitizer/memprof_interface.h>
#include <stdlib.h>
int main() {
int *p = (int *)malloc(10 * sizeof(int));
#ifdef MEMPROF
__sanitizer_get_estimated_allocated_size(8);
__sanitizer_get_ownership(p);
__sanitizer_get_allocated_size(p);
__sanitizer_get_current_allocated_bytes();
__sanitizer_get_heap_size();
__sanitizer_get_free_bytes();
__sanitizer_get_unmapped_bytes();
// malloc and free hooks are tested by the malloc_hook.cpp test.
#endif
return 0;
}