summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm/llvm-nm.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2017-06-30 05:38:56 +0000
committerEric Christopher <echristo@gmail.com>2017-06-30 05:38:56 +0000
commitdbb92cad2e4c0107e1a1cbfe708f377cfb53cb98 (patch)
tree72dee05957d9ba87c521e09adf867e9c49427ff6 /llvm/tools/llvm-nm/llvm-nm.cpp
parentb853ef99474f338e93d2402641aa4643441d34f9 (diff)
downloadbcm5719-llvm-dbb92cad2e4c0107e1a1cbfe708f377cfb53cb98.tar.gz
bcm5719-llvm-dbb92cad2e4c0107e1a1cbfe708f377cfb53cb98.zip
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. llvm-svn: 306788
Diffstat (limited to 'llvm/tools/llvm-nm/llvm-nm.cpp')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index b25c4775e8d..ea47891250f 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -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) {
OpenPOWER on IntegriCloud