From 08201cb4245b0a03e1af664e00a22ea4db1fc2fb Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 19 Aug 2024 16:33:46 +0100 Subject: [PATCH] [lldb][test] Fix GCC warnings in TestGetControlFlowKindX86.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` <...>/TestGetControlFlowKindx86.cpp:148:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] 148 | if (kind == eInstructionControlFlowKindReturn) | ^ ``` Usually llvm is a "no braces for single line body" project but for whatever reason gcc objects to it here. Perhaps because it's within a for loop. Added the newlines just for readability. --- .../Disassembler/x86/TestGetControlFlowKindx86.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp b/lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp index fecd93361e56..e9d5ae3f7b3c 100644 --- a/lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp +++ b/lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp @@ -145,14 +145,19 @@ TEST_F(TestGetControlFlowKindx86, TestX86_64Instruction) { EXPECT_EQ(kind, result[i]); // Also, test the DisassemblerLLVMC::MCDisasmInstance methods. - if (kind == eInstructionControlFlowKindReturn) + if (kind == eInstructionControlFlowKindReturn) { EXPECT_FALSE(inst_sp->IsCall()); - if (kind == eInstructionControlFlowKindCall) + } + + if (kind == eInstructionControlFlowKindCall) { EXPECT_TRUE(inst_sp->IsCall()); + } + if (kind == eInstructionControlFlowKindCall || kind == eInstructionControlFlowKindJump || kind == eInstructionControlFlowKindCondJump || - kind == eInstructionControlFlowKindReturn) + kind == eInstructionControlFlowKindReturn) { EXPECT_TRUE(inst_sp->DoesBranch()); + } } }