Skip to content

Commit 6a8598a

Browse files
committed
[NFC] Remove DeclNameRef staging calls
1 parent addbe3e commit 6a8598a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+146
-179
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,7 @@ class ValueDecl : public Decl {
24622462
/// Generates a DeclNameRef referring to this declaration with as much
24632463
/// specificity as possible.
24642464
DeclNameRef createNameRef() const {
2465-
return DeclNameRef_(getFullName());
2465+
return DeclNameRef(getFullName());
24662466
}
24672467

24682468
/// Retrieve the name to use for this declaration when interoperating

include/swift/AST/DiagnosticEngine.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ namespace swift {
138138

139139
DiagnosticArgument(DeclName D)
140140
: Kind(DiagnosticArgumentKind::Identifier),
141-
IdentifierVal(DeclNameRef_(D)) {}
141+
IdentifierVal(DeclNameRef(D)) {}
142142

143143
DiagnosticArgument(DeclBaseName D)
144144
: Kind(DiagnosticArgumentKind::Identifier),
145-
IdentifierVal(DeclNameRef_(D)) {}
145+
IdentifierVal(DeclNameRef(D)) {}
146146

147147
DiagnosticArgument(Identifier I)
148148
: Kind(DiagnosticArgumentKind::Identifier),
149-
IdentifierVal(DeclNameRef_(I)) {
149+
IdentifierVal(DeclNameRef(I)) {
150150
}
151151

152152
DiagnosticArgument(ObjCSelector S)

include/swift/AST/Expr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ class UnresolvedDeclRefExpr : public Expr {
15031503
static UnresolvedDeclRefExpr *createImplicit(
15041504
ASTContext &C, DeclName name,
15051505
DeclRefKind refKind = DeclRefKind::Ordinary) {
1506-
return new (C) UnresolvedDeclRefExpr(DeclNameRef_(name), refKind,
1506+
return new (C) UnresolvedDeclRefExpr(DeclNameRef(name), refKind,
15071507
DeclNameLoc());
15081508
}
15091509

@@ -2430,7 +2430,7 @@ class UnresolvedDotExpr : public Expr {
24302430
static UnresolvedDotExpr *createImplicit(
24312431
ASTContext &C, Expr *base, DeclName name) {
24322432
return new (C) UnresolvedDotExpr(base, SourceLoc(),
2433-
DeclNameRef_(name), DeclNameLoc(),
2433+
DeclNameRef(name), DeclNameLoc(),
24342434
/*implicit=*/true);
24352435
}
24362436

include/swift/AST/Identifier.h

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -638,26 +638,15 @@ class DeclNameRef {
638638
void *getOpaqueValue() const { return FullName.getOpaqueValue(); }
639639
static DeclNameRef getFromOpaqueValue(void *p);
640640

641-
// *** TRANSITIONAL CODE STARTS HERE ***
642-
643-
// We want all DeclNameRef constructions to be explicit, but they need to be
644-
// threaded through large portions of the compiler, so that would be
645-
// difficult. Instead, we will make uses of DeclNameRef(...) implicit but
646-
// deprecated, and use DeclNameRef_(...) as a stand-in for intentional calls
647-
// to the constructors. The deprecations and DeclNameRef_ function will go
648-
// away before we merge any of this into master.
649-
650-
[[deprecated]] DeclNameRef(DeclName FullName)
641+
explicit DeclNameRef(DeclName FullName)
651642
: FullName(FullName) { }
652643

653-
[[deprecated]] DeclNameRef(DeclBaseName BaseName)
644+
explicit DeclNameRef(DeclBaseName BaseName)
654645
: FullName(BaseName) { }
655646

656-
[[deprecated]] DeclNameRef(Identifier BaseName)
647+
explicit DeclNameRef(Identifier BaseName)
657648
: FullName(BaseName) { }
658649

659-
// *** TRANSITIONAL CODE ENDS HERE ***
660-
661650
/// The name of the declaration being referenced.
662651
DeclName getFullName() const {
663652
return FullName;
@@ -775,38 +764,26 @@ class DeclNameRef {
775764
"only for use within the debugger");
776765
};
777766

778-
// *** TRANSITIONAL CODE STARTS HERE ***
779-
780-
template<typename T>
781-
static DeclNameRef DeclNameRef_(T name) {
782-
#pragma clang diagnostic push
783-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
784-
return DeclNameRef(name);
785-
#pragma clang diagnostic pop
786-
}
787-
788-
// *** TRANSITIONAL CODE ENDS HERE ***
789-
790767
inline DeclNameRef DeclNameRef::getFromOpaqueValue(void *p) {
791-
return DeclNameRef_(DeclName::getFromOpaqueValue(p));
768+
return DeclNameRef(DeclName::getFromOpaqueValue(p));
792769
}
793770

794771
inline DeclNameRef DeclNameRef::withoutArgumentLabels() const {
795-
return DeclNameRef_(getBaseName());
772+
return DeclNameRef(getBaseName());
796773
}
797774

798775
inline DeclNameRef DeclNameRef::withArgumentLabels(
799776
ASTContext &C, ArrayRef<Identifier> argumentNames) const {
800-
return DeclNameRef_(DeclName(C, getBaseName(), argumentNames));
777+
return DeclNameRef(DeclName(C, getBaseName(), argumentNames));
801778
}
802779

803780

804781
inline DeclNameRef DeclNameRef::createSubscript() {
805-
return DeclNameRef_(DeclBaseName::createSubscript());
782+
return DeclNameRef(DeclBaseName::createSubscript());
806783
}
807784

808785
inline DeclNameRef DeclNameRef::createConstructor() {
809-
return DeclNameRef_(DeclBaseName::createConstructor());
786+
return DeclNameRef(DeclBaseName::createConstructor());
810787
}
811788

812789
void simple_display(llvm::raw_ostream &out, DeclNameRef name);
@@ -972,10 +949,10 @@ namespace llvm {
972949
// DeclNameRefs hash just like DeclNames.
973950
template<> struct DenseMapInfo<swift::DeclNameRef> {
974951
static swift::DeclNameRef getEmptyKey() {
975-
return DeclNameRef_(DenseMapInfo<swift::DeclName>::getEmptyKey());
952+
return swift::DeclNameRef(DenseMapInfo<swift::DeclName>::getEmptyKey());
976953
}
977954
static swift::DeclNameRef getTombstoneKey() {
978-
return DeclNameRef_(DenseMapInfo<swift::DeclName>::getTombstoneKey());
955+
return swift::DeclNameRef(DenseMapInfo<swift::DeclName>::getTombstoneKey());
979956
}
980957
static unsigned getHashValue(swift::DeclNameRef Val) {
981958
return DenseMapInfo<swift::DeclName>::getHashValue(Val.getFullName());

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ DECLTYPE *ASTContext::get##NAME##Decl() const { \
833833
/* Note: lookupQualified() will search both the Swift overlay \
834834
* and the Clang module it imports. */ \
835835
SmallVector<ValueDecl *, 1> decls; \
836-
M->lookupQualified(M, DeclNameRef_(getIdentifier(#NAME)), NL_OnlyTypes, \
836+
M->lookupQualified(M, DeclNameRef(getIdentifier(#NAME)), NL_OnlyTypes, \
837837
decls); \
838838
if (decls.size() == 1 && isa<DECLTYPE>(decls[0])) { \
839839
auto decl = cast<DECLTYPE>(decls[0]); \

lib/AST/DocComment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ const ValueDecl *findDefaultProvidedDeclWithDocComment(const ValueDecl *VD) {
414414

415415
SmallVector<ValueDecl *, 2> members;
416416
protocol->lookupQualified(const_cast<ProtocolDecl *>(protocol),
417-
DeclNameRef_(VD->getFullName()),
417+
DeclNameRef(VD->getFullName()),
418418
NLOptions::NL_ProtocolMembers,
419419
members);
420420

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ TypeDecl *EquivalenceClass::lookupNestedType(
18861886
if (decl) {
18871887
SmallVector<ValueDecl *, 2> foundMembers;
18881888
decl->getParentModule()->lookupQualified(
1889-
decl, DeclNameRef_(name),
1889+
decl, DeclNameRef(name),
18901890
NL_QualifiedDefault | NL_OnlyTypes | NL_ProtocolMembers,
18911891
foundMembers);
18921892
for (auto member : foundMembers) {

lib/AST/NameLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,7 @@ CustomAttrNominalRequest::evaluate(Evaluator &evaluator,
23312331

23322332
ComponentIdentTypeRepr *components[2] = {
23332333
new (ctx) SimpleIdentTypeRepr(identTypeRepr->getNameLoc(),
2334-
DeclNameRef_(moduleName)),
2334+
DeclNameRef(moduleName)),
23352335
identTypeRepr
23362336
};
23372337

lib/AST/TypeRepr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ DeclNameRef ComponentIdentTypeRepr::getNameRef() const {
8383
if (IdOrDecl.is<DeclNameRef>())
8484
return IdOrDecl.get<DeclNameRef>();
8585

86-
return DeclNameRef_(IdOrDecl.get<TypeDecl *>()->getFullName());
86+
return IdOrDecl.get<TypeDecl *>()->createNameRef();
8787
}
8888

8989
static void printTypeRepr(const TypeRepr *TyR, ASTPrinter &Printer,

lib/ClangImporter/ImportDecl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5017,7 +5017,7 @@ namespace {
50175017

50185018
if (lookupContext) {
50195019
SmallVector<ValueDecl *, 2> lookup;
5020-
dc->lookupQualified(lookupContext, DeclNameRef_(name),
5020+
dc->lookupQualified(lookupContext, DeclNameRef(name),
50215021
NL_QualifiedDefault | NL_KnownNoDependency,
50225022
lookup);
50235023
bool foundMethod = false;
@@ -6396,7 +6396,7 @@ void SwiftDeclConverter::recordObjCOverride(AbstractFunctionDecl *decl) {
63966396
return;
63976397
// Dig out the Objective-C superclass.
63986398
SmallVector<ValueDecl *, 4> results;
6399-
superDecl->lookupQualified(superDecl, DeclNameRef_(decl->getFullName()),
6399+
superDecl->lookupQualified(superDecl, DeclNameRef(decl->getFullName()),
64006400
NL_QualifiedDefault | NL_KnownNoDependency,
64016401
results);
64026402
for (auto member : results) {
@@ -6469,7 +6469,7 @@ void SwiftDeclConverter::recordObjCOverride(SubscriptDecl *subscript) {
64696469
// operation.
64706470
SmallVector<ValueDecl *, 2> lookup;
64716471
subscript->getModuleContext()->lookupQualified(
6472-
superDecl, DeclNameRef_(subscript->getFullName()),
6472+
superDecl, DeclNameRef(subscript->getFullName()),
64736473
NL_QualifiedDefault | NL_KnownNoDependency, lookup);
64746474

64756475
for (auto result : lookup) {
@@ -7752,7 +7752,7 @@ static void finishTypeWitnesses(
77527752
NL_OnlyTypes |
77537753
NL_ProtocolMembers);
77547754

7755-
dc->lookupQualified(nominal, DeclNameRef_(assocType->getFullName()), options,
7755+
dc->lookupQualified(nominal, DeclNameRef(assocType->getFullName()), options,
77567756
lookupResults);
77577757
for (auto member : lookupResults) {
77587758
auto typeDecl = cast<TypeDecl>(member);

0 commit comments

Comments
 (0)