Skip to content

Commit d72f5b1

Browse files
committed
Update StringRef::equals references to operator==
`equals` has been deprecated upstream, use `operator==` instead.
1 parent 11696cd commit d72f5b1

35 files changed

+93
-95
lines changed

include/swift/AST/Attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,7 @@ class DeclAttributes {
28752875
/// Return whether this attribute set includes the given semantics attribute.
28762876
bool hasSemanticsAttr(StringRef attrValue) const {
28772877
return llvm::any_of(getSemanticsAttrs(), [&](const SemanticsAttr *attr) {
2878-
return attrValue.equals(attr->Value);
2878+
return attrValue == attr->Value;
28792879
});
28802880
}
28812881

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6590,7 +6590,7 @@ class VarDecl : public AbstractStorageDecl {
65906590
/// attribute.
65916591
bool hasSemanticsAttr(StringRef attrValue) const {
65926592
return llvm::any_of(getSemanticsAttrs(), [&](const SemanticsAttr *attr) {
6593-
return attrValue.equals(attr->Value);
6593+
return attrValue == attr->Value;
65946594
});
65956595
}
65966596

include/swift/AST/Identifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Identifier {
9696
bool nonempty() const { return !empty(); }
9797

9898
LLVM_ATTRIBUTE_USED bool is(StringRef string) const {
99-
return str().equals(string);
99+
return str() == string;
100100
}
101101

102102
/// isOperator - Return true if this identifier is an operator, false if it is

include/swift/Basic/JSONSerialization.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ inline bool isNumeric(llvm::StringRef S) {
355355
return false;
356356
}
357357

358-
inline bool isNull(llvm::StringRef S) { return S.equals("null"); }
358+
inline bool isNull(llvm::StringRef S) { return S == "null"; }
359359

360360
inline bool isBool(llvm::StringRef S) {
361-
return S.equals("true") || S.equals("false");
361+
return S == "true" || S == "false";
362362
}
363363

364364
template<typename T>

include/swift/Frontend/InputFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class InputFile final {
9595
/// llvm::MemoryBuffer::getFileOrSTDIN, which uses "<stdin>" instead of "-".
9696
static StringRef convertBufferNameFromLLVM_getFileOrSTDIN_toSwiftConventions(
9797
StringRef filename) {
98-
return filename.equals("<stdin>") ? "-" : filename;
98+
return filename == "<stdin>" ? "-" : filename;
9999
}
100100

101101
/// Retrieves the name of the output file corresponding to this input.

include/swift/SIL/SILLocation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class SILLocation {
7171

7272
inline bool operator==(const FilenameAndLocation &rhs) const {
7373
return line == rhs.line && column == rhs.column &&
74-
filename.equals(rhs.filename);
74+
filename == rhs.filename;
7575
}
7676

7777
void dump() const;

include/swift/SILOptimizer/PassManager/PassPipeline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct SILPassPipeline final {
4242

4343
friend bool operator==(const SILPassPipeline &lhs,
4444
const SILPassPipeline &rhs) {
45-
return lhs.ID == rhs.ID && lhs.Name.equals(rhs.Name) &&
45+
return lhs.ID == rhs.ID && lhs.Name == rhs.Name &&
4646
lhs.KindOffset == rhs.KindOffset;
4747
}
4848

lib/ClangImporter/ImportDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5306,8 +5306,8 @@ namespace {
53065306

53075307
// Add inferred attributes.
53085308
#define INFERRED_ATTRIBUTES(ModuleName, ClassName, AttributeSet) \
5309-
if (name.str().equals(#ClassName) && \
5310-
result->getParentModule()->getName().str().equals(#ModuleName)) { \
5309+
if (name.str() == #ClassName && \
5310+
result->getParentModule()->getName().str() == #ModuleName) { \
53115311
using namespace inferred_attributes; \
53125312
addInferredAttributes(result, AttributeSet); \
53135313
}

lib/Driver/DarwinToolChains.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,19 +379,19 @@ toolchains::Darwin::addArgsToLinkStdlib(ArgStringList &Arguments,
379379
if (context.Args.hasArg(options::OPT_runtime_compatibility_version)) {
380380
auto value = context.Args.getLastArgValue(
381381
options::OPT_runtime_compatibility_version);
382-
if (value.equals("5.0")) {
382+
if (value == "5.0") {
383383
runtimeCompatibilityVersion = llvm::VersionTuple(5, 0);
384-
} else if (value.equals("5.1")) {
384+
} else if (value == "5.1") {
385385
runtimeCompatibilityVersion = llvm::VersionTuple(5, 1);
386-
} else if (value.equals("5.5")) {
386+
} else if (value == "5.5") {
387387
runtimeCompatibilityVersion = llvm::VersionTuple(5, 5);
388-
} else if (value.equals("5.6")) {
388+
} else if (value == "5.6") {
389389
runtimeCompatibilityVersion = llvm::VersionTuple(5, 6);
390-
} else if (value.equals("5.8")) {
390+
} else if (value == "5.8") {
391391
runtimeCompatibilityVersion = llvm::VersionTuple(5, 8);
392-
} else if (value.equals("6.0")) {
392+
} else if (value == "6.0") {
393393
runtimeCompatibilityVersion = llvm::VersionTuple(6, 0);
394-
} else if (value.equals("none")) {
394+
} else if (value == "none") {
395395
runtimeCompatibilityVersion = std::nullopt;
396396
} else {
397397
// TODO: diagnose unknown runtime compatibility version?

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ void Driver::buildInputs(const ToolChain &TC,
936936
file_types::ID Ty = file_types::TY_INVALID;
937937

938938
// stdin must be handled specially.
939-
if (Value.equals("-")) {
939+
if (Value == "-") {
940940
// By default, treat stdin as Swift input.
941941
Ty = file_types::TY_Swift;
942942
} else {

0 commit comments

Comments
 (0)