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.
This commit is contained in:
Arlo Siemsen 2020-03-30 22:17:15 -07:00
parent 537ccdf3ac
commit f86b078e2d
19 changed files with 332 additions and 92 deletions

View file

@ -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: ""

View file

@ -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: ""

View file

@ -0,0 +1,6 @@
// compile-flags: -g -Z src-hash-algorithm=md5
#![crate_type = "lib"]
pub fn test() {}
// CHECK: checksumkind: CSK_MD5

View file

@ -0,0 +1,6 @@
// compile-flags: -g -Z src-hash-algorithm=sha1
#![crate_type = "lib"]
pub fn test() {}
// CHECK: checksumkind: CSK_SHA1