[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Frontend / source-col-map.c
blob20030a28f5c19a70b0c6bf32b1aa484190e78fe6
1 // RUN: not %clang_cc1 -fsyntax-only -fno-diagnostics-show-line-numbers -fmessage-length=75 -o /dev/null -x c < %s 2>&1 | FileCheck %s -strict-whitespace
2 // REQUIRES: utf8-capable-terminal
4 // Test case for the text diagnostics source column conversion crash.
6 // This test case tries to check the error diagnostic message printer, which is
7 // responsible to create the code snippet shorter than the message-length (in
8 // number of columns.)
9 //
10 // The error diagnostic message printer should be able to handle the non-ascii
11 // characters without any segmentation fault or assertion failure. If your
12 // changes to clang frontend crashes this case, it is likely that you are mixing
13 // column index with byte index which are two totally different concepts.
15 // NOTE: This file is encoded in UTF-8 and intentionally contains some
16 // non-ASCII characters.
18 __attribute__((format(printf, 1, 2)))
19 extern int printf(const char *fmt, ...);
21 void test1(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα
22 // CHECK: unknown type name 'Unknown'
23 // CHECK-NEXT: void test1(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα ααα...
24 // CHECK-NEXT: {{^ \^$}}
26 void test2(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα
28 // CHECK: unknown type name 'Unknown'
29 // CHECK-NEXT: void test2(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα
30 // CHECK-NEXT: {{^ \^$}}
32 void test3() {
33 /* αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s");
35 // CHECK: format specifies type 'int' but the argument has
36 // CHECK: type 'char *'
37 // CHECK-NEXT: ...αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s");
38 // CHECK-NEXT: {{^ ~~ \^~~$}}
39 // CHECK-NEXT: {{^ %s$}}