File tree Expand file tree Collapse file tree 6 files changed +27
-4
lines changed Expand file tree Collapse file tree 6 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -236,6 +236,8 @@ class ASTMangler : public Mangler {
236
236
237
237
std::string mangleLocalTypeDecl (const TypeDecl *type);
238
238
239
+ std::string mangleOpaqueTypeDecl (const OpaqueTypeDecl *decl);
240
+
239
241
enum SpecialContext {
240
242
ObjCContext,
241
243
ClangImporterContext,
Original file line number Diff line number Diff line change 29
29
#include " swift/AST/ProtocolConformance.h"
30
30
#include " swift/AST/ProtocolConformanceRef.h"
31
31
#include " swift/Basic/Defer.h"
32
+ #include " swift/Demangling/ManglingMacros.h"
32
33
#include " swift/Demangling/ManglingUtils.h"
33
34
#include " swift/Demangling/Demangler.h"
34
35
#include " swift/Strings.h"
@@ -691,6 +692,12 @@ std::string ASTMangler::mangleLocalTypeDecl(const TypeDecl *type) {
691
692
return finalize ();
692
693
}
693
694
695
+ std::string ASTMangler::mangleOpaqueTypeDecl (const OpaqueTypeDecl *decl) {
696
+ DWARFMangling = true ;
697
+ OptimizeProtocolNames = false ;
698
+ return mangleDeclAsUSR (decl->getNamingDecl (), MANGLING_PREFIX_STR);
699
+ }
700
+
694
701
void ASTMangler::appendSymbolKind (SymbolKind SKind) {
695
702
switch (SKind) {
696
703
case SymbolKind::Default: return ;
Original file line number Diff line number Diff line change @@ -7088,7 +7088,7 @@ Identifier OpaqueTypeDecl::getOpaqueReturnTypeIdentifier() const {
7088
7088
{
7089
7089
llvm::raw_svector_ostream os (mangleBuf);
7090
7090
Mangle::ASTMangler mangler;
7091
- os << mangler.mangleDeclAsUSR ( getNamingDecl (), MANGLING_PREFIX_STR );
7091
+ os << mangler.mangleOpaqueTypeDecl ( this );
7092
7092
}
7093
7093
7094
7094
OpaqueReturnTypeIdentifier = getASTContext ().getIdentifier (mangleBuf);
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
55
55
// / describe what change you made. The content of this comment isn't important;
56
56
// / it just ensures a conflict if two people change the module format.
57
57
// / Don't worry about adhering to the 80-column limit for this line.
58
- const uint16_t SWIFTMODULE_VERSION_MINOR = 552 ; // simple didSet
58
+ const uint16_t SWIFTMODULE_VERSION_MINOR = 553 ; // change to USR mangling
59
59
60
60
// / A standard hash seed used for all string hashes in a serialized module.
61
61
// /
Original file line number Diff line number Diff line change @@ -5067,8 +5067,7 @@ void Serializer::writeAST(ModuleOrSourceFile DC) {
5067
5067
for (auto OTD : opaqueReturnTypeDecls) {
5068
5068
hasOpaqueReturnTypes = true ;
5069
5069
Mangle::ASTMangler Mangler;
5070
- auto MangledName = Mangler.mangleDeclAsUSR (OTD->getNamingDecl (),
5071
- MANGLING_PREFIX_STR);
5070
+ auto MangledName = Mangler.mangleOpaqueTypeDecl (OTD);
5072
5071
opaqueReturnTypeGenerator.insert (MangledName, addDeclRef (OTD));
5073
5072
}
5074
5073
}
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir -g %s -disable-availability-checking
2
+
3
+ public protocol P {
4
+ associatedtype Horse
5
+ }
6
+
7
+ public protocol Feed { }
8
+
9
+ public struct Hay : Feed { }
10
+
11
+ public func hasOpaqueResult< T : P > ( _: T . Type , _: T . Horse ) -> some Feed {
12
+ return Hay ( )
13
+ }
14
+
15
+
You can’t perform that action at this time.
0 commit comments