Skip to content

Commit d8f381e

Browse files
authored
Merge pull request #74804 from bnbarham/rename-equals
Update `StringRef::equals` references to `operator==`
2 parents adf7cf9 + d72f5b1 commit d8f381e

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
@@ -6606,7 +6606,7 @@ class VarDecl : public AbstractStorageDecl {
66066606
/// attribute.
66076607
bool hasSemanticsAttr(StringRef attrValue) const {
66086608
return llvm::any_of(getSemanticsAttrs(), [&](const SemanticsAttr *attr) {
6609-
return attrValue.equals(attr->Value);
6609+
return attrValue == attr->Value;
66106610
});
66116611
}
66126612

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
@@ -385,19 +385,19 @@ toolchains::Darwin::addArgsToLinkStdlib(ArgStringList &Arguments,
385385
if (context.Args.hasArg(options::OPT_runtime_compatibility_version)) {
386386
auto value = context.Args.getLastArgValue(
387387
options::OPT_runtime_compatibility_version);
388-
if (value.equals("5.0")) {
388+
if (value == "5.0") {
389389
runtimeCompatibilityVersion = llvm::VersionTuple(5, 0);
390-
} else if (value.equals("5.1")) {
390+
} else if (value == "5.1") {
391391
runtimeCompatibilityVersion = llvm::VersionTuple(5, 1);
392-
} else if (value.equals("5.5")) {
392+
} else if (value == "5.5") {
393393
runtimeCompatibilityVersion = llvm::VersionTuple(5, 5);
394-
} else if (value.equals("5.6")) {
394+
} else if (value == "5.6") {
395395
runtimeCompatibilityVersion = llvm::VersionTuple(5, 6);
396-
} else if (value.equals("5.8")) {
396+
} else if (value == "5.8") {
397397
runtimeCompatibilityVersion = llvm::VersionTuple(5, 8);
398-
} else if (value.equals("6.0")) {
398+
} else if (value == "6.0") {
399399
runtimeCompatibilityVersion = llvm::VersionTuple(6, 0);
400-
} else if (value.equals("none")) {
400+
} else if (value == "none") {
401401
runtimeCompatibilityVersion = std::nullopt;
402402
} else {
403403
// TODO: diagnose unknown runtime compatibility version?

lib/Driver/Driver.cpp

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

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

0 commit comments

Comments
 (0)