Clang Project

clang_source_code/test/Driver/color-diagnostics.c
1// RUN: %clang -fcolor-diagnostics -### -c %s 2>&1 \
2// RUN:     | FileCheck --check-prefix=CHECK-CD %s
3// CHECK-CD: clang{{.*}}" "-fcolor-diagnostics"
4
5// RUN: %clang -fno-color-diagnostics -### -c %s 2>&1 \
6// RUN:     | FileCheck --check-prefix=CHECK-NCD %s
7// CHECK-NCD-NOT: clang{{.*}}" "-fcolor-diagnostics"
8
9// RUN: %clang -fdiagnostics-color -### -c %s 2>&1 \
10// RUN:     | FileCheck --check-prefix=CHECK-DC %s
11// CHECK-DC: clang{{.*}}" "-fcolor-diagnostics"
12
13// RUN: %clang -fno-diagnostics-color -### -c %s 2>&1 \
14// RUN:     | FileCheck --check-prefix=CHECK-NDC %s
15// CHECK-NDC-NOT: clang{{.*}}" "-fcolor-diagnostics"
16
17// RUN: %clang -fdiagnostics-color=always -### -c %s 2>&1 \
18// RUN:     | FileCheck --check-prefix=CHECK-DCE_A %s
19// CHECK-DCE_A: clang{{.*}}" "-fcolor-diagnostics"
20
21// RUN: %clang -fdiagnostics-color=never -### -c %s 2>&1 \
22// RUN:     | FileCheck --check-prefix=CHECK-DCE_N %s
23// CHECK-DCE_N-NOT: clang{{.*}}" "-fcolor-diagnostics"
24
25// The test doesn't run in a PTY, so "auto" defaults to off.
26// RUN: %clang -fdiagnostics-color=auto -### -c %s 2>&1 \
27// RUN:     | FileCheck --check-prefix=CHECK-DCE_AUTO %s
28// CHECK-DCE_AUTO-NOT: clang{{.*}}" "-fcolor-diagnostics"
29
30// RUN: %clang -fdiagnostics-color=foo -### -c %s 2>&1 \
31// RUN:     | FileCheck --check-prefix=CHECK-DCE_FOO %s
32// CHECK-DCE_FOO: error: the clang compiler does not support '-fdiagnostics-color=foo'
33
34// Check that the last flag wins.
35// RUN: %clang -fno-color-diagnostics -fdiagnostics-color -### -c %s 2>&1 \
36// RUN:     | FileCheck --check-prefix=CHECK-NCD_DC_S %s
37// CHECK-NCD_DC_S: clang{{.*}}" "-fcolor-diagnostics"
38
39// RUN: %clang -fcolor-diagnostics -fno-diagnostics-color -### -c %s 2>&1 \
40// RUN:     | FileCheck --check-prefix=CHECK-CD_NDC_S %s
41// CHECK-CD_NDC_S-NOT: clang{{.*}}" "-fcolor-diagnostics"
42
43// RUN: %clang -fdiagnostics-color -fno-color-diagnostics -### -c %s 2>&1 \
44// RUN:     | FileCheck --check-prefix=CHECK-DC_NCD_S %s
45// CHECK-DC_NCD_S-NOT: clang{{.*}}" "-fcolor-diagnostics"
46
47// RUN: %clang -fno-diagnostics-color -fcolor-diagnostics -### -c %s 2>&1 \
48// RUN:     | FileCheck --check-prefix=CHECK-NDC_CD_S %s
49// CHECK-NDC_CD_S: clang{{.*}}" "-fcolor-diagnostics"
50
51// RUN: %clang -fcolor-diagnostics -fdiagnostics-color=auto -### -c %s 2>&1 \
52// RUN:     | FileCheck --check-prefix=CHECK-CD_DCE_AUTO_S %s
53// CHECK-CD_DCE_AUTO_S-NOT: clang{{.*}}" "-fcolor-diagnostics"
54
55// RUN: %clang -fansi-escape-codes -### -c %s 2>&1 \
56// RUN:     | FileCheck --check-prefix=CHECK-AEC %s
57// CHECK-AEC: clang{{.*}}" "-fansi-escape-codes"
58