Skip to content

Commit 096469c

Browse files
committed
Swift: use timestamp + getpid for the invocation filename
1 parent 42004d9 commit 096469c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

swift/extractor/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ swift_cc_binary(
1414
"//swift/extractor/remapping",
1515
"//swift/extractor/translators",
1616
"//swift/third_party/swift-llvm-support",
17-
"@picosha2",
1817
],
1918
)
2019

swift/extractor/main.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <iostream>
66
#include <regex>
77
#include <unistd.h>
8-
#include <picosha2.h>
8+
#include <chrono>
99

1010
#include <swift/Basic/LLVMInitialize.h>
1111
#include <swift/FrontendTool/FrontendTool.h>
@@ -107,12 +107,8 @@ static void checkWhetherToRunUnderTool(int argc, char* const* argv) {
107107
// Creates a target file that should store per-invocation info, e.g. compilation args,
108108
// compilations, diagnostics, etc.
109109
codeql::TargetFile invocationTargetFile(codeql::SwiftExtractorConfiguration& configuration) {
110-
auto hasher = picosha2::hash256_one_by_one();
111-
for (auto& option : configuration.frontendOptions) {
112-
hasher.process(option.c_str(), option.c_str() + option.size() + 1);
113-
}
114-
hasher.finish();
115-
auto target = "invocation-"s + get_hash_hex_string(hasher);
110+
auto timestamp = std::chrono::system_clock::now().time_since_epoch().count();
111+
auto target = "invocation-"s + std::to_string(timestamp) + '-' + std::to_string(getpid());
116112
auto maybeFile = codeql::createTargetTrapFile(configuration, target);
117113
if (!maybeFile) {
118114
std::cerr << "Cannot create invocation trap file: " << target << "\n";

0 commit comments

Comments
 (0)