mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Mangling: wire up the new mangling in various places in the compiler, but still use the old mangling.
The purpose of this change is to test if the new mangling is equivalent to the old mangling. Both mangling strings are created, de-mangled and checked if the de-mangle trees are equivalent.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "swift/AST/Types.h"
|
||||
#include "swift/AST/DiagnosticsCommon.h"
|
||||
#include "swift/AST/Mangle.h"
|
||||
#include "swift/AST/ASTMangler.h"
|
||||
#include "swift/SIL/PrettyStackTrace.h"
|
||||
#include "swift/SIL/SILArgument.h"
|
||||
#include "swift/SIL/SILUndef.h"
|
||||
@@ -53,6 +54,8 @@ getMaterializeForSetCallbackName(ProtocolConformance *conformance,
|
||||
closure.getCaptureInfo().setGenericParamCaptures(true);
|
||||
|
||||
Mangle::Mangler mangler;
|
||||
NewMangling::ASTMangler NewMangler;
|
||||
std::string New;
|
||||
if (conformance) {
|
||||
// Concrete witness thunk for a conformance:
|
||||
//
|
||||
@@ -60,14 +63,19 @@ getMaterializeForSetCallbackName(ProtocolConformance *conformance,
|
||||
// within the requirement.
|
||||
mangler.append("_TTW");
|
||||
mangler.mangleProtocolConformance(conformance);
|
||||
New = NewMangler.mangleClosureWitnessThunk(conformance, &closure);
|
||||
} else {
|
||||
// Default witness thunk or concrete implementation:
|
||||
//
|
||||
// Mangle this as if it were a closure within the requirement.
|
||||
mangler.append("_T");
|
||||
New = NewMangler.mangleClosureEntity(&closure,
|
||||
NewMangling::ASTMangler::SymbolKind::Default);
|
||||
}
|
||||
mangler.mangleClosureEntity(&closure, /*uncurryLevel=*/1);
|
||||
return mangler.finalize();
|
||||
std::string Old = mangler.finalize();
|
||||
|
||||
return NewMangling::selectMangling(Old, New);
|
||||
}
|
||||
|
||||
/// A helper class for emitting materializeForSet.
|
||||
|
||||
Reference in New Issue
Block a user