1 // XFAIL: target={{.*}}-aix{{.*}}
3 // Check to make sure clang is somewhat picky about -g options.
4 // (Delived from debug-options.c)
5 // RUN: %clang -### -c -save-temps -integrated-as -g %s 2>&1 \
6 // RUN: | FileCheck -check-prefix=SAVE %s
8 // SAVE: "-cc1"{{.*}}"-E"{{.*}}"-debug-info-kind=
9 // SAVE: "-cc1"{{.*}}"-emit-llvm-bc"{{.*}}"-debug-info-kind=
10 // SAVE: "-cc1"{{.*}}"-S"{{.*}}"-debug-info-kind=
12 // SAVE-NOT: -debug-info-kind=
14 // Make sure that '-ggdb0' is not accidentally mistaken for '-g'
15 // RUN: %clang -### -ggdb0 -c -integrated-as -x assembler %s 2>&1 \
16 // RUN: | FileCheck -check-prefix=GGDB0 %s
19 // GGDB0-NOT: -debug-info-kind=
21 // Check to make sure clang with -g on a .s file gets passed.
22 // RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \
23 // RUN: | FileCheck %s
26 // CHECK: "-debug-info-kind=constructor"
28 // Check to make sure clang with -g on a .s file gets passed -dwarf-debug-producer.
29 // RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \
30 // RUN: | FileCheck -check-prefix=P %s
33 // P: "-dwarf-debug-producer"
35 // Check that -gdwarf64 is passed to cc1as.
36 // RUN: %clang -### -c -gdwarf64 -gdwarf-5 -target x86_64 -integrated-as -x assembler %s 2>&1 \
37 // RUN: | FileCheck -check-prefix=GDWARF64_ON %s
38 // RUN: %clang -### -c -gdwarf64 -gdwarf-4 -target x86_64 -integrated-as -x assembler %s 2>&1 \
39 // RUN: | FileCheck -check-prefix=GDWARF64_ON %s
40 // RUN: %clang -### -c -gdwarf64 -gdwarf-3 -target x86_64 -integrated-as -x assembler %s 2>&1 \
41 // RUN: | FileCheck -check-prefix=GDWARF64_ON %s
42 // GDWARF64_ON: "-cc1as"
43 // GDWARF64_ON: "-gdwarf64"
45 // Check that -gdwarf64 can be reverted with -gdwarf32.
46 // RUN: %clang -### -c -gdwarf64 -gdwarf32 -gdwarf-4 -target x86_64 -integrated-as -x assembler %s 2>&1 \
47 // RUN: | FileCheck -check-prefix=GDWARF64_OFF %s
48 // GDWARF64_OFF: "-cc1as"
49 // GDWARF64_OFF-NOT: "-gdwarf64"
51 // Check that an error is reported if -gdwarf64 cannot be used.
52 // RUN: not %clang -### -c -gdwarf64 -gdwarf-2 --target=x86_64 -integrated-as -x assembler %s 2>&1 \
53 // RUN: | FileCheck -check-prefix=GDWARF64_VER %s
54 // RUN: not %clang -### -c -gdwarf64 -gdwarf-4 --target=i386-linux-gnu %s 2>&1 \
55 // RUN: | FileCheck -check-prefix=GDWARF64_32ARCH %s
56 // RUN: not %clang -### -c -gdwarf64 -gdwarf-4 -target x86_64-apple-darwin %s 2>&1 \
57 // RUN: | FileCheck -check-prefix=GDWARF64_ELF %s
59 // GDWARF64_VER: error: invalid argument '-gdwarf64' only allowed with 'DWARFv3 or greater'
60 // GDWARF64_32ARCH: error: invalid argument '-gdwarf64' only allowed with '64 bit architecture'
61 // GDWARF64_ELF: error: invalid argument '-gdwarf64' only allowed with 'ELF platforms'
63 // Check that -gdwarf-N can be placed before other options of the "-g" group.
64 // RUN: %clang -### -c -g -gdwarf-3 -target %itanium_abi_triple -fintegrated-as -x assembler %s 2>&1 \
65 // RUN: | FileCheck -check-prefix=DWARF3 %s
66 // RUN: %clang -### -c -gdwarf-3 -g -target %itanium_abi_triple -fintegrated-as -x assembler %s 2>&1 \
67 // RUN: | FileCheck -check-prefix=DWARF3 %s
68 // RUN: %clang -### -c -g -gdwarf-5 -target %itanium_abi_triple -fintegrated-as -x assembler %s 2>&1 \
69 // RUN: | FileCheck -check-prefix=DWARF5 %s
70 // RUN: %clang -### -c -gdwarf-5 -g -target %itanium_abi_triple -fintegrated-as -x assembler %s 2>&1 \
71 // RUN: | FileCheck -check-prefix=DWARF5 %s
74 // DWARF3: "-dwarf-version=3"
76 // DWARF5: "-dwarf-version=5"