Debian Codegraph @

llvm-project/llvm/projects/opencl-clang/tests/Manual/testsuite/backslash-escape-option.cl

raw
1 // RUN: %occ-cli %s --cl-options="-DTYPE=int -DSTRING=\"%d\\n\"" --cl-device=%cl_device %cfg_path --output=%t.bc
2 // RUN: llvm-dis < %t.bc | FileCheck %s
3
4 // Regression test: quoted_tokenize() must not drop a backslash that
5 // does not escape a quote, itself, or a delimiter. A macro value such
6 // as "%d\n" was previously tokenized to "%dn", losing the newline.
7
8 // CHECK: @.str = {{.*}}constant {{.*}} c"%d\0A\00"
9
10 #define AS_STRING(s) AS_STRING_(s)
11 #define AS_STRING_(s) #s
12
13 kernel void test_printf_arguments(global const TYPE *input) {
14 const int gid = get_global_id(0);
15 TYPE i = input[gid];
16 printf(AS_STRING(STRING), i);
17 }