diff options
| author | Matt Davis <Matthew.Davis@sony.com> | 2019-02-27 19:52:02 +0000 |
|---|---|---|
| committer | Matt Davis <Matthew.Davis@sony.com> | 2019-02-27 19:52:02 +0000 |
| commit | 628ab5c6820bdf3bb5a8e494b0fd9e7312ce7150 (patch) | |
| tree | 98e083cd809584b5905e0d02ad6792ec0aa751f2 | |
| parent | ac96a92d8256c1cdd8f1317d992e1af9d7ccabe5 (diff) | |
| download | bcm5719-llvm-628ab5c6820bdf3bb5a8e494b0fd9e7312ce7150.tar.gz bcm5719-llvm-628ab5c6820bdf3bb5a8e494b0fd9e7312ce7150.zip | |
Revert "[llvm-cxxfilt] Split and demangle stdin input on certain non-alphanumerics."
This reverts commit 5cd5f8f2563395f8767f94604eb4c4bea8dcbea0.
The test passes on linux, but fails on the windows build-bots.
This test failure seems to be a quoting issue between my test and
FileCheck on Windows. I'm reverting this patch until I can replicate
and fix in my Windows environment.
llvm-svn: 355021
| -rw-r--r-- | llvm/test/tools/llvm-cxxfilt/delimiters.test | 63 | ||||
| -rw-r--r-- | llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp | 45 |
2 files changed, 7 insertions, 101 deletions
diff --git a/llvm/test/tools/llvm-cxxfilt/delimiters.test b/llvm/test/tools/llvm-cxxfilt/delimiters.test deleted file mode 100644 index e13e9f05436..00000000000 --- a/llvm/test/tools/llvm-cxxfilt/delimiters.test +++ /dev/null @@ -1,63 +0,0 @@ -RUN: echo ',,_Z3Foo!' \ -RUN: '_Z3Foo"' \ -RUN: '_Z3Foo#' \ -RUN: '_Z3Foo%' \ -RUN: '_Z3Foo&' \ -RUN: "_Z3Foo'" \ -RUN: '_Z3Foo(' \ -RUN: '_Z3Foo)' \ -RUN: '_Z3Foo*' \ -RUN: '_Z3Foo+' \ -RUN: '_Z3Foo,' \ -RUN: '_Z3Foo-' \ -RUN: '_Z3Foo/' \ -RUN: '_Z3Foo:' \ -RUN: '_Z3Foo;' \ -RUN: '_Z3Foo<' \ -RUN: '_Z3Foo=' \ -RUN: '_Z3Foo>' \ -RUN: '_Z3Foo?' \ -RUN: '_Z3Foo@' \ -RUN: '_Z3Foo[' \ -RUN: '_Z3Foo\' \ -RUN: '_Z3Foo]' \ -RUN: '_Z3Foo^' \ -RUN: '_Z3Foo`' \ -RUN: '_Z3Foo{' \ -RUN: '_Z3Foo|' \ -RUN: '_Z3Foo}' \ -RUN: '_Z3Foo~,,' \ -RUN: '_Z3Foo,,_Z3Bar::_Z3Baz _Z3Foo,_Z3Bar:_Z3Baz' \ -RUN: '_Z3Foo$ ._Z3Foo' | llvm-cxxfilt | FileCheck %s - -CHECK: ,,Foo! -CHECK: Foo" -CHECK: Foo# -CHECK: Foo% -CHECK: Foo& -CHECK: Foo' -CHECK: Foo( -CHECK: Foo) -CHECK: Foo* -CHECK: Foo+ -CHECK: Foo, -CHECK: Foo- -CHECK: Foo/ -CHECK: Foo: -CHECK: Foo; -CHECK: Foo< -CHECK: Foo= -CHECK: Foo> -CHECK: Foo? -CHECK: Foo@ -CHECK: Foo[ -CHECK: Foo\ -CHECK: Foo] -CHECK: Foo^ -CHECK: Foo` -CHECK: Foo{ -CHECK: Foo| -CHECK: Foo} -CHECK: Foo~,, -CHECK: Foo,,Bar::Baz Foo,Bar:Baz -CHECK: _Z3Foo$ ._Z3Foo diff --git a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp index a082dc7cfe8..e0850444d6f 100644 --- a/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp +++ b/llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp @@ -78,50 +78,19 @@ static std::string demangle(llvm::raw_ostream &OS, const std::string &Mangled) { return Result; } -// Split 'Source' on any character that fails to pass 'IsLegalChar'. The -// returned vector consists of pairs where 'first' is the delimited word, and -// 'second' are the delimiters following that word. -static void SplitStringDelims( - StringRef Source, - SmallVectorImpl<std::pair<StringRef, StringRef>> &OutFragments, - function_ref<bool(char)> IsLegalChar) { - // The beginning of the input string. - const auto Head = Source.begin(); - - // Obtain any leading delimiters. - auto Start = std::find_if(Head, Source.end(), IsLegalChar); - if (Start != Head) - OutFragments.push_back({"", Source.slice(0, Start - Head)}); - - // Capture each word and the delimiters following that word. - while (Start != Source.end()) { - Start = std::find_if(Start, Source.end(), IsLegalChar); - auto End = std::find_if_not(Start, Source.end(), IsLegalChar); - auto DEnd = std::find_if(End, Source.end(), IsLegalChar); - OutFragments.push_back({Source.slice(Start - Head, End - Head), - Source.slice(End - Head, DEnd - Head)}); - Start = DEnd; - } -} - -// This returns true if 'C' is a character that can show up in an -// Itanium-mangled string. -static bool IsLegalItaniumChar(char C) { - // Itanium CXX ABI [External Names]p5.1.1: - // '$' and '.' in mangled names are reserved for private implementations. - return isalnum(C) || C == '.' || C == '$' || C == '_'; -} - // If 'Split' is true, then 'Mangled' is broken into individual words and each // word is demangled. Otherwise, the entire string is treated as a single // mangled item. The result is output to 'OS'. static void demangleLine(llvm::raw_ostream &OS, StringRef Mangled, bool Split) { std::string Result; if (Split) { - SmallVector<std::pair<StringRef, StringRef>, 16> Words; - SplitStringDelims(Mangled, Words, IsLegalItaniumChar); - for (const auto &Word : Words) - Result += demangle(OS, Word.first) + Word.second.str(); + SmallVector<StringRef, 16> Words; + SplitString(Mangled, Words); + for (auto Word : Words) + Result += demangle(OS, Word) + ' '; + // Remove the trailing space character. + if (Result.back() == ' ') + Result.pop_back(); } else Result = demangle(OS, Mangled); OS << Result << '\n'; |

