Skip to content

Commit d6a4dd3

Browse files
authored
Merge pull request #1741 from jere8184/enum_test
remove msvc class or struct prefix in util::demangle
2 parents fe60b2b + b424f67 commit d6a4dd3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libopenage/util/compiler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2024 the openage authors. See copying.md for legal info.
1+
// Copyright 2015-2025 the openage authors. See copying.md for legal info.
22

33
#include "compiler.h"
44

@@ -24,10 +24,10 @@ namespace util {
2424

2525
std::string demangle(const char *symbol) {
2626
#ifdef _WIN32
27-
// TODO: demangle names for MSVC; Possibly using UnDecorateSymbolName
28-
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms681400(v=vs.85).aspx
29-
// Could it be that MSVC's typeid(T).name() already returns a demangled name? It seems that .raw_name() returns the mangled name
30-
return symbol;
27+
// MSVC's typeid(T).name() already returns a demangled name
28+
// unlike clang and gcc the MSVC demangled name is prefixed with "class " or "stuct "
29+
// we remove the prefix to match the format of clang and gcc
30+
return strchr(symbol, ' ') + 1;
3131
#else
3232
int status;
3333
char *buf = abi::__cxa_demangle(symbol, nullptr, nullptr, &status);

0 commit comments

Comments
 (0)