Skip to content

Commit 3a4cceb

Browse files
[Driver] Use != instead of compare to compare strings (NFC) (#113651)
1 parent 240e478 commit 3a4cceb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,7 @@ static std::string ComplexArithmeticStr(LangOptions::ComplexRangeKind Range) {
28382838

28392839
static void EmitComplexRangeDiag(const Driver &D, std::string str1,
28402840
std::string str2) {
2841-
if ((str1.compare(str2) != 0) && !str2.empty() && !str1.empty()) {
2841+
if (str1 != str2 && !str2.empty() && !str1.empty()) {
28422842
D.Diag(clang::diag::warn_drv_overriding_option) << str1 << str2;
28432843
}
28442844
}
@@ -2996,8 +2996,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
29962996
EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
29972997
"-fno-cx-limited-range");
29982998
} else {
2999-
if (GccRangeComplexOption.compare("-fcx-limited-range") != 0 &&
3000-
GccRangeComplexOption.compare("-fno-cx-fortran-rules") != 0)
2999+
if (GccRangeComplexOption != "-fcx-limited-range" &&
3000+
GccRangeComplexOption != "-fno-cx-fortran-rules")
30013001
EmitComplexRangeDiag(D, GccRangeComplexOption,
30023002
"-fno-cx-limited-range");
30033003
}
@@ -3042,8 +3042,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
30423042
break;
30433043
}
30443044
if (!GccRangeComplexOption.empty()) {
3045-
if (GccRangeComplexOption.compare("-fcx-limited-range") != 0) {
3046-
if (GccRangeComplexOption.compare("-fcx-fortran-rules") != 0) {
3045+
if (GccRangeComplexOption != "-fcx-limited-range") {
3046+
if (GccRangeComplexOption != "-fcx-fortran-rules") {
30473047
if (RangeVal != LangOptions::ComplexRangeKind::CX_Improved)
30483048
EmitComplexRangeDiag(D, GccRangeComplexOption,
30493049
ComplexArithmeticStr(RangeVal));

0 commit comments

Comments
 (0)