MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / SaveName

Method SaveName

source/name_mapper.cpp:77–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void FriendlyNameMapper::SaveName(uint32_t id,
78 const std::string& suggested_name) {
79 if (name_for_id_.find(id) != name_for_id_.end()) return;
80
81 const std::string sanitized_suggested_name = Sanitize(suggested_name);
82 std::string name = sanitized_suggested_name;
83 auto inserted = used_names_.insert(name);
84 if (!inserted.second) {
85 const std::string base_name = sanitized_suggested_name + "_";
86 for (uint32_t index = 0; !inserted.second; ++index) {
87 name = base_name + to_string(index);
88 inserted = used_names_.insert(name);
89 }
90 }
91 name_for_id_[id] = name;
92}
93
94void FriendlyNameMapper::SaveBuiltInName(uint32_t target_id,
95 uint32_t built_in) {

Callers

nothing calls this directly

Calls 3

to_stringFunction · 0.70
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected