xref: /llvm-project/clang/test/CodeGen/debug-info-file-checksum.c (revision aa39b0b13e3b56ac072acff2660dbef9db45bca0)
1 // AIX does not support -gdwarf-5.
2 // UNSUPPORTED: target={{.*}}-aix{{.*}}
3 
4 // RUN: %clang -emit-llvm -S -g -gcodeview -x c \
5 // RUN:     %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
6 // RUN: %clang -emit-llvm -S -g -gcodeview -Xclang -gsrc-hash=md5 \
7 // RUN:     -x c %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
8 // RUN: %clang -emit-llvm -S -g -gcodeview -Xclang -gsrc-hash=sha1 \
9 // RUN:     -x c %S/Inputs/debug-info-file-checksum.c -o - \
10 // RUN:     | FileCheck --check-prefix=SHA1 %s
11 // RUN: %clang -emit-llvm -S -g -gcodeview -Xclang -gsrc-hash=sha256 \
12 // RUN:     -x c %S/Inputs/debug-info-file-checksum.c -o - \
13 // RUN:     | FileCheck --check-prefix=SHA256 %s
14 // RUN: %clang -emit-llvm -S -g -gcodeview -x c %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
15 // RUN: %clang -emit-llvm -S -gdwarf-5 -x c %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
16 
17 // Check that "checksum" is created correctly for the compiled file.
18 
19 // CHECK: !DIFile(filename:{{.*}}, directory:{{.*}}, checksumkind: CSK_MD5, checksum: "a3b7d27af071accdeccaa933fc603608")
20 // SHA1: !DIFile(filename:{{.*}}, directory:{{.*}}, checksumkind: CSK_SHA1, checksum: "6f6eeaba705ad6db6fbb05c2cbcf3cbb3e374bcd")
21 // SHA256: !DIFile(filename:{{.*}}, directory:{{.*}}, checksumkind: CSK_SHA256, checksum: "2d49b53859e57898a0f8c16ff1fa4d99306b8ec28d65cf7577109761f0d56197")
22 
23 // Ensure #line directives (in already pre-processed files) do not emit checksums
24 // RUN: %clang -emit-llvm -S -g -gcodeview -x c %S/Inputs/debug-info-file-checksum-pre.cpp -o - | FileCheck %s --check-prefix NOCHECKSUM
25 
26 // NOCHECKSUM: !DIFile(filename: "{{.*}}code-coverage-filter1.h", directory: "{{[^"]*}}")
27 // NOCHECKSUM: !DIFile(filename: "{{.*}}code-coverage-filter2.h", directory: "{{[^"]*}}")
28 // NOCHECKSUM: !DIFile(filename: "{{.*}}debug-info-file-checksum.c", directory: "{{[^"]*}}")
29 
30 // Ensure #line directives without name do emit checksums
31 // RUN: %clang -emit-llvm -S -g -gcodeview -x c %S/Inputs/debug-info-file-checksum-line.cpp -o - | FileCheck %s --check-prefix CHECKSUM
32 
33 // CHECKSUM: !DIFile(filename: "{{.*}}debug-info-file-checksum-line.cpp", directory:{{.*}}, checksumkind: CSK_MD5, checksum: "e13bca9b34ed822d596a519c9ce60995")
34