MCPcopy Create free account
hub / github.com/chigraph/chigraph / unmangleFunctionName

Function unmangleFunctionName

libchigraph/src/NameMangler.cpp:46–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46std::pair<std::string, std::string> unmangleFunctionName(std::string mangled) {
47 if (mangled == "main") { return {"main", "main"}; }
48
49 size_t splitter = mangled.find("_m");
50 std::string modName = mangled.substr(0, splitter);
51 std::string typeName = mangled.substr(splitter + 2);
52
53 size_t id = 0;
54 while ((id = modName.find('_', static_cast<size_t>(id))) != std::string::npos &&
55 modName.size() >= id) {
56 switch (modName[static_cast<size_t>(id + 1)]) {
57 case '_': modName.replace(id, 2, "_"); break;
58 case 's': modName.replace(id, 2, "/"); break;
59 case 'd': modName.replace(id, 2, "."); break;
60 default:
61 assert(false); // TODO: error handling
62 }
63
64 ++id;
65 }
66
67 return {modName, typeName};
68}
69} // namespace chi

Callers 2

nodeFromFrameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected