[clang] [llvm] [AllocToken] Propagate !alloc_token through inlined allocation wrappers (PR #198535)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 08:22:20 PDT 2026
https://github.com/vitalybuka commented:
What is expected here?
```
// RUN: %clang_cc1 -O -fsanitize=alloc-token -fsanitize-alloc-token-extended -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t size);
extern void *external_ptr_helper(void);
extern void external_void_helper(void);
__attribute__((malloc, always_inline)) inline void *wrapper(size_t size) {
// These should NOT inherit !alloc_token and should NOT be instrumented
void *p = external_ptr_helper();
external_void_helper();
// This SHOULD inherit !alloc_token and be instrumented
return malloc(size);
}
void *sink;
// CHECK-LABEL: @test_inlined_wrapper(
// CHECK: call ptr @external_ptr_helper()
// CHECK-NOT: __alloc_token_external_ptr_helper
// CHECK: call void @external_void_helper()
// CHECK-NOT: __alloc_token_external_void_helper
// CHECK: call{{.*}} @__alloc_token_malloc
void test_inlined_wrapper(void) {
sink = wrapper(sizeof(int));
}
```
https://github.com/llvm/llvm-project/pull/198535
More information about the llvm-commits
mailing list