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
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) {