mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Demangler] Stable parent identifier in OpaqueReturnTypeParent
`OpaqueReturnTypeParent` node now references the parent with a mangled parent name, rather than a parent pointer. This makes trees obtained from different demanglers (or calls to `Demangler::demangleSymbol`) for the same symbol equal.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Demangling/Demangle.h"
|
||||
#include "swift/Demangling/Demangler.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace swift::Demangle;
|
||||
@@ -43,3 +44,17 @@ TEST(Demangle, CustomGenericParameterNames) {
|
||||
std::string Result = demangleSymbolAsString(SymbolName, Options);
|
||||
EXPECT_STREQ(DemangledName.c_str(), Result.c_str());
|
||||
}
|
||||
|
||||
TEST(Demangle, DeepEquals) {
|
||||
static std::string Symbols[]{
|
||||
#define SYMBOL(Mangled, Demangled) Mangled,
|
||||
#include "ManglingTestData.def"
|
||||
};
|
||||
for (const auto &Symbol : Symbols) {
|
||||
Demangler D1;
|
||||
Demangler D2;
|
||||
auto tree1 = D1.demangleSymbol(Symbol);
|
||||
auto tree2 = D2.demangleSymbol(Symbol);
|
||||
EXPECT_TRUE(tree1->isDeepEqualTo(tree2)) << "Failing symbol: " << Symbol;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user