1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[Demangle] remove itaniumFindTypesInMangledName

Summary:
This (very specialized) function was added to enable an LLDB use case.
Now that a more generic interface (overriding of parser functions -
D52992)  is available, and LLDB has been converted to use that (D54074),
the function is unused and can be removed.

Reviewers: erik.pilkington, sgraenitz, rsmith

Subscribers: mgorny, hiraditya, christof, libcxx-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D54893

llvm-svn: 347670
This commit is contained in:
Pavel Labath 2018-11-27 16:11:24 +00:00
parent d071132496
commit 9101881e58
5 changed files with 0 additions and 55 deletions

View File

@ -31,11 +31,6 @@ enum : int {
char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
int *status);
/// Calls the callback \c Callback with \c Ctx as an argument whenever a type is
/// encountered. Returns true if \c MangledName couldn't be parsed.
bool itaniumFindTypesInMangledName(const char *MangledName, void *Ctx,
void (*Callback)(void *, const char *));
enum MSDemangleFlags { MSDF_None = 0, MSDF_DumpBackrefs = 1 << 0 };
char *microsoftDemangle(const char *mangled_name, char *buf, size_t *n,

View File

@ -2157,9 +2157,6 @@ template <typename Derived, typename Alloc> struct AbstractManglingParser {
// conversion operator's type, and are resolved in the enclosing <encoding>.
PODSmallVector<ForwardTemplateReference *, 4> ForwardTemplateRefs;
void (*TypeCallback)(void *, const char *) = nullptr;
void *TypeCallbackContext = nullptr;
bool TryToParseTemplateArgs = true;
bool PermitForwardTemplateReferences = false;
bool ParsingLambdaParams = false;
@ -3453,9 +3450,6 @@ template <typename Derived, typename Alloc>
Node *AbstractManglingParser<Derived, Alloc>::parseType() {
Node *Result = nullptr;
if (TypeCallback != nullptr)
TypeCallback(TypeCallbackContext, First);
switch (look()) {
// ::= <qualified-type>
case 'r':

View File

@ -356,15 +356,6 @@ char *llvm::itaniumDemangle(const char *MangledName, char *Buf,
return InternalStatus == demangle_success ? Buf : nullptr;
}
bool llvm::itaniumFindTypesInMangledName(const char *MangledName, void *Ctx,
void (*Callback)(void *,
const char *)) {
Demangler Parser(MangledName, MangledName + std::strlen(MangledName));
Parser.TypeCallback = Callback;
Parser.TypeCallbackContext = Ctx;
return Parser.parse() == nullptr;
}
ItaniumPartialDemangler::ItaniumPartialDemangler()
: RootNode(nullptr), Context(new Demangler{nullptr, nullptr}) {}

View File

@ -6,5 +6,4 @@ set(LLVM_LINK_COMPONENTS
add_llvm_unittest(DemangleTests
ItaniumDemangleTest.cpp
PartialDemangleTest.cpp
FindTypesInMangledNameTest.cpp
)

View File

@ -1,34 +0,0 @@
//===------------------ FindTypesInMangledNameTest.cpp --------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <cstdlib>
#include <vector>
#include "llvm/Demangle/Demangle.h"
#include "gtest/gtest.h"
TEST(FindTypesInMangledNameTest, Test) {
std::vector<const char *> Types;
const char *Mangled = "_Z1fiv";
EXPECT_FALSE(llvm::itaniumFindTypesInMangledName(
Mangled, static_cast<void *>(&Types), [](void *Ty, const char *P) {
static_cast<std::vector<const char *> *>(Ty)->push_back(P);
}));
EXPECT_EQ(Types.size(), size_t(2));
EXPECT_EQ(Mangled + 4, Types.front());
EXPECT_EQ(Mangled + 5, Types.back());
EXPECT_TRUE(llvm::itaniumFindTypesInMangledName(
"Not a mangled name!", nullptr, [](void *, const char *) {}));
int TC = 0;
EXPECT_FALSE(llvm::itaniumFindTypesInMangledName(
"_Z1fPRic", static_cast<void *>(&TC),
[](void *Ctx, const char *) { ++*static_cast<int *>(Ctx); }));
EXPECT_EQ(TC, 4); // pointer, reference, int, char.
}