Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove msvc class or struct prefix in util::demangle #1741

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libopenage/util/compiler.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2024 the openage authors. See copying.md for legal info.
// Copyright 2015-2025 the openage authors. See copying.md for legal info.

#include "compiler.h"

Expand All @@ -24,10 +24,10 @@ namespace util {

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