Skip to content

Commit cb0f6d0

Browse files
[lldb] Simplify string comparisons (NFC) (#139394)
1 parent 193135c commit cb0f6d0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
818818
return std::make_pair(ret, osi);
819819
}
820820
case 'x':
821-
if (!str.compare("0")) {
821+
if (str == "0") {
822822
is_hex = true;
823823
str.push_back(*osi);
824824
} else {

lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
8383
} else if (!m_top_level) {
8484
if (ObjCMethodDecl *method_decl = dyn_cast<ObjCMethodDecl>(D)) {
8585
if (m_ast_context &&
86-
!method_decl->getSelector().getAsString().compare("$__lldb_expr:")) {
86+
method_decl->getSelector().getAsString() == "$__lldb_expr:") {
8787
RecordPersistentTypes(method_decl);
8888
SynthesizeObjCMethodResult(method_decl);
8989
}
9090
} else if (FunctionDecl *function_decl = dyn_cast<FunctionDecl>(D)) {
9191
// When completing user input the body of the function may be a nullptr.
9292
if (m_ast_context && function_decl->hasBody() &&
93-
!function_decl->getNameInfo().getAsString().compare("$__lldb_expr")) {
93+
function_decl->getNameInfo().getAsString() == "$__lldb_expr") {
9494
RecordPersistentTypes(function_decl);
9595
SynthesizeFunctionResult(function_decl);
9696
}

lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ size_t ELFLinuxPrStatus::GetSize(const lldb_private::ArchSpec &arch) {
278278
if (arch.IsMIPS()) {
279279
std::string abi = arch.GetTargetABI();
280280
assert(!abi.empty() && "ABI is not set");
281-
if (!abi.compare("n64"))
281+
if (abi == "n64")
282282
return sizeof(ELFLinuxPrStatus);
283-
else if (!abi.compare("o32"))
283+
else if (abi == "o32")
284284
return mips_linux_pr_status_size_o32;
285285
// N32 ABI
286286
return mips_linux_pr_status_size_n32;

0 commit comments

Comments
 (0)