MCPcopy Create free account
hub / github.com/Kitware/CMake / BmiNameForSource

Method BmiNameForSource

Source/cmImportedCxxModuleInfo.cxx:53–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53std::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}

Callers 1

GetBmiFilePathMethod · 0.80

Calls 6

HashStringMethod · 0.80
emplaceMethod · 0.80
cmStrCatFunction · 0.70
findMethod · 0.45
endMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected