diff --git a/llvm/lib/Demangle/DLangDemangle.cpp b/llvm/lib/Demangle/DLangDemangle.cpp --- a/llvm/lib/Demangle/DLangDemangle.cpp +++ b/llvm/lib/Demangle/DLangDemangle.cpp @@ -200,6 +200,15 @@ // Whether it has more than one symbol size_t NotFirst = false; do { + // Skip over anonymous symbols. + if (*Mangled == '0') { + do + ++Mangled; + while (*Mangled == '0'); + + continue; + } + if (NotFirst) *Demangled << '.'; NotFirst = true; diff --git a/llvm/unittests/Demangle/DLangDemangleTest.cpp b/llvm/unittests/Demangle/DLangDemangleTest.cpp --- a/llvm/unittests/Demangle/DLangDemangleTest.cpp +++ b/llvm/unittests/Demangle/DLangDemangleTest.cpp @@ -34,4 +34,6 @@ std::make_pair("_D88", nullptr), std::make_pair("_D8demangleZ", "demangle"), std::make_pair("_D8demangle4testZ", "demangle.test"), - std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2"))); + std::make_pair("_D8demangle4test5test2Z", "demangle.test.test2"), + std::make_pair("_D8demangle4test0Z", "demangle.test"), + std::make_pair("_D8demangle4test03fooZ", "demangle.test.foo")));