Debian Codegraph @

clang/test/CodeGen/dwarf-version.c

raw
1 // RUN: %clang -target x86_64-linux-gnu -gdwarf-2 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
2 // RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3
3 // RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
4 // RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
5 // RUN: %clang -target x86_64-linux-gnu -gdwarf-6 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER6
6 // RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
7 // RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
8 // RUN: %clang --target=i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
9 // RUN: %clang --target=i386-pc-solaris -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
10
11 // The -isysroot is used as a hack to avoid LIT messing with the SDKROOT
12 // environment variable which indirecty overrides the version in the target
13 // triple used here.
14 // RUN: %clang -target x86_64-apple-macosx10.11 -g -S -emit-llvm -o - %s -isysroot %t | FileCheck %s --check-prefix=VER4
15 // RUN: %clang -target x86_64-apple-darwin14 -g -S -emit-llvm -o - %s -isysroot %t | FileCheck %s --check-prefix=VER2
16
17 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2
18 // RUN: %clang --target=x86_64-unknown-haiku -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
19 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
20
21 // Check which debug info formats we use on Windows. By default, in an MSVC
22 // environment, we should use codeview. You can enable dwarf, which implicitly
23 // disables codeview, of you can explicitly ask for both if you don't know how
24 // the app will be debugged.
25 // Default is codeview.
26 // RUN: %clang -target i686-pc-windows-msvc -g -S -emit-llvm -o - %s \
27 // RUN: | FileCheck %s --check-prefixes=NODWARF,CODEVIEW
28 // Explicitly request codeview.
29 // RUN: %clang -target i686-pc-windows-msvc -gcodeview -S -emit-llvm -o - %s \
30 // RUN: | FileCheck %s --check-prefixes=NODWARF,CODEVIEW
31 // Explicitly request DWARF.
32 // RUN: %clang -target i686-pc-windows-msvc -gdwarf -S -emit-llvm -o - %s \
33 // RUN: | FileCheck %s --check-prefixes=VER4,NOCODEVIEW
34 // Explicitly request both.
35 // RUN: %clang -target i686-pc-windows-msvc -gdwarf -gcodeview -S -emit-llvm -o - %s \
36 // RUN: | FileCheck %s --check-prefixes=VER4,CODEVIEW
37
38 // Check what version of dwarf is used for MinGW targets.
39 // RUN: %clang -target i686-pc-windows-gnu -g -S -emit-llvm -o - %s | \
40 // RUN: FileCheck %s --check-prefixes=VER4
41
42 // RUN: %clang -target powerpc-ibm-aix-xcoff -g -S -emit-llvm -o - %s | \
43 // RUN: FileCheck %s --check-prefix=VER3
44 // RUN: %clang -target powerpc-ibm-aix-xcoff -gdwarf-2 -S -emit-llvm -o - %s | \
45 // RUN: FileCheck %s --check-prefix=VER2
46 // RUN: %clang -target powerpc-ibm-aix-xcoff -gdwarf-3 -S -emit-llvm -o - %s | \
47 // RUN: FileCheck %s --check-prefix=VER3
48 // RUN: %clang -target powerpc-ibm-aix-xcoff -gdwarf-4 -S -emit-llvm -o - %s | \
49 // RUN: FileCheck %s --check-prefix=VER4
50 // RUN: not %clang -target powerpc-ibm-aix-xcoff -gdwarf-5 -S -emit-llvm -o - %s 2>&1 | \
51 // RUN: FileCheck %s --check-prefix=UNSUPPORTED-VER5
52 // RUN: not %clang -target powerpc64-ibm-aix-xcoff -gdwarf-5 -S -emit-llvm -o - %s 2>&1| \
53 // RUN: FileCheck %s --check-prefix=UNSUPPORTED-VER5
54
55 int main (void) {
56 return 0;
57 }
58
59 // NOCODEVIEW-NOT: !"CodeView"
60
61 // VER2: !{i32 7, !"Dwarf Version", i32 2}
62 // VER3: !{i32 7, !"Dwarf Version", i32 3}
63 // VER4: !{i32 7, !"Dwarf Version", i32 4}
64 // VER5: !{i32 7, !"Dwarf Version", i32 5}
65 // VER6: !{i32 7, !"Dwarf Version", i32 6}
66 // UNSUPPORTED-VER5: error: unsupported option '-gdwarf-5'
67
68 // NODWARF-NOT: !"Dwarf Version"
69 // CODEVIEW: !{i32 2, !"CodeView", i32 1}
70 // NOCODEVIEW-NOT: !"CodeView"
71 // NODWARF-NOT: !"Dwarf Version"