1 //--- Config file search directories 2 // 3 // RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-DIRS 4 // CHECK-DIRS: System configuration file directory: {{.*}}/Inputs/config 5 // CHECK-DIRS: User configuration file directory: {{.*}}/Inputs/config2 6 7 8 //--- Config file (full path) in output of -### 9 // 10 // RUN: %clang --config %S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH 11 // RUN: %clang --config=%S/Inputs/config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH 12 // CHECK-HHH: Configuration file: {{.*}}Inputs{{.}}config-1.cfg 13 // CHECK-HHH: -Werror 14 // CHECK-HHH: -std=c99 15 16 17 //--- Config file (full path) in output of -v 18 // 19 // RUN: %clang --config %S/Inputs/config-1.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-V 20 // CHECK-V: Configuration file: {{.*}}Inputs{{.}}config-1.cfg 21 // CHECK-V: -Werror 22 // CHECK-V: -std=c99 23 24 25 //--- Config file in output of -### 26 // 27 // RUN: %clang --config-system-dir=%S/Inputs --config-user-dir= --config config-1.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-HHH2 28 // CHECK-HHH2: Configuration file: {{.*}}Inputs{{.}}config-1.cfg 29 // CHECK-HHH2: -Werror 30 // CHECK-HHH2: -std=c99 31 32 33 //--- Config file in output of -v 34 // 35 // RUN: %clang --config-system-dir=%S/Inputs --config-user-dir= --config config-1.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-V2 36 // CHECK-V2: Configuration file: {{.*}}Inputs{{.}}config-1.cfg 37 // CHECK-V2: -Werror 38 // CHECK-V2: -std=c99 39 40 41 //--- Nested config files 42 // 43 // RUN: %clang --config-system-dir=%S/Inputs --config-user-dir= --config config-2.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED 44 // CHECK-NESTED: Configuration file: {{.*}}Inputs{{.}}config-2.cfg 45 // CHECK-NESTED: -Wundefined-func-template 46 47 // RUN: %clang --config-system-dir=%S/Inputs --config-user-dir=%S/Inputs/config --config config-6.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED2 48 // CHECK-NESTED2: Configuration file: {{.*}}Inputs{{.}}config-6.cfg 49 // CHECK-NESTED2: -isysroot 50 // CHECK-NESTED2-SAME: /opt/data 51 52 53 // RUN: %clang --config %S/Inputs/config-2a.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTEDa 54 // CHECK-NESTEDa: Configuration file: {{.*}}Inputs{{.}}config-2a.cfg 55 // CHECK-NESTEDa: -isysroot 56 // CHECK-NESTEDa-SAME: /opt/data 57 58 // RUN: %clang --config-system-dir=%S/Inputs --config-user-dir= --config config-2a.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NESTED2a 59 // CHECK-NESTED2a: Configuration file: {{.*}}Inputs{{.}}config-2a.cfg 60 // CHECK-NESTED2a: -isysroot 61 // CHECK-NESTED2a-SAME: /opt/data 62 63 64 //--- Unused options in config file do not produce warnings 65 // 66 // RUN: %clang --config %S/Inputs/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-UNUSED 67 // CHECK-UNUSED-NOT: argument unused during compilation: 68 // CHECK-UNUSED-NOT: 'linker' input unused 69 70 71 //--- User directory is searched first. 72 // 73 // RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 --config config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-PRECEDENCE 74 // CHECK-PRECEDENCE: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg 75 // CHECK-PRECEDENCE: -Wall 76 77 78 //--- Multiple configuration files can be specified. 79 // RUN: %clang --config-system-dir=%S/Inputs/config --config-user-dir= --config config-4.cfg --config %S/Inputs/config2/config-4.cfg -S %s -o /dev/null -v 2>&1 | FileCheck %s -check-prefix CHECK-TWO-CONFIGS 80 // CHECK-TWO-CONFIGS: Configuration file: {{.*}}Inputs{{.}}config{{.}}config-4.cfg 81 // CHECK-TWO-CONFIGS-NEXT: Configuration file: {{.*}}Inputs{{.}}config2{{.}}config-4.cfg 82 // CHECK-TWO-CONFIGS: -isysroot 83 // CHECK-TWO-CONFIGS-SAME: /opt/data 84 // CHECK-TWO-CONFIGS-SAME: -Wall 85 86 //--- The linker input flags should be moved to the end of input list and appear only when linking. 87 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg %s -lmylib -Wl,foo.a -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING 88 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp=libomp %s -lmylib -Wl,foo.a -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING-LIBOMP-GOES-AFTER 89 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING 90 // RUN: %clang --target=aarch64-unknown-linux-gnu --config %S/Inputs/config-l.cfg -fopenmp=libomp -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING-OPENMP 91 // RUN: %clang --target=x86_64-pc-windows-msvc --config %S/Inputs/config-l.cfg %s -lmylib -Wl,foo.lib -### 2>&1 | FileCheck %s -check-prefix CHECK-LINKING-MSVC 92 // RUN: %clang --target=x86_64-pc-windows-msvc --config %S/Inputs/config-l.cfg -S %s -### 2>&1 | FileCheck %s -check-prefix CHECK-NOLINKING-MSVC 93 // CHECK-LINKING: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 94 // CHECK-LINKING: "-Wall" 95 // CHECK-LINKING: "--as-needed" "{{.*}}-{{.*}}.o" "-lmylib" "foo.a" "-lm" "-Bstatic" "-lhappy" "-Bdynamic" 96 // CHECK-LINKING-LIBOMP-GOES-AFTER: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 97 // CHECK-LINKING-LIBOMP-GOES-AFTER: "-Wall" {{.*}}"-fopenmp" 98 // CHECK-LINKING-LIBOMP-GOES-AFTER: "--as-needed" "{{.*}}-{{.*}}.o" "-lmylib" "foo.a" "-lm" "-Bstatic" "-lhappy" "-Bdynamic" {{.*}}"-lomp" 99 // CHECK-NOLINKING: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 100 // CHECK-NOLINKING: "-Wall" 101 // CHECK-NOLINKING-NO: "-lm" "-Bstatic" "-lhappy" "-Bdynamic" 102 // CHECK-NOLINKING-OPENMP: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 103 // CHECK-NOLINKING-OPENMP: "-Wall" {{.*}}"-fopenmp" 104 // CHECK-NOLINKING-OPENMP-NO: "-lm" "-Bstatic" "-lhappy" "-Bdynamic" {{.*}}"-lomp" 105 // CHECK-LINKING-MSVC: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 106 // CHECK-LINKING-MSVC: "-Wall" 107 // CHECK-LINKING-MSVC: "--as-needed" "{{.*}}-{{.*}}.o" "mylib.lib" "foo.lib" "m.lib" "-Bstatic" "happy.lib" "-Bdynamic" 108 // CHECK-NOLINKING-MSVC: Configuration file: {{.*}}Inputs{{.}}config-l.cfg 109 // CHECK-NOLINKING-MSVC: "-Wall" 110 // CHECK-NOLINKING-MSVC-NO: "m.lib" "-Bstatic" "happy.lib" "-Bdynamic" 111