1// PR21000: Test that -I is passed to both external and integrated assemblers.
2
3// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \
4// RUN:   -Ifoo_dir -### 2>&1 \
5// RUN:   | FileCheck %s
6
7// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \
8// RUN:   -I foo_dir -### 2>&1 \
9// RUN:   | FileCheck %s
10
11// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \
12// RUN:   -Ifoo_dir -### 2>&1 \
13// RUN:   | FileCheck %s
14
15// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \
16// RUN:   -I foo_dir -### 2>&1 \
17// RUN:   | FileCheck %s
18
19// Other GNU targets
20
21// RUN: %clang -target aarch64-linux-gnu -c -no-integrated-as %s \
22// RUN:   -Ifoo_dir -### 2>&1 \
23// RUN:   | FileCheck %s
24
25// RUN: %clang -target aarch64-linux-gnu -c -integrated-as %s \
26// RUN:   -Ifoo_dir -### 2>&1 \
27// RUN:   | FileCheck %s
28
29// RUN: %clang -target armv7-linux-gnueabihf -c -no-integrated-as %s \
30// RUN:   -Ifoo_dir -### 2>&1 \
31// RUN:   | FileCheck %s
32
33// RUN: %clang -target armv7-linux-gnueabihf -c -integrated-as %s \
34// RUN:   -Ifoo_dir -### 2>&1 \
35// RUN:   | FileCheck %s
36
37// CHECK: "-I" "foo_dir"
38
39// Test that assembler options don't cause warnings when there's no assembler
40// stage.
41
42// RUN: %clang -mincremental-linker-compatible -E -fintegrated-as \
43// RUN:   -o /dev/null -x c++ %s 2>&1 \
44// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
45// RUN: %clang -mincremental-linker-compatible -E -fno-integrated-as \
46// RUN:   -o /dev/null -x c++ %s 2>&1 \
47// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
48
49// RUN: %clang -mincremental-linker-compatible -E -fintegrated-as \
50// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
51// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
52// RUN: %clang -mincremental-linker-compatible -E -fno-integrated-as \
53// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
54// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
55
56// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
57// RUN:   -fintegrated-as -o /dev/null -x c++ %s 2>&1 \
58// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
59// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
60// RUN:   -fno-integrated-as -o /dev/null -x c++ %s 2>&1 \
61// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
62
63// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
64// RUN:   -fintegrated-as -o /dev/null -x assembler-with-cpp %s 2>&1 \
65// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
66// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabi -E \
67// RUN:   -fno-integrated-as -o /dev/null -x assembler-with-cpp %s 2>&1 \
68// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
69
70// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E -fintegrated-as \
71// RUN:   -o /dev/null -x c++ %s 2>&1 \
72// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
73// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E -fno-integrated-as \
74// RUN:   -o /dev/null -x c++ %s 2>&1 \
75// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
76
77// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E -fintegrated-as \
78// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
79// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
80// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E -fno-integrated-as \
81// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
82// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
83
84// RUN: %clang -Xassembler -mbig-obj -target i386-pc-windows -E -fintegrated-as \
85// RUN:   -o /dev/null -x c++ %s 2>&1 \
86// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
87// RUN: %clang -Xassembler -mbig-obj -target i386-pc-windows -E \
88// RUN:   -fno-integrated-as -o /dev/null -x c++ %s 2>&1 \
89// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
90
91// RUN: %clang -Xassembler -mbig-obj -target i386-pc-windows -E -fintegrated-as \
92// RUN:   -o /dev/null -x assembler-with-cpp %s 2>&1 \
93// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
94// RUN: %clang -Xassembler -mbig-obj -target i386-pc-windows -E \
95// RUN:   -fno-integrated-as -o /dev/null -x assembler-with-cpp %s 2>&1 \
96// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
97
98// NOWARN-NOT: unused
99
100// Test that unsupported arguments do not cause errors when -fno-integrated-as
101// is set.
102// RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as %s -S 2>&1 \
103// RUN:   | FileCheck --check-prefix=NOERROR --allow-empty %s
104// NOERROR-NOT: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'
105
106// -Wa flags shouldn't cause warnings without an assembler stage with
107// -fno-integrated-as either.
108// RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as -x c++ %s -S 2>&1 \
109// RUN:   -o /dev/null \
110// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
111
112// But -m flags for the integrated assembler _should_ warn if the integrated
113// assembler is not in use.
114// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S -o /dev/null 2>&1 \
115// RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
116// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S -o /dev/null 2>&1 \
117// RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
118// WARN: unused
119