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/ParseDecl.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/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 5b5fc02..7fbaee5 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3889,7 +3889,7 @@ void Parser::ParseDeclarationSpecifiers( // parse errors if this really is a __declspec attribute. Attempt to // recognize that scenario and recover gracefully. if (!getLangOpts().DeclSpecKeyword && Tok.is(tok::identifier) && - Tok.getIdentifierInfo()->getName().equals("__declspec")) { + Tok.getIdentifierInfo()->getName() == "__declspec") { Diag(Loc, diag::err_ms_attributes_not_enabled); // The next token should be an open paren. If it is, eat the entire |