https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/139394
None >From ab137cc177482af73941f2b4cf22aef886d500f6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Mon, 28 Apr 2025 09:38:32 -0700 Subject: [PATCH] [lldb] Simplify string comparisons (NFC) --- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp | 2 +- .../Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp | 4 ++-- lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index a77155f6bf41e..ed6047f8f4ef3 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -818,7 +818,7 @@ class InstructionLLVMC : public lldb_private::Instruction { return std::make_pair(ret, osi); } case 'x': - if (!str.compare("0")) { + if (str == "0") { is_hex = true; str.push_back(*osi); } else { diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index fd965d0127a2d..de4de0a7a22c5 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -83,14 +83,14 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) { } else if (!m_top_level) { if (ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(D)) { if (m_ast_context && - !method_decl->getSelector().getAsString().compare("$__lldb_expr:")) { + method_decl->getSelector().getAsString() == "$__lldb_expr:") { RecordPersistentTypes(method_decl); SynthesizeObjCMethodResult(method_decl); } } else if (FunctionDecl *function_decl = dyn_cast<FunctionDecl>(D)) { // When completing user input the body of the function may be a nullptr. if (m_ast_context && function_decl->hasBody() && - !function_decl->getNameInfo().getAsString().compare("$__lldb_expr")) { + function_decl->getNameInfo().getAsString() == "$__lldb_expr") { RecordPersistentTypes(function_decl); SynthesizeFunctionResult(function_decl); } diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp index a0cd0ee5025bd..c972c8e95f3b1 100644 --- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -278,9 +278,9 @@ size_t ELFLinuxPrStatus::GetSize(const lldb_private::ArchSpec &arch) { if (arch.IsMIPS()) { std::string abi = arch.GetTargetABI(); assert(!abi.empty() && "ABI is not set"); - if (!abi.compare("n64")) + if (abi == "n64") return sizeof(ELFLinuxPrStatus); - else if (!abi.compare("o32")) + else if (abi == "o32") return mips_linux_pr_status_size_o32; // N32 ABI return mips_linux_pr_status_size_n32; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits