| 51 | } |
| 52 | |
| 53 | std::string ImportedCxxModuleLookup::BmiNameForSource(std::string const& path) |
| 54 | { |
| 55 | auto genit = this->GeneratorInfo.find(path); |
| 56 | if (genit != this->GeneratorInfo.end()) { |
| 57 | return genit->second.BmiName; |
| 58 | } |
| 59 | |
| 60 | auto importit = this->ImportedInfo.find(path); |
| 61 | std::string bmiName; |
| 62 | cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_512); |
| 63 | constexpr size_t HASH_TRUNCATION = 12; |
| 64 | if (importit != this->ImportedInfo.end()) { |
| 65 | auto safename = hasher.HashString(importit->second.Name); |
| 66 | bmiName = cmStrCat(safename.substr(0, HASH_TRUNCATION), ".bmi"); |
| 67 | } else { |
| 68 | auto dirhash = hasher.HashString(path); |
| 69 | bmiName = cmStrCat(dirhash.substr(0, HASH_TRUNCATION), ".bmi"); |
| 70 | } |
| 71 | |
| 72 | this->GeneratorInfo.emplace(path, ImportedCxxModuleGeneratorInfo{ bmiName }); |
| 73 | return bmiName; |
| 74 | } |
no test coverage detected