Skip to content

Commit 9074136

Browse files
committed
RemoteAST: Add experimental swift::remoteAST::getTypeForMangling() entry point
This will eventually replace swift::ide::getTypeFromMangledSymbolname().
1 parent 2f901a7 commit 9074136

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/swift/RemoteAST/RemoteAST.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ class RemoteASTContext {
221221
Type staticType);
222222
};
223223

224+
Type getTypeForMangling(ASTContext &ctx,
225+
StringRef mangling);
226+
224227
} // end namespace remoteAST
225228
} // end namespace swift
226229

lib/RemoteAST/RemoteAST.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "swift/AST/TypeRepr.h"
3030
#include "swift/Basic/Mangler.h"
3131
#include "swift/ClangImporter/ClangImporter.h"
32+
#include "swift/Demangling/Demangler.h"
3233
#include "llvm/ADT/StringSwitch.h"
3334

3435
// TODO: Develop a proper interface for this.
@@ -1342,3 +1343,14 @@ RemoteASTContext::getDynamicTypeAndAddressForExistential(
13421343
return asImpl(Impl)->getDynamicTypeAndAddressForExistential(address,
13431344
staticType);
13441345
}
1346+
1347+
Type swift::remoteAST::getTypeForMangling(ASTContext &ctx,
1348+
StringRef mangling) {
1349+
Demangle::Context Dem;
1350+
auto node = Dem.demangleSymbolAsNode(mangling);
1351+
if (!node)
1352+
return Type();
1353+
1354+
RemoteASTTypeBuilder builder(ctx);
1355+
return swift::Demangle::decodeMangledType(builder, node);
1356+
}

0 commit comments

Comments
 (0)