// Check that the alloc_size attribute is propagated to the call instruction
// for both direct and indirect calls
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm %s -o - 2>&1 | FileCheck %s
int gi;
typedef unsigned long size_t;
extern void *;
extern void *;
// CHECK-LABEL: @call_direct
void
extern void *;
extern void *;
// CHECK-LABEL: @call_function_pointer
void
typedef void *;
typedef void *;
extern my_malloc_fn_pointer_type malloc_function_pointer_with_typedef;
extern my_calloc_fn_pointer_type calloc_function_pointer_with_typedef;
// CHECK-LABEL: @call_function_pointer_typedef
void
// CHECK: attributes [[DIRECT_MALLOC_ATTR]] = { allocsize(0) }
// CHECK: attributes [[DIRECT_CALLOC_ATTR]] = { allocsize(0,1) }
// CHECK: attributes [[INDIRECT_MALLOC_ATTR]] = { allocsize(1) }
// CHECK: attributes [[INDIRECT_CALLOC_ATTR]] = { allocsize(1,2) }
// CHECK: attributes [[INDIRECT_TYPEDEF_MALLOC_ATTR]] = { allocsize(2) }
// CHECK: attributes [[INDIRECT_TYPEDEF_CALLOC_ATTR]] = { allocsize(2,3) }