Skip to content

Commit 3ab63dd

Browse files
authored
Merge pull request swiftlang#28420 from nathawes/accessor-usrs-fix
2 parents 0af22a4 + 77f3cb0 commit 3ab63dd

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

include/swift/AST/ASTMangler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ class ASTMangler : public Mangler {
192192

193193
std::string mangleAccessorEntityAsUSR(AccessorKind kind,
194194
const AbstractStorageDecl *decl,
195-
StringRef USRPrefix);
195+
StringRef USRPrefix,
196+
bool IsStatic);
196197

197198
std::string mangleLocalTypeDecl(const TypeDecl *type);
198199

lib/AST/ASTMangler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,12 @@ std::string ASTMangler::mangleDeclAsUSR(const ValueDecl *Decl,
527527

528528
std::string ASTMangler::mangleAccessorEntityAsUSR(AccessorKind kind,
529529
const AbstractStorageDecl *decl,
530-
StringRef USRPrefix) {
530+
StringRef USRPrefix,
531+
bool isStatic) {
531532
beginManglingWithoutPrefix();
532533
llvm::SaveAndRestore<bool> allowUnnamedRAII(AllowNamelessEntities, true);
533534
Buffer << USRPrefix;
534-
appendAccessorEntity(getCodeForAccessorKind(kind), decl, /*isStatic*/ false);
535+
appendAccessorEntity(getCodeForAccessorKind(kind), decl, isStatic);
535536
// We have a custom prefix, so finalize() won't verify for us. Do it manually.
536537
verify(Storage.str().drop_front(USRPrefix.size()));
537538
return finalize();

lib/AST/USRGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ bool ide::printAccessorUSR(const AbstractStorageDecl *D, AccessorKind AccKind,
305305

306306
Mangle::ASTMangler NewMangler;
307307
std::string Mangled = NewMangler.mangleAccessorEntityAsUSR(AccKind,
308-
SD, getUSRSpacePrefix());
308+
SD, getUSRSpacePrefix(), SD->isStatic());
309309

310310
OS << Mangled;
311311

test/Index/Store/record-sourcefile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// CHECK: struct/Swift | S1 | s:4file2S1V | <no-cgname> | Def,Ref,RelCont -
1010
// CHECK: instance-method/acc-get/Swift | getter:property | s:4file2S1V8propertySivg | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelRec,RelCall,RelAcc,RelCont -
1111
// CHECK: instance-property/Swift | property | [[property_USR:s:4file2S1V8propertySivp]] | <no-cgname> | Def,Ref,Read,RelChild,RelCont -
12-
// CHECK: static-method/acc-get/Swift | getter:staticProperty | s:4file2S1V14staticPropertySivg | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelRec,RelCall,RelAcc,RelCont -
12+
// CHECK: static-method/acc-get/Swift | getter:staticProperty | s:4file2S1V14staticPropertySivgZ | <no-cgname> | Def,Ref,Call,Impl,RelChild,RelRec,RelCall,RelAcc,RelCont -
1313
// CHECK: static-property/Swift | staticProperty | s:{{.*}} | <no-cgname> | Def,Ref,Read,RelChild,RelCont -
1414
// CHECK: instance-property/Swift | computedPropertyGetSet | s:{{.*}} | <no-cgname> | Def,RelChild -
1515
// CHECK: struct/Swift | Int | s:Si | <no-cgname> | Ref -

test/Index/kinds.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,16 @@ class AClass {
108108
}
109109

110110
// ClassProperty
111-
class let classProperty = 1
112-
// CHECK: [[@LINE-1]]:13 | class-property/Swift | classProperty | s:14swift_ide_test6AClassC13classPropertySivpZ | Def,RelChild | rel: 1
111+
class var classProperty: Int!
112+
// CHECK: [[@LINE-1]]:13 | class-property/Swift | classProperty | s:14swift_ide_test6AClassC13classPropertySiSgvpZ | Def,RelChild | rel: 1
113113
// CHECK-NEXT: RelChild | class/Swift | AClass | s:14swift_ide_test6AClassC
114+
// CHECK: [[@LINE-3]]:13 | class-method/acc-get/Swift | getter:classProperty | s:14swift_ide_test6AClassC13classPropertySiSgvgZ | Def,Dyn,Impl,RelChild,RelAcc | rel: 1
114115

115116
// StaticProperty
116-
static let staticProperty = 1
117-
// CHECK: [[@LINE-1]]:14 | static-property/Swift | staticProperty | s:14swift_ide_test6AClassC14staticPropertySivpZ | Def,RelChild | rel: 1
117+
static var staticProperty: Int!
118+
// CHECK: [[@LINE-1]]:14 | static-property/Swift | staticProperty | s:14swift_ide_test6AClassC14staticPropertySiSgvpZ | Def,RelChild | rel: 1
118119
// CHECK-NEXT: RelChild | class/Swift | AClass | s:14swift_ide_test6AClassC
120+
// CHECK: [[@LINE-3]]:14 | static-method/acc-get/Swift | getter:staticProperty | s:14swift_ide_test6AClassC14staticPropertySiSgvgZ | Def,Impl,RelChild,RelAcc | rel: 1
119121

120122
// Constructor
121123
init() {}

0 commit comments

Comments
 (0)