summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-12-05 02:30:43 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-12-05 02:30:43 +0000
commit80b55ee62d35d0327921927792f7ca2bc3c4a0a6 (patch)
tree4de3afe80d0b6b59191b80a76ac7bdb8a18391b8 /clang/test
parent276c770e57d886658b97e27e2e6d3e31d8fabae7 (diff)
downloadbcm5719-llvm-80b55ee62d35d0327921927792f7ca2bc3c4a0a6.tar.gz
bcm5719-llvm-80b55ee62d35d0327921927792f7ca2bc3c4a0a6.zip
[libclang] Store unsaved file hashes when recording parsing invocations
Storing the contents of unsaved files is too expensive. Instead a hash is stored with a record invocation. When a reproducer is generated, Clang will compare the stored hashes to the new hashes to determine if the contents of a file has changed. This way we'll know when a reproducer was generated for a different source to the one that triggered the original crash. rdar://35322543 llvm-svn: 319729
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Index/Inputs/record-parsing-invocation-remap.c2
-rw-r--r--clang/test/Index/record-parsing-invocation.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/test/Index/Inputs/record-parsing-invocation-remap.c b/clang/test/Index/Inputs/record-parsing-invocation-remap.c
new file mode 100644
index 00000000000..4a32ca66ef0
--- /dev/null
+++ b/clang/test/Index/Inputs/record-parsing-invocation-remap.c
@@ -0,0 +1,2 @@
+
+#pragma clang __debug parser_crash
diff --git a/clang/test/Index/record-parsing-invocation.c b/clang/test/Index/record-parsing-invocation.c
index 3daa71c0280..31883a93737 100644
--- a/clang/test/Index/record-parsing-invocation.c
+++ b/clang/test/Index/record-parsing-invocation.c
@@ -14,8 +14,15 @@
// RUN: env CINDEXTEST_INVOCATION_EMISSION_PATH=%t c-index-test -test-load-source all %s -DAVOID_CRASH
// RUN: ls %t | count 0
+// Make sure we record the unsaved file hash.
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: not env CINDEXTEST_INVOCATION_EMISSION_PATH=%t c-index-test -test-load-source all "-remap-file=%s,%S/Inputs/record-parsing-invocation-remap.c" %s
+// RUN: cat %t/libclang-* | FileCheck --check-prefix=CHECK-UNSAVED %s
+
#ifndef AVOID_CRASH
# pragma clang __debug parser_crash
#endif
// CHECK: {"toolchain":"{{.*}}","libclang.operation":"parse","libclang.opts":1,"args":["clang","-fno-spell-checking","{{.*}}record-parsing-invocation.c","-Xclang","-detailed-preprocessing-record","-fallow-editor-placeholders"]}
+// CHECK-UNSAVED: {"toolchain":"{{.*}}","libclang.operation":"parse","libclang.opts":1,"args":["clang","-fno-spell-checking","{{.*}}record-parsing-invocation.c","-Xclang","-detailed-preprocessing-record","-fallow-editor-placeholders"],"unsaved_file_hashes":[{"name":"{{.*}}record-parsing-invocation.c","md5":"aee23773de90e665992b48209351d70e"}]}
OpenPOWER on IntegriCloud