diff options
author | Kazu Hirata <kazu@google.com> | 2024-05-11 11:38:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-11 11:38:52 -0700 |
commit | deffae5da123b32098914d8346bf4358a6792bdc (patch) | |
tree | 3a630538c5cfebe966c39361c602095424c4d656 /clang/lib/Parse/ParseOpenMP.cpp | |
parent | 379b77773cf653352f30f8c7cca393f4df9389be (diff) | |
download | llvm-deffae5da123b32098914d8346bf4358a6792bdc.zip llvm-deffae5da123b32098914d8346bf4358a6792bdc.tar.gz llvm-deffae5da123b32098914d8346bf4358a6792bdc.tar.bz2 |
[clang] Use StringRef::operator== instead of StringRef::equals (NFC) (#91844)
I'm planning to remove StringRef::equals in favor of
StringRef::operator==.
- StringRef::operator==/!= outnumber StringRef::equals by a factor of
24 under clang/ 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 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r-- | clang/lib/Parse/ParseOpenMP.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 18ba1185..53eabe0 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -740,7 +740,7 @@ static bool parseDeclareSimdClauses( BS = Out; BSRange = SourceRange(Tok.getLocation(), Tok.getEndLoc()); P.ConsumeToken(); - } else if (ClauseName.equals("simdlen")) { + } else if (ClauseName == "simdlen") { if (SimdLen.isUsable()) { P.Diag(Tok, diag::err_omp_more_one_clause) << getOpenMPDirectiveName(OMPD_declare_simd) << ClauseName << 0; @@ -1106,7 +1106,7 @@ static ExprResult parseContextScore(Parser &P) { llvm::SmallString<16> Buffer; StringRef SelectorName = P.getPreprocessor().getSpelling(P.getCurToken(), Buffer); - if (!SelectorName.equals("score")) + if (SelectorName != "score") return ScoreExpr; (void)P.ConsumeToken(); SourceLocation RLoc; |