From f86b078e2df79968e40185c91b0dce81bc580872 Mon Sep 17 00:00:00 2001 From: Arlo Siemsen Date: Mon, 30 Mar 2020 22:17:15 -0700 Subject: Add hash of source files in debug info * Adds either an MD5 or SHA1 hash to the debug info. * Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm. --- src/test/codegen/remap_path_prefix/main.rs | 4 ++-- src/test/codegen/remap_path_prefix/xcrate-generic.rs | 2 +- src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs | 6 ++++++ src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs | 6 ++++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs create mode 100644 src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs (limited to 'src/test/codegen') diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index 4724dc3c3e5..20475bab0fc 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -22,7 +22,7 @@ fn main() { } // Here we check that local debuginfo is mapped correctly. -// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd/") +// CHECK: !DIFile(filename: "/the/src/remap_path_prefix/main.rs", directory: "/the/cwd/" // And here that debuginfo from other crates are expanded to absolute paths. -// CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "") +// CHECK: !DIFile(filename: "/the/aux-src/remap_path_prefix_aux.rs", directory: "" diff --git a/src/test/codegen/remap_path_prefix/xcrate-generic.rs b/src/test/codegen/remap_path_prefix/xcrate-generic.rs index 30d6112fd02..7a9d2ca9b6b 100644 --- a/src/test/codegen/remap_path_prefix/xcrate-generic.rs +++ b/src/test/codegen/remap_path_prefix/xcrate-generic.rs @@ -11,4 +11,4 @@ pub fn foo() { } // Here we check that local debuginfo is mapped correctly. -// CHECK: !DIFile(filename: "/the/aux-src/xcrate-generic.rs", directory: "") +// CHECK: !DIFile(filename: "/the/aux-src/xcrate-generic.rs", directory: "" diff --git a/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs new file mode 100644 index 00000000000..64be1127786 --- /dev/null +++ b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs @@ -0,0 +1,6 @@ +// compile-flags: -g -Z src-hash-algorithm=md5 + +#![crate_type = "lib"] + +pub fn test() {} +// CHECK: checksumkind: CSK_MD5 diff --git a/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs new file mode 100644 index 00000000000..54e07152142 --- /dev/null +++ b/src/test/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs @@ -0,0 +1,6 @@ +// compile-flags: -g -Z src-hash-algorithm=sha1 + +#![crate_type = "lib"] + +pub fn test() {} +// CHECK: checksumkind: CSK_SHA1 -- cgit 1.4.1-3-g733a5