Skip to content

Commit 1b7055d

Browse files
committed
[Gardening] Change calls of getName().isOperator() to isOperator()
1 parent 7af65d9 commit 1b7055d

File tree

9 files changed

+11
-12
lines changed

9 files changed

+11
-12
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static bool isInPrivateOrLocalContext(const ValueDecl *D) {
376376
}
377377

378378
void ASTMangler::appendDeclName(const ValueDecl *decl) {
379-
if (decl->getName().isOperator()) {
379+
if (decl->isOperator()) {
380380
appendIdentifier(translateOperator(decl->getName().str()));
381381
switch (decl->getAttrs().getUnaryOperatorKind()) {
382382
case UnaryOperatorKind::Prefix:

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ DescriptiveDeclKind Decl::getDescriptiveKind() const {
191191
return DescriptiveDeclKind::MaterializeForSet;
192192
}
193193

194-
if (!func->getName().empty() && func->getName().isOperator())
194+
if (func->isOperator())
195195
return DescriptiveDeclKind::OperatorFunction;
196196

197197
if (func->getDeclContext()->isLocalContext())

lib/AST/Expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ bool Expr::canAppendCallParentheses() const {
662662
return true;
663663

664664
case ExprKind::DeclRef:
665-
return !cast<DeclRefExpr>(this)->getDecl()->getName().isOperator();
665+
return !cast<DeclRefExpr>(this)->getDecl()->isOperator();
666666

667667
case ExprKind::SuperRef:
668668
case ExprKind::OtherConstructorDeclRef:
@@ -676,7 +676,7 @@ bool Expr::canAppendCallParentheses() const {
676676
auto *overloadedExpr = cast<OverloadedDeclRefExpr>(this);
677677
if (overloadedExpr->getDecls().empty())
678678
return false;
679-
return !overloadedExpr->getDecls().front()->getName().isOperator();
679+
return !overloadedExpr->getDecls().front()->isOperator();
680680
}
681681

682682
case ExprKind::UnresolvedDeclRef:

lib/AST/Mangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ void Mangler::bindGenericParameters(const DeclContext *DC) {
368368
}
369369

370370
static OperatorFixity getDeclFixity(const ValueDecl *decl) {
371-
if (!decl->getName().isOperator())
371+
if (!decl->isOperator())
372372
return OperatorFixity::NotOperator;
373373

374374
switch (decl->getAttrs().getUnaryOperatorKind()) {

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void SourceLookupCache::doPopulateCache(Range decls,
180180
bool onlyOperators) {
181181
for (Decl *D : decls) {
182182
if (ValueDecl *VD = dyn_cast<ValueDecl>(D))
183-
if (onlyOperators ? VD->getName().isOperator() : VD->hasName()) {
183+
if (onlyOperators ? VD->isOperator() : VD->hasName()) {
184184
// Cache the value under both its compound name and its full name.
185185
TopLevelValues.add(VD);
186186
}

lib/Sema/CSSolver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,12 +2317,11 @@ static bool shortCircuitDisjunctionAt(Constraint *constraint,
23172317
// overloaded operators.
23182318
if (constraint->getKind() == ConstraintKind::BindOverload &&
23192319
constraint->getOverloadChoice().getKind() == OverloadChoiceKind::Decl &&
2320-
constraint->getOverloadChoice().getDecl()->getName().isOperator() &&
2320+
constraint->getOverloadChoice().getDecl()->isOperator() &&
23212321
successfulConstraint->getKind() == ConstraintKind::BindOverload &&
23222322
successfulConstraint->getOverloadChoice().getKind()
23232323
== OverloadChoiceKind::Decl &&
2324-
successfulConstraint->getOverloadChoice().getDecl()->getName()
2325-
.isOperator() &&
2324+
successfulConstraint->getOverloadChoice().getDecl()->isOperator() &&
23262325
constraint->getOverloadChoice().getDecl()->getInterfaceType()
23272326
->is<GenericFunctionType>() &&
23282327
!successfulConstraint->getOverloadChoice().getDecl()->getInterfaceType()

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ void AttributeChecker::checkOperatorAttribute(DeclAttribute *attr) {
10601060

10611061
// Only functions with an operator identifier can be declared with as an
10621062
// operator.
1063-
if (!FD->getName().isOperator()) {
1063+
if (!FD->isOperator()) {
10641064
TC.diagnose(D->getStartLoc(), diag::attribute_requires_operator_identifier,
10651065
attr->getAttrName());
10661066
attr->setInvalid();

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ WitnessChecker::lookupValueWitnesses(ValueDecl *req, bool *ignoringNames) {
13271327
assert(!isa<AssociatedTypeDecl>(req) && "Not for lookup for type witnesses*");
13281328

13291329
SmallVector<ValueDecl *, 4> witnesses;
1330-
if (req->getName().isOperator()) {
1330+
if (req->isOperator()) {
13311331
// Operator lookup is always global.
13321332
auto lookupOptions = defaultUnqualifiedLookupOptions;
13331333
if (!DC->isCascadingContextForLookup(false))

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ void SwiftLangSupport::findRelatedIdentifiersInFile(
17101710
isa<DestructorDecl>(VD) ||
17111711
isa<SubscriptDecl>(VD)))
17121712
return;
1713-
if (VD->getName().isOperator())
1713+
if (VD->isOperator())
17141714
return;
17151715

17161716
RelatedIdScanner Scanner(SrcFile, BufferID, VD, Ranges);

0 commit comments

Comments
 (0)