brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 954e6e5 Raw
28 lines · c
1// Test AllocToken respects ignorelist for functions and files.2//3// RUN: %clang_cc1 -fsanitize=alloc-token -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-ALLOW4//5// RUN: echo "fun:excluded_by_all" > %t.func.ignorelist6// RUN: %clang_cc1 -fsanitize=alloc-token -fsanitize-ignorelist=%t.func.ignorelist -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FUN7//8// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t.file.ignorelist9// RUN: %clang_cc1 -fsanitize=alloc-token -fsanitize-ignorelist=%t.file.ignorelist -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SRC10 11extern void* malloc(unsigned long size);12 13// CHECK-LABEL: define{{.*}} @excluded_by_all(14void* excluded_by_all(unsigned long size) {15    // CHECK-ALLOW: call ptr @__alloc_token_malloc(16    // CHECK-FUN: call ptr @malloc(17    // CHECK-SRC: call ptr @malloc(18    return malloc(size);19}20 21// CHECK-LABEL: define{{.*}} @excluded_by_src(22void* excluded_by_src(unsigned long size) {23    // CHECK-ALLOW: call ptr @__alloc_token_malloc(24    // CHECK-FUN: call ptr @__alloc_token_malloc(25    // CHECK-SRC: call ptr @malloc(26    return malloc(size);27}28