diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-12-07 23:17:05 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-12-07 23:17:05 +0000 |
| commit | 4c5b8cea0208c5c9b847f6234f0a108127dd326a (patch) | |
| tree | b2fb94c87afe47ed2bb7296b35054ece131b24b7 /lld/ELF/Strings.cpp | |
| parent | a45d45e231a6ef811c75f4da8edb8b81cdca2841 (diff) | |
| download | bcm5719-llvm-4c5b8cea0208c5c9b847f6234f0a108127dd326a.tar.gz bcm5719-llvm-4c5b8cea0208c5c9b847f6234f0a108127dd326a.zip | |
Make demangle() return None instead of "" if a given string is not a mangled symbol.
llvm-svn: 288993
Diffstat (limited to 'lld/ELF/Strings.cpp')
| -rw-r--r-- | lld/ELF/Strings.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lld/ELF/Strings.cpp b/lld/ELF/Strings.cpp index 28e50ffca0e..7e5b5ab75f8 100644 --- a/lld/ELF/Strings.cpp +++ b/lld/ELF/Strings.cpp @@ -210,18 +210,18 @@ bool elf::isValidCIdentifier(StringRef S) { } // Returns the demangled C++ symbol name for Name. -std::string elf::demangle(StringRef Name) { +Optional<std::string> elf::demangle(StringRef Name) { // __cxa_demangle can be used to demangle strings other than symbol // names which do not necessarily start with "_Z". Name can be // either a C or C++ symbol. Don't call __cxa_demangle if the name // does not look like a C++ symbol name to avoid getting unexpected // result for a C symbol that happens to match a mangled type name. if (!Name.startswith("_Z")) - return Name; + return None; char *Buf = itaniumDemangle(Name.str().c_str(), nullptr, nullptr, nullptr); if (!Buf) - return Name; + return None; std::string S(Buf); free(Buf); return S; |

