Mangling: prepare for using new mangling for USR and debug-info type generation.

Select between old and new mangling as we already do in other places in the compiler.
NFC as long as the new mangling is not enabled yet.
This commit is contained in:
Erik Eckstein
2016-12-05 09:53:05 -08:00
parent 8730f9d5fb
commit a56a97c89f
9 changed files with 58 additions and 37 deletions

View File

@@ -21,6 +21,7 @@
#include "swift/AST/LinkLibrary.h"
#include "swift/AST/Mangle.h"
#include "swift/AST/ProtocolConformance.h"
#include "swift/AST/ASTMangler.h"
#include "swift/AST/RawComment.h"
#include "swift/AST/USRGeneration.h"
#include "swift/Basic/Dwarf.h"
@@ -4197,10 +4198,8 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
for (auto TD : localTypeDecls) {
hasLocalTypes = true;
Mangle::Mangler DebugMangler(false);
DebugMangler.mangleType(TD->getDeclaredInterfaceType(), 0);
auto MangledName = DebugMangler.finalize();
std::string MangledName = NewMangling::mangleTypeAsUSR(
TD->getDeclaredInterfaceType());
assert(!MangledName.empty() && "Mangled type came back empty!");
localTypeGenerator.insert(MangledName, {
addDeclRef(TD), TD->getLocalDiscriminator()