https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/92708
StringRef) (NFC), >From cf3992f72b340cd402709c24bb8363a2f896635e Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Sun, 19 May 2024 09:22:14 -0700 Subject: [PATCH] [clang] Use operator==(StringRef, StringRef) (NFC) --- clang-tools-extra/modularize/ModularizeUtilities.cpp | 5 ++--- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/utils/TableGen/ClangAttrEmitter.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp b/clang-tools-extra/modularize/ModularizeUtilities.cpp index 53e8a49d1a548..8752946822fed 100644 --- a/clang-tools-extra/modularize/ModularizeUtilities.cpp +++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp @@ -435,9 +435,8 @@ static std::string replaceDotDot(StringRef Path) { llvm::sys::path::const_iterator B = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path); while (B != E) { - if (B->compare(".") == 0) { - } - else if (B->compare("..") == 0) + if (*B == ".") { + } else if (*B == "..") llvm::sys::path::remove_filename(Buffer); else llvm::sys::path::append(Buffer, *B); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index c3e6d563f3bd2..6d2015b2cd156 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1522,7 +1522,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args, auto isPAuthLR = [](const char *member) { llvm::AArch64::ExtensionInfo pauthlr_extension = llvm::AArch64::getExtensionByID(llvm::AArch64::AEK_PAUTHLR); - return (pauthlr_extension.Feature.compare(member) == 0); + return pauthlr_extension.Feature == member; }; if (std::any_of(CmdArgs.begin(), CmdArgs.end(), isPAuthLR)) diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp index aafbf1f40949a..ca7630adfbb7b 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -1845,7 +1845,7 @@ static LateAttrParseKind getLateAttrParseKind(const Record *Attr) { PrintFatalError(Attr, "Field `" + llvm::Twine(LateParsedStr) + "`should only have one super class"); - if (SuperClasses[0]->getName().compare(LateAttrParseKindStr) != 0) + if (SuperClasses[0]->getName() != LateAttrParseKindStr) PrintFatalError(Attr, "Field `" + llvm::Twine(LateParsedStr) + "`should only have type `" + llvm::Twine(LateAttrParseKindStr) + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits