<commit_before>// RUN: %clangxx_asan -O2 %s -o %t
// RUN: %t 2>&1 | FileCheck %s
#include <stdio.h>
#include <stdlib.h>

extern "C" {
// Note: avoid calling functions that allocate memory in malloc/free
// to avoid infinite recursion.
void __asan_malloc_hook(void *ptr, size_t sz) { puts("MallocHook"); }
void __asan_free_hook(void *ptr) {  puts("FreeHook"); }
}  // extern "C"

int main() {
  volatile int *x = new int;
  // CHECK: MallocHook
  *x = 0;
  delete x;
  // CHECK: FreeHook
  return 0;
}<commit_msg>[ASan] use write instead of puts in malloc hooks test for ASan, as puts calls malloc on Mac<commit_after>// RUN: %clangxx_asan -O2 %s -o %t
// RUN: %t 2>&1 | FileCheck %s
#include <stdlib.h>
#include <unistd.h>

extern "C" {
// Note: avoid calling functions that allocate memory in malloc/free
// to avoid infinite recursion.
void __asan_malloc_hook(void *ptr, size_t sz) {
  write(1, "MallocHook\n", sizeof("MallocHook\n"));
}
void __asan_free_hook(void *ptr) {
  write(1, "FreeHook\n", sizeof("FreeHook\n"));
}
}  // extern "C"

int main() {
  volatile int *x = new int;
  // CHECK: MallocHook
  *x = 0;
  delete x;
  // CHECK: FreeHook
  return 0;
}
{'fraction_non_alphanumeric': 0.15549828178694158, 'fraction_numerical': 0.010309278350515464, 'mean_word_length': 3.6047430830039526, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4102395', 'n_tokens_mistral': 460, 'n_tokens_neox': 431, 'n_words': 141}