Debian Codegraph @

clang/test/DebugInfo/Generic/codeview-buildinfo.c

raw
1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cl --target=i686-windows-msvc /c /Z7 /Fo%t.obj -- %s
3 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
4 // RUN: %clang_cl -gcodeview-command-line --target=i686-windows-msvc /c /Z7 /Fo%t.obj -- %s
5 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
6 // RUN: %clang_cl --target=i686-windows-msvc /c /Z7 /Fo%t.obj -fdebug-compilation-dir=. -- %s
7 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix RELATIVE
8 // RUN: %clang_cl -gno-codeview-command-line --target=i686-windows-msvc /c /Z7 /Fo%t.obj -- %s
9 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix DISABLE
10
11 // -fmessage-length shouldn't be included in the command line since it breaks reproducibility
12 // RUN: %clang_cl -gcodeview-command-line --target=i686-windows-msvc -Xclang -fmessage-length=100 /c /Z7 /Fo%t.obj -- %s
13 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix MESSAGELEN
14
15 // The source filename must be stripped from the embedded cc1 command line
16 // whether it's passed to the driver as an absolute or a relative path.
17 // See https://github.com/llvm/llvm-project/issues/193900.
18
19 // RUN: %clang_cl --target=i686-windows-msvc /c /Z7 /Fo%t.obj -- %s
20 // RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix ABSPATH
21
22 // RUN: rm -rf %t.relpath && mkdir %t.relpath
23 // RUN: cp %s %t.relpath/hello.cpp
24 // RUN: cd %t.relpath && %clang_cl --target=i686-windows-msvc /c /Z7 /Fo:hello.obj -- hello.cpp
25 // RUN: llvm-pdbutil dump --types %t.relpath/hello.obj | FileCheck %s --check-prefix RELPATH
26
27 int main(void) { return 42; }
28
29 // CHECK: Types (.debug$T)
30 // CHECK: ============================================================
31 // CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[PWDVAL:.+]]
32 // CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[FILEPATHVAL:.+[\\/]codeview-buildinfo.c]]
33 // CHECK: 0x[[ZIPDB:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String:
34 // CHECK: 0x[[TOOL:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[TOOLVAL:.+[\\/][clang|llvm].*]]
35 // CHECK: 0x[[CMDLINE:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: "-cc1
36 // CHECK: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
37 // CHECK-NEXT: 0x[[PWD]]: `[[PWDVAL]]`
38 // CHECK-NEXT: 0x[[TOOL]]: `[[TOOLVAL]]`
39 // CHECK-NEXT: 0x[[FILEPATH]]: `[[FILEPATHVAL]]`
40 // CHECK-NEXT: 0x[[ZIPDB]]: ``
41 // CHECK-NEXT: 0x[[CMDLINE]]: `"-cc1
42
43 // RELATIVE: Types (.debug$T)
44 // RELATIVE: ============================================================
45 // RELATIVE: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
46 // RELATIVE: 0x{{.+}}: `.`
47
48 // DISABLE-NOT: "-cc1"
49 // DISABLE: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
50 // DISABLE-NEXT: 0x{{.+}}: `{{.*}}`
51 // DISABLE-NEXT: 0x{{.+}}: `{{.*}}`
52 // DISABLE-NEXT: 0x{{.+}}: `{{.*}}`
53 // DISABLE-NEXT: 0x{{.+}}: ``
54 // DISABLE-NEXT: 0x{{.+}}: `{{.*}}`
55
56 // MESSAGELEN: Types (.debug$T)
57 // MESSAGELEN: ============================================================
58 // MESSAGELEN: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
59 // MESSAGELEN-NOT: -fmessage-length
60
61 // The cmdline is the 5th argument of LF_BUILDINFO. The source filename must
62 // not appear inside its value (the SourceFile field, the 3rd argument, is
63 // reserved for that).
64 // ABSPATH: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
65 // ABSPATH-NEXT: 0x{{.*}}: `{{.*}}`
66 // ABSPATH-NEXT: 0x{{.*}}: `{{.*}}`
67 // ABSPATH-NEXT: 0x{{.*}}: `{{.+[\\/]codeview-buildinfo\.c}}`
68 // ABSPATH-NEXT: 0x{{.*}}: ``
69 // ABSPATH-NEXT: 0x{{.*}}: `
70 // ABSPATH-NOT: {{[^"]*[\\/]codeview-buildinfo\.c}}
71 // ABSPATH-SAME: `
72
73 // RELPATH: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
74 // RELPATH-NEXT: 0x{{.*}}: `{{.*}}`
75 // RELPATH-NEXT: 0x{{.*}}: `{{.*}}`
76 // RELPATH-NEXT: 0x{{.*}}: `{{.*hello\.cpp}}`
77 // RELPATH-NEXT: 0x{{.*}}: ``
78 // RELPATH-NEXT: 0x{{.*}}: `
79 // RELPATH-NOT: {{hello\.cpp}}
80 // RELPATH-SAME: `