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