Update calculateFileInfo for the null string case for 2022.3 (#15078)

* updated not to find absPath for null filePath

* changed to cache only std::runtime_error

* fix clang-format error
This commit is contained in:
Eddy Kim
2023-01-13 22:48:01 +09:00
committed by GitHub
parent efa7cae5a0
commit 810b7e198e

View File

@@ -46,10 +46,12 @@ static int32_t as_int32_t(T v) {
std::string NetworkCompilationContext::calculateFileInfo(const std::string& filePath) {
uint64_t seed = 0;
auto absPath = filePath;
try {
absPath = FileUtils::absoluteFilePath(filePath);
} catch (...) {
// can't get absolute path, will use filePath for hash
if (filePath.size() > 0) {
try {
absPath = FileUtils::absoluteFilePath(filePath);
} catch (std::runtime_error&) {
// can't get absolute path, will use filePath for hash
}
}
seed = hash_combine(seed, absPath);