github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff HEAD~1 HEAD --extensions h,c,cpp -- lldb/test/API/functionalities/rich-disassembler/d_original_example.c lldb/include/lldb/Expression/DWARFExpression.h lldb/include/lldb/Expression/DWARFExpressionList.h lldb/source/Core/Disassembler.cpp lldb/source/Expression/DWARFExpression.cpp lldb/source/Expression/DWARFExpressionList.cpp llvm/include/llvm/DebugInfo/DIContext.h llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index 1bd762a98..d303ad834 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -59,7 +59,7 @@ public: } lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; } - + /// Represents an entry in the DWARFExpressionList with all needed metadata. struct DWARFExpressionEntry { /// Represents a DWARF location range in the DWARF unit’s file‐address space @@ -69,7 +69,8 @@ public: /// Returns a DWARFExpressionEntry whose file_range contains the given /// load‐address. `func_load_addr` is the load‐address of the function - /// start; `load_addr` is the full runtime PC. On success, `expr` is non-null. + /// start; `load_addr` is the full runtime PC. On success, `expr` is + /// non-null. std::optional<DWARFExpressionEntry> GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const; diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index d8924ea44..98d2291e7 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -732,7 +732,8 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, return; addr_t current_pc = m_address.GetLoadAddress(target_sp.get()); - addr_t original_pc = frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get()); + addr_t original_pc = + frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get()); if (!frame->ChangePC(current_pc)) return; @@ -744,7 +745,8 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, SymbolContext sc = frame->GetSymbolContext(eSymbolContextFunction); addr_t func_load_addr = LLDB_INVALID_ADDRESS; if (sc.function) - func_load_addr = sc.function->GetAddress().GetLoadAddress(target_sp.get()); + func_load_addr = + sc.function->GetAddress().GetLoadAddress(target_sp.get()); // Only annotate if the current disassembly line is short enough // to keep annotations aligned past the desired annotation_column. @@ -763,22 +765,26 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, continue; // Handle std::optional<DWARFExpressionEntry>. - if (auto entryOrErr = expr_list.GetExpressionEntryAtAddress(func_load_addr, current_pc)) { + if (auto entryOrErr = expr_list.GetExpressionEntryAtAddress( + func_load_addr, current_pc)) { auto entry = *entryOrErr; // Check if entry has a file_range, and filter on address if so. if (!entry.file_range || entry.file_range->ContainsFileAddress( - (current_pc - func_load_addr) + expr_list.GetFuncFileAddress())) { + (current_pc - func_load_addr) + + expr_list.GetFuncFileAddress())) { StreamString loc_str; ABI *abi = exe_ctx->GetProcessPtr()->GetABI().get(); llvm::DIDumpOptions opts; opts.ShowAddresses = false; - opts.PrintRegisterOnly = true; // <-- important: suppress DW_OP_... annotations, etc. + opts.PrintRegisterOnly = + true; // <-- important: suppress DW_OP_... annotations, etc. entry.expr->DumpLocation(&loc_str, eDescriptionLevelBrief, abi, opts); - + // Only include if not empty. - llvm::StringRef loc_clean = llvm::StringRef(loc_str.GetString()).trim(); + llvm::StringRef loc_clean = + llvm::StringRef(loc_str.GetString()).trim(); if (!loc_clean.empty()) { annotations.push_back(llvm::formatv("{0} = {1}", name, loc_clean)); } @@ -808,7 +814,6 @@ void Instruction::Dump(lldb_private::Stream *s, uint32_t max_opcode_byte_size, s->PutCString(ss.GetString()); } - bool Instruction::DumpEmulation(const ArchSpec &arch) { std::unique_ptr<EmulateInstruction> insn_emulator_up( EmulateInstruction::FindPlugin(arch, eInstructionTypeAny, nullptr)); diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index c2c9f1164..df56bcf5e 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -67,7 +67,8 @@ void DWARFExpression::UpdateValue(uint64_t const_value, } void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level, - ABI *abi, llvm::DIDumpOptions options) const { + ABI *abi, + llvm::DIDumpOptions options) const { auto *MCRegInfo = abi ? &abi->GetMCRegisterInfo() : nullptr; auto GetRegName = [&MCRegInfo](uint64_t DwarfRegNum, bool IsEH) -> llvm::StringRef { diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp index 88305fc17..ef7333518 100644 --- a/lldb/source/Expression/DWARFExpressionList.cpp +++ b/lldb/source/Expression/DWARFExpressionList.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Core/AddressRange.h" #include "lldb/Expression/DWARFExpressionList.h" #include "lldb/Core/AddressRange.h" #include "lldb/Symbol/Function.h" @@ -57,7 +56,7 @@ bool DWARFExpressionList::ContainsAddress(lldb::addr_t func_load_addr, std::optional<DWARFExpressionList::DWARFExpressionEntry> DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, - lldb::addr_t load_addr) const { + lldb::addr_t load_addr) const { if (const DWARFExpression *always = GetAlwaysValidExpr()) { return DWARFExpressionEntry{std::nullopt, always}; } @@ -65,9 +64,10 @@ DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, if (func_load_addr == LLDB_INVALID_ADDRESS) func_load_addr = m_func_file_addr; - // Guard against underflow when translating a load address back into file space. + // Guard against underflow when translating a load address back into file + // space. if (load_addr < func_load_addr) - return std::nullopt; + return std::nullopt; // Guard against overflow. lldb::addr_t delta = load_addr - func_load_addr; @@ -75,10 +75,10 @@ DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, return std::nullopt; lldb::addr_t file_pc = (load_addr - func_load_addr) + m_func_file_addr; - + if (const auto *entry = m_exprs.FindEntryThatContains(file_pc)) { AddressRange range_in_file(entry->GetRangeBase(), - entry->GetRangeEnd() - entry->GetRangeBase()); + entry->GetRangeEnd() - entry->GetRangeBase()); return DWARFExpressionEntry{range_in_file, &entry->data}; } diff --git a/lldb/test/API/functionalities/rich-disassembler/d_original_example.c b/lldb/test/API/functionalities/rich-disassembler/d_original_example.c index 4f245f518..1c864753a 100644 --- a/lldb/test/API/functionalities/rich-disassembler/d_original_example.c +++ b/lldb/test/API/functionalities/rich-disassembler/d_original_example.c @@ -1,7 +1,7 @@ #include <stdio.h> int main(int argc, char **argv) { - for (int i = 1; i < argc; ++i) - puts(argv[i]); - return 0; + for (int i = 1; i < argc; ++i) + puts(argv[i]); + return 0; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp index 2e22f4009..3622ff3a8 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFExpressionPrinter.cpp @@ -68,23 +68,24 @@ static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS, if (!DumpOpts.PrintRegisterOnly) { for (unsigned Operand = 0; Operand < Op->getDescription().Op.size(); - ++Operand) { + ++Operand) { unsigned Size = Op->getDescription().Op[Operand]; unsigned Signed = Size & DWARFExpression::Operation::SignBit; if (Size == DWARFExpression::Operation::SizeSubOpLEB) { - StringRef SubName = - SubOperationEncodingString(Op->getCode(), Op->getRawOperand(Operand)); + StringRef SubName = SubOperationEncodingString( + Op->getCode(), Op->getRawOperand(Operand)); assert(!SubName.empty() && "DW_OP SubOp has no name!"); OS << " " << SubName; } else if (Size == DWARFExpression::Operation::BaseTypeRef && U) { // For DW_OP_convert the operand may be 0 to indicate that conversion to - // the generic type should be done. The same holds for DW_OP_reinterpret, - // which is currently not supported. + // the generic type should be done. The same holds for + // DW_OP_reinterpret, which is currently not supported. if (Op->getCode() == DW_OP_convert && Op->getRawOperand(Operand) == 0) OS << " 0x0"; else - prettyPrintBaseTypeRef(U, OS, DumpOpts, Op->getRawOperands(), Operand); + prettyPrintBaseTypeRef(U, OS, DumpOpts, Op->getRawOperands(), + Operand); } else if (Size == DWARFExpression::Operation::WasmLocationArg) { assert(Operand == 1); switch (Op->getRawOperand(0)) { @@ -102,12 +103,12 @@ static bool printOp(const DWARFExpression::Operation *Op, raw_ostream &OS, uint64_t Offset = Op->getRawOperand(Operand); for (unsigned i = 0; i < Op->getRawOperand(Operand - 1); ++i) OS << format(" 0x%02x", - static_cast<uint8_t>(Expr->getData()[Offset++])); + static_cast<uint8_t>(Expr->getData()[Offset++])); } else { if (Signed) OS << format(" %+" PRId64, (int64_t)Op->getRawOperand(Operand)); else if (Op->getCode() != DW_OP_entry_value && - Op->getCode() != DW_OP_GNU_entry_value) + Op->getCode() != DW_OP_GNU_entry_value) OS << format(" 0x%" PRIx64, Op->getRawOperand(Operand)); } } `````````` </details> https://github.com/llvm/llvm-project/pull/147460 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits