-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into somethingElse
- Loading branch information
Showing
46 changed files
with
433 additions
and
546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "Demangler.h" | ||
#ifdef __GNUG__ | ||
#include <cstdlib> | ||
#include <cxxabi.h> | ||
#include <memory> | ||
#include <typeinfo> | ||
|
||
std::string Demangler::Demangle(const char* name) { | ||
// some arbitrary value to eliminate the compiler warning | ||
// -4 is not a valid return value for __cxa_demangle so we'll use that. | ||
int status = -4; | ||
|
||
// __cxa_demangle requires that we free the returned char* | ||
std::unique_ptr<char, void (*)(void*)> res{ | ||
abi::__cxa_demangle(name, NULL, NULL, &status), | ||
std::free | ||
}; | ||
|
||
return (status == 0) ? res.get() : ""; | ||
} | ||
|
||
#else // __GNUG__ | ||
|
||
// does nothing if not g++ | ||
std::string Demangler::Demangle(const char* name) { | ||
return name; | ||
} | ||
|
||
#endif // __GNUG__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace Demangler { | ||
// Given a char* containing a mangled name, return a std::string containing the demangled name. | ||
// If the function fails for any reason, it returns an empty string. | ||
std::string Demangle(const char* name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.