1*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 %s -fsyntax-only -fmessage-length 75 -o /dev/null 2>&1 | FileCheck %s -strict-whitespace 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc // Test case for the text diagnostics source column conversion crash. 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel Sambuc // This test case tries to check the error diagnostic message printer, which is 6*0a6a1f1dSLionel Sambuc // responsible to create the code snippet shorter than the message-length (in 7*0a6a1f1dSLionel Sambuc // number of columns.) 8*0a6a1f1dSLionel Sambuc // 9*0a6a1f1dSLionel Sambuc // The error diagnostic message printer should be able to handle the non-ascii 10*0a6a1f1dSLionel Sambuc // characters without any segmentation fault or assertion failure. If your 11*0a6a1f1dSLionel Sambuc // changes to clang frontend crashes this case, it is likely that you are mixing 12*0a6a1f1dSLionel Sambuc // column index with byte index which are two totally different concepts. 13*0a6a1f1dSLionel Sambuc 14*0a6a1f1dSLionel Sambuc // NOTE: This file is encoded in UTF-8 and intentionally contains some 15*0a6a1f1dSLionel Sambuc // non-ASCII characters. 16*0a6a1f1dSLionel Sambuc 17*0a6a1f1dSLionel Sambuc __attribute__((format(printf, 1, 2))) 18*0a6a1f1dSLionel Sambuc extern int printf(const char *fmt, ...); 19*0a6a1f1dSLionel Sambuc 20*0a6a1f1dSLionel Sambuc void test1(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα 21*0a6a1f1dSLionel Sambuc // CHECK: unknown type name 'Unknown' 22*0a6a1f1dSLionel Sambuc // CHECK-NEXT: void test1(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα ααα... 23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: {{^ \^$}} 24*0a6a1f1dSLionel Sambuc 25*0a6a1f1dSLionel Sambuc void test2(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα 26*0a6a1f1dSLionel Sambuc 27*0a6a1f1dSLionel Sambuc // CHECK: unknown type name 'Unknown' 28*0a6a1f1dSLionel Sambuc // CHECK-NEXT: void test2(Unknown* b); // αααα αααα αααα αααα αααα αααα αααα αααα αααα 29*0a6a1f1dSLionel Sambuc // CHECK-NEXT: {{^ \^$}} 30*0a6a1f1dSLionel Sambuc test3()31*0a6a1f1dSLionel Sambucvoid test3() { 32*0a6a1f1dSLionel Sambuc /* αααα αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s"); 33*0a6a1f1dSLionel Sambuc } 34*0a6a1f1dSLionel Sambuc // CHECK: format specifies type 'int' but the argument has type 'char *' 35*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ...αααα αααα αααα αααα αααα αααα αααα αααα αααα */ printf("%d", "s"); 36*0a6a1f1dSLionel Sambuc // CHECK-NEXT: {{^ ~~ \^~~$}} 37*0a6a1f1dSLionel Sambuc // CHECK-NEXT: {{^ %s$}} 38