MCPcopy Create free account
hub / github.com/aras-p/ClangBuildAnalyzer / NameToIndex

Method NameToIndex

src/BuildEvents.cpp:234–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234 DetailIndex NameToIndex(const char* str, NameToIndexMap& nameToIndex)
235 {
236 HashedString hashedName(str);
237 auto it = nameToIndex.find(hashedName);
238 if (it != nameToIndex.end())
239 return it->second;
240
241 char* strCopy;
242 {
243 // arena allocator is not thread safe, take a mutex
244 std::scoped_lock lock(arenaMutex);
245 strCopy = (char*)ArenaAllocate(hashedName.len+1);
246 }
247 memcpy(strCopy, str, hashedName.len+1);
248 hashedName.str = strCopy;
249
250 DetailIndex index((int)nameToIndex.size());
251 nameToIndex.insert(std::make_pair(hashedName, index));
252 return index;
253 }
254
255 bool ParseRoot(simdjson::dom::element& it, const std::string& curFileName)
256 {

Callers

nothing calls this directly

Calls 5

ArenaAllocateFunction · 0.85
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected