llvm.org GIT mirror llvm / 07b822e
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347670 91177308-0d34-0410-b5e6-96231b3b80d8 Pavel Labath 9 months ago
5 changed file(s) with 0 addition(s) and 55 deletion(s). Raw diff Collapse all Expand all
2929
3030 char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
3131 int *status);
32
33 /// Calls the callback \c Callback with \c Ctx as an argument whenever a type is
34 /// encountered. Returns true if \c MangledName couldn't be parsed.
35 bool itaniumFindTypesInMangledName(const char *MangledName, void *Ctx,
36 void (*Callback)(void *, const char *));
3732
3833
3934 enum MSDemangleFlags { MSDF_None = 0, MSDF_DumpBackrefs = 1 << 0 };
21562156 // conversion operator's type, and are resolved in the enclosing .
21572157 PODSmallVector ForwardTemplateRefs;
21582158
2159 void (*TypeCallback)(void *, const char *) = nullptr;
2160 void *TypeCallbackContext = nullptr;
2161
21622159 bool TryToParseTemplateArgs = true;
21632160 bool PermitForwardTemplateReferences = false;
21642161 bool ParsingLambdaParams = false;
34513448 template
34523449 Node *AbstractManglingParser::parseType() {
34533450 Node *Result = nullptr;
3454
3455 if (TypeCallback != nullptr)
3456 TypeCallback(TypeCallbackContext, First);
34573451
34583452 switch (look()) {
34593453 // ::=
355355 return InternalStatus == demangle_success ? Buf : nullptr;
356356 }
357357
358 bool llvm::itaniumFindTypesInMangledName(const char *MangledName, void *Ctx,
359 void (*Callback)(void *,
360 const char *)) {
361 Demangler Parser(MangledName, MangledName + std::strlen(MangledName));
362 Parser.TypeCallback = Callback;
363 Parser.TypeCallbackContext = Ctx;
364 return Parser.parse() == nullptr;
365 }
366
367358 ItaniumPartialDemangler::ItaniumPartialDemangler()
368359 : RootNode(nullptr), Context(new Demangler{nullptr, nullptr}) {}
369360
55 add_llvm_unittest(DemangleTests
66 ItaniumDemangleTest.cpp
77 PartialDemangleTest.cpp
8 FindTypesInMangledNameTest.cpp
98 )
+0
-34
unittests/Demangle/FindTypesInMangledNameTest.cpp less more
None //===------------------ FindTypesInMangledNameTest.cpp --------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is dual licensed under the MIT and the University of Illinois Open
5 // Source Licenses. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include
10 #include
11 #include "llvm/Demangle/Demangle.h"
12 #include "gtest/gtest.h"
13
14 TEST(FindTypesInMangledNameTest, Test) {
15 std::vector Types;
16 const char *Mangled = "_Z1fiv";
17 EXPECT_FALSE(llvm::itaniumFindTypesInMangledName(
18 Mangled, static_cast(&Types), [](void *Ty, const char *P) {
19 static_cast *>(Ty)->push_back(P);
20 }));
21 EXPECT_EQ(Types.size(), size_t(2));
22 EXPECT_EQ(Mangled + 4, Types.front());
23 EXPECT_EQ(Mangled + 5, Types.back());
24
25 EXPECT_TRUE(llvm::itaniumFindTypesInMangledName(
26 "Not a mangled name!", nullptr, [](void *, const char *) {}));
27
28 int TC = 0;
29 EXPECT_FALSE(llvm::itaniumFindTypesInMangledName(
30 "_Z1fPRic", static_cast(&TC),
31 [](void *Ctx, const char *) { ++*static_cast(Ctx); }));
32 EXPECT_EQ(TC, 4); // pointer, reference, int, char.
33 }