[flang-commits] [flang] d0f1283 - [flang] Simplify string comparisons (NFC)
Kazu Hirata via flang-commits
flang-commits at lists.llvm.org
Sat Aug 27 21:21:32 PDT 2022
Author: Kazu Hirata
Date: 2022-08-27T21:21:04-07:00
New Revision: d0f1283e6b48acb67c1f43e851f6aea2a5f2f516
URL: https://github.com/llvm/llvm-project/commit/d0f1283e6b48acb67c1f43e851f6aea2a5f2f516
DIFF: https://github.com/llvm/llvm-project/commit/d0f1283e6b48acb67c1f43e851f6aea2a5f2f516.diff
LOG: [flang] Simplify string comparisons (NFC)
Identified with readability-string-compare.
Added:
Modified:
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index cce4da38bc405..88e6298d73c58 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -796,7 +796,7 @@ void CompilerInvocation::setFortranOpts() {
// Add the directory supplied through -J/-module-dir to the list of search
// directories
- if (moduleDirJ.compare(".") != 0)
+ if (moduleDirJ != ".")
fortranOptions.searchDirectories.emplace_back(moduleDirJ);
if (frontendOptions.instrumentedParse)
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 8f558522ef7aa..dc1fffc25b58d 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1690,7 +1690,7 @@ void AttrsVisitor::SetBindNameOn(Symbol &symbol) {
symbol.SetBindName(std::move(*label));
if (!oldBindName.empty()) {
if (const std::string * newBindName{symbol.GetBindName()}) {
- if (oldBindName.compare(*newBindName) != 0) {
+ if (oldBindName != *newBindName) {
Say(symbol.name(), "The entity '%s' has multiple BIND names"_err_en_US);
}
}
More information about the flang-commits
mailing list