From deffae5da123b32098914d8346bf4358a6792bdc Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 11 May 2024 11:38:52 -0700 Subject: [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". --- clang/lib/Basic/LangOptions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Basic/LangOptions.cpp') diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index a0adfbf..2b90646 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -48,7 +48,7 @@ void LangOptions::resetNonModularOptions() { bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const { for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i) - if (FuncName.equals(NoBuiltinFuncs[i])) + if (FuncName == NoBuiltinFuncs[i]) return true; return false; } -- cgit v1.1