[clang] [Driver] Use != instead of compare to compare strings (NFC) (PR #113651)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 22:34:48 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113651
None
>From 0e6ea5f32dc77ba2c81f45d6530e301da85e6e91 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 24 Oct 2024 15:59:14 -0700
Subject: [PATCH] [Driver] Use != instead of compare to compare strings (NFC)
---
clang/lib/Driver/ToolChains/Clang.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
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