mirror of
https://github.com/RPCSX/llvm.git
synced 2026-01-31 01:05:23 +01:00
Rewrite demangle memory handling.
The return of itaniumDemangle is allocated with malloc rather than new[] and so using unique_ptr isn't called for here. As a note for the future we should rewrite it to do this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306788 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -672,12 +672,14 @@ static Optional<std::string> demangle(StringRef Name, bool StripUnderscore) {
|
||||
return None;
|
||||
|
||||
int Status;
|
||||
std::unique_ptr<char[]> Undecorated(
|
||||
itaniumDemangle(Name.str().c_str(), nullptr, nullptr, &Status));
|
||||
char *Undecorated =
|
||||
itaniumDemangle(Name.str().c_str(), nullptr, nullptr, &Status);
|
||||
if (Status != 0)
|
||||
return None;
|
||||
|
||||
return std::string(Undecorated.get());
|
||||
std::string S(Undecorated);
|
||||
free(Undecorated);
|
||||
return S;
|
||||
}
|
||||
|
||||
static bool symbolIsDefined(const NMSymbol &Sym) {
|
||||
|
||||
Reference in New Issue
Block a user