mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Demangler library: add a function swift_demangle_getModuleName to get the module name of a mangled symbol.
rdar://problem/47560963
This commit is contained in:
@@ -87,3 +87,21 @@ TEST(FunctionNameDemangleTests, IgnoresNonMangledInputs) {
|
||||
EXPECT_STREQ("0123456789abcdef", OutputBuffer);
|
||||
}
|
||||
|
||||
TEST(FunctionNameDemangleTests, ModuleName) {
|
||||
const char *Sym1 = "_TtCs5Class";
|
||||
const char *ModuleName1 = "Swift";
|
||||
const char *Sym2 = "_TtCC3Mod7ExampleP33_211017DA67536A354F5F5EB94C7AC12E2Pv";
|
||||
const char *ModuleName2 = "Mod";
|
||||
char OutputBuffer[128];
|
||||
|
||||
size_t Result = swift_demangle_getModuleName(Sym1, OutputBuffer,
|
||||
sizeof(OutputBuffer));
|
||||
EXPECT_STREQ(ModuleName1, OutputBuffer);
|
||||
EXPECT_EQ(Result, strlen(ModuleName1));
|
||||
|
||||
Result = swift_demangle_getModuleName(Sym2, OutputBuffer,
|
||||
sizeof(OutputBuffer));
|
||||
EXPECT_STREQ(ModuleName2, OutputBuffer);
|
||||
EXPECT_EQ(Result, strlen(ModuleName2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user