diff options
author | Kazu Hirata <kazu@google.com> | 2024-05-12 23:08:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-12 23:08:40 -0700 |
commit | f841ca0c355ae53c96f615996d0aff4648da8618 (patch) | |
tree | e8c2bb3726296f0913fcc979ebca9b36d7c014dd /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | e74a34b6932965dfdc182b69f779e5bee551585a (diff) | |
download | llvm-f841ca0c355ae53c96f615996d0aff4648da8618.zip llvm-f841ca0c355ae53c96f615996d0aff4648da8618.tar.gz llvm-f841ca0c355ae53c96f615996d0aff4648da8618.tar.bz2 |
Use StringRef::operator== instead of StringRef::equals (NFC) (#91864)
I'm planning to remove StringRef::equals in favor of
StringRef::operator==.
- StringRef::operator==/!= outnumber StringRef::equals by a factor of
276 under llvm-project/ in terms of their usage.
- The elimination of StringRef::equals brings StringRef closer to
std::string_view, which has operator== but not equals.
- S == "foo" is more readable than S.equals("foo"), especially for
!Long.Expression.equals("str") vs Long.Expression != "str".
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 4318286..db7fd3c 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -883,7 +883,7 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, // -x cuda auto language = args.getLastArgValue(clang::driver::options::OPT_x); - if (language.equals("cuda")) { + if (language == "cuda") { res.getFrontendOpts().features.Enable( Fortran::common::LanguageFeature::CUDA); } @@ -986,7 +986,7 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, if (args.hasArg(clang::driver::options::OPT_std_EQ)) { auto standard = args.getLastArgValue(clang::driver::options::OPT_std_EQ); // We only allow f2018 as the given standard - if (standard.equals("f2018")) { + if (standard == "f2018") { res.setEnableConformanceChecks(); } else { const unsigned diagID = |