[Lldb-commits] [lldb] cb0f6d0 - [lldb] Simplify string comparisons (NFC) (#139394)
via lldb-commits
lldb-commits at lists.llvm.org
Sat May 10 10:44:08 PDT 2025
Author: Kazu Hirata
Date: 2025-05-10T10:44:04-07:00
New Revision: cb0f6d002918c6f7f02324638089d9821badcc3b
URL: https://github.com/llvm/llvm-project/commit/cb0f6d002918c6f7f02324638089d9821badcc3b
DIFF: https://github.com/llvm/llvm-project/commit/cb0f6d002918c6f7f02324638089d9821badcc3b.diff
LOG: [lldb] Simplify string comparisons (NFC) (#139394)
Added:
Modified:
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
Removed:
################################################################################
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;
More information about the lldb-commits
mailing list