brintos

brintos / llvm-project-archived public Read only

0
0
Text · 888 B · aa3b24f Raw
26 lines · cpp
1// Check that user may include MemProf interface header.2// Also check that interfaces declared in the sanitizer's allocator_interface3// are defined for MemProf.4// RUN: %clangxx_memprof %s -o %t -DMEMPROF && %run %t5// RUN: %clangxx_memprof -x c %s -o %t -DMEMPROF && %run %t6// RUN: %clang %s -pie -o %t && %run %t7// RUN: %clang -x c %s -pie -o %t && %run %t8#include <sanitizer/allocator_interface.h>9#include <sanitizer/memprof_interface.h>10#include <stdlib.h>11 12int main() {13  int *p = (int *)malloc(10 * sizeof(int));14#ifdef MEMPROF15  __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#endif24  return 0;25}26