[clang] 3a4cceb - [Driver] Use != instead of compare to compare strings (NFC) (#113651)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 23:15:22 PDT 2024
Author: Kazu Hirata
Date: 2024-10-24T23:15:19-07:00
New Revision: 3a4ccebb5c5142c15fb6d72aedadb27205ef33d5
URL: https://github.com/llvm/llvm-project/commit/3a4ccebb5c5142c15fb6d72aedadb27205ef33d5
DIFF: https://github.com/llvm/llvm-project/commit/3a4ccebb5c5142c15fb6d72aedadb27205ef33d5.diff
LOG: [Driver] Use != instead of compare to compare strings (NFC) (#113651)
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 06c44a660e98fb..04b3832327a99c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2838,7 +2838,7 @@ static std::string ComplexArithmeticStr(LangOptions::ComplexRangeKind Range) {
static void EmitComplexRangeDiag(const Driver &D, std::string str1,
std::string str2) {
- if ((str1.compare(str2) != 0) && !str2.empty() && !str1.empty()) {
+ if (str1 != str2 && !str2.empty() && !str1.empty()) {
D.Diag(clang::diag::warn_drv_overriding_option) << str1 << str2;
}
}
@@ -2996,8 +2996,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
EmitComplexRangeDiag(D, RenderComplexRangeOption(Range),
"-fno-cx-limited-range");
} else {
- if (GccRangeComplexOption.compare("-fcx-limited-range") != 0 &&
- GccRangeComplexOption.compare("-fno-cx-fortran-rules") != 0)
+ if (GccRangeComplexOption != "-fcx-limited-range" &&
+ GccRangeComplexOption != "-fno-cx-fortran-rules")
EmitComplexRangeDiag(D, GccRangeComplexOption,
"-fno-cx-limited-range");
}
@@ -3042,8 +3042,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
break;
}
if (!GccRangeComplexOption.empty()) {
- if (GccRangeComplexOption.compare("-fcx-limited-range") != 0) {
- if (GccRangeComplexOption.compare("-fcx-fortran-rules") != 0) {
+ if (GccRangeComplexOption != "-fcx-limited-range") {
+ if (GccRangeComplexOption != "-fcx-fortran-rules") {
if (RangeVal != LangOptions::ComplexRangeKind::CX_Improved)
EmitComplexRangeDiag(D, GccRangeComplexOption,
ComplexArithmeticStr(RangeVal));
More information about the cfe-commits
mailing list