Remove '!' prefix from demangled name and add !DMGL_PARAMS support
This commit is contained in:
parent
817afcd046
commit
5c03599324
|
@ -19,9 +19,6 @@ char* msvc_demangle(const char* sym, int options)
|
||||||
if (!(options & DMGL_ANSI)) {
|
if (!(options & DMGL_ANSI)) {
|
||||||
/* TODO: Wait for LLVM's demangler to get a flag for this */;
|
/* TODO: Wait for LLVM's demangler to get a flag for this */;
|
||||||
}
|
}
|
||||||
if (!(options & DMGL_PARAMS)) {
|
|
||||||
/* TODO: Wait for LLVM's demangler to get a flag for this */;
|
|
||||||
}
|
|
||||||
|
|
||||||
//HACK: We should probably not do this on DMGL_AUTO, but the GNU C++
|
//HACK: We should probably not do this on DMGL_AUTO, but the GNU C++
|
||||||
// demangler also omits the return type even without
|
// demangler also omits the return type even without
|
||||||
|
@ -37,15 +34,14 @@ char* msvc_demangle(const char* sym, int options)
|
||||||
|
|
||||||
auto result = std::string(demangled);
|
auto result = std::string(demangled);
|
||||||
|
|
||||||
//do we want this?
|
|
||||||
if (mangled != sym) {
|
|
||||||
result = std::string(sym, suffix - sym + 1) + result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Use OF_NoTagSpecifier (not currently available as a MSDF_* flag)
|
//TODO: Use OF_NoTagSpecifier (not currently available as a MSDF_* flag)
|
||||||
result = std::regex_replace(result, std::regex("(class|struct|union|enum) "), "");
|
result = std::regex_replace(result, std::regex("(class|struct|union|enum) "), "");
|
||||||
|
|
||||||
result = std::regex_replace(result, std::regex(" (\\*|&)"), "$1");
|
result = std::regex_replace(result, std::regex(" (\\*|&)"), "$1");
|
||||||
|
|
||||||
|
if (!(options & DMGL_PARAMS)) {
|
||||||
|
result = std::regex_replace(result, std::regex(" \(.*\)"), "");
|
||||||
|
}
|
||||||
|
|
||||||
return strdup(result.c_str());
|
return strdup(result.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue