-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… #145959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lvm#145081)" This reverts commit cbf781f. Breaks a couple of buildbots.
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-lldb Author: None (Sterling-Augustine) Changes…145081)" This reverts commit cbf781f. Breaks a couple of buildbots. Patch is 96.13 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/145959.diff 54 Files Affected:
diff --git a/bolt/include/bolt/Core/DIEBuilder.h b/bolt/include/bolt/Core/DIEBuilder.h
index e4a4fc6b2f258..32e455ad3030a 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -20,8 +20,8 @@
#include "llvm/CodeGen/DIE.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
#include "llvm/Support/Allocator.h"
#include <list>
diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt
index fc72dc023c590..8c1f5d0bb37b5 100644
--- a/bolt/lib/Core/CMakeLists.txt
+++ b/bolt/lib/Core/CMakeLists.txt
@@ -1,6 +1,5 @@
set(LLVM_LINK_COMPONENTS
DebugInfoDWARF
- DebugInfoDWARFLowLevel
Demangle
MC
MCDisassembler
diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index b041dc5ea1cce..d36dbb3459249 100644
--- a/bolt/lib/Core/DIEBuilder.cpp
+++ b/bolt/lib/Core/DIEBuilder.cpp
@@ -14,11 +14,11 @@
#include "llvm/CodeGen/DIE.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
diff --git a/bolt/lib/Core/DebugNames.cpp b/bolt/lib/Core/DebugNames.cpp
index a9d98a6ba879b..aa1c8f3d42d4b 100644
--- a/bolt/lib/Core/DebugNames.cpp
+++ b/bolt/lib/Core/DebugNames.cpp
@@ -8,8 +8,8 @@
#include "bolt/Core/DebugNames.h"
#include "bolt/Core/BinaryContext.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/LEB128.h"
#include <cstdint>
diff --git a/bolt/lib/Rewrite/CMakeLists.txt b/bolt/lib/Rewrite/CMakeLists.txt
index 775036063dd5a..c83cf36982167 100644
--- a/bolt/lib/Rewrite/CMakeLists.txt
+++ b/bolt/lib/Rewrite/CMakeLists.txt
@@ -1,7 +1,6 @@
set(LLVM_LINK_COMPONENTS
Core
DebugInfoDWARF
- DebugInfoDWARFLowLevel
JITLink
MC
Object
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 0c1a1bac6c72e..9c9bdefe08429 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -24,10 +24,10 @@
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCObjectWriter.h"
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 2df27513a0b3f..661324338e801 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -36,8 +36,7 @@
#include "lldb/Target/StackID.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
using namespace lldb;
using namespace lldb_private;
@@ -82,7 +81,7 @@ void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level,
llvm::DIDumpOptions DumpOpts;
DumpOpts.GetNameForDWARFReg = GetRegName;
llvm::DWARFExpression E(m_data.GetAsLLVM(), m_data.GetAddressByteSize());
- llvm::printDwarfExpression(&E, s->AsRawOstream(), DumpOpts, nullptr);
+ llvm::DWARFExpressionPrinter::print(&E, s->AsRawOstream(), DumpOpts, nullptr);
}
RegisterKind DWARFExpression::GetRegisterKind() const { return m_reg_kind; }
diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp
index 9245e52732061..e9ac6b6cde295 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -17,8 +17,7 @@
#include "lldb/Utility/Log.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/DIContext.h"
-#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include <optional>
using namespace lldb;
@@ -90,7 +89,8 @@ static void DumpDWARFExpr(Stream &s, llvm::ArrayRef<uint8_t> expr, Thread *threa
order_and_width->second);
llvm::DWARFExpression E(data, order_and_width->second,
llvm::dwarf::DWARF32);
- printDwarfExpression(&E, s.AsRawOstream(), llvm::DIDumpOptions(), nullptr);
+ llvm::DWARFExpressionPrinter::print(&E, s.AsRawOstream(),
+ llvm::DIDumpOptions(), nullptr);
} else
s.PutCString("dwarf-expr");
}
diff --git a/lldb/unittests/Symbol/PostfixExpressionTest.cpp b/lldb/unittests/Symbol/PostfixExpressionTest.cpp
index f60b5d2c389ed..1e437da5133d9 100644
--- a/lldb/unittests/Symbol/PostfixExpressionTest.cpp
+++ b/lldb/unittests/Symbol/PostfixExpressionTest.cpp
@@ -11,8 +11,7 @@
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/DIContext.h"
-#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include "gmock/gmock.h"
@@ -161,7 +160,7 @@ static std::string ParseAndGenerateDWARF(llvm::StringRef expr) {
std::string result;
llvm::raw_string_ostream os(result);
llvm::DWARFExpression E(extractor, addr_size, llvm::dwarf::DWARF32);
- llvm::printDwarfExpression(&E, os, llvm::DIDumpOptions(), nullptr);
+ llvm::DWARFExpressionPrinter::print(&E, os, llvm::DIDumpOptions(), nullptr);
return result;
}
diff --git a/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp b/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
index c60688ef22939..d746e04f8a9fc 100644
--- a/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
+++ b/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
@@ -16,8 +16,7 @@
#include "lldb/Utility/StreamBuffer.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/DebugInfo/DIContext.h"
-#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
using namespace lldb;
using namespace lldb_private;
@@ -41,7 +40,7 @@ CheckValidProgramTranslation(llvm::StringRef fpo_program,
std::string result;
llvm::raw_string_ostream os(result);
llvm::DWARFExpression E(extractor, /*AddressSize=*/4, llvm::dwarf::DWARF32);
- llvm::printDwarfExpression(&E, os, llvm::DIDumpOptions(), nullptr);
+ llvm::DWARFExpressionPrinter::print(&E, os, llvm::DIDumpOptions(), nullptr);
// actual check
ASSERT_EQ(expected_dwarf_expression, result);
diff --git a/llvm/include/llvm/DWARFLinker/AddressesMap.h b/llvm/include/llvm/DWARFLinker/AddressesMap.h
index e2215c70dc34e..a232aafadc5ce 100644
--- a/llvm/include/llvm/DWARFLinker/AddressesMap.h
+++ b/llvm/include/llvm/DWARFLinker/AddressesMap.h
@@ -12,8 +12,8 @@
#include "llvm/ADT/AddressRanges.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
#include <cstdint>
namespace llvm {
diff --git a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
index 5b9535380aebf..b12d96812108e 100644
--- a/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
@@ -20,7 +20,7 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/Support/Compiler.h"
#include <map>
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
index 99aeb0df076e6..17a18c4b029f4 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h
@@ -16,7 +16,7 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/Support/Compiler.h"
#include <map>
namespace llvm {
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h
index 7d4bf8d923097..4723f00a4d241 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h
@@ -9,7 +9,7 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H
#define LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"
+#include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
similarity index 50%
rename from llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h
rename to llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
index bdad0b5ad7a5a..1d89ac3578c10 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
@@ -12,8 +12,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/TargetParser/Triple.h"
@@ -78,150 +78,8 @@ class CFIProgram {
/// starting at *Offset and ending at EndOffset. *Offset is updated
/// to EndOffset upon successful parsing, or indicates the offset
/// where a problem occurred in case an error is returned.
- template <typename T>
- LLVM_ABI Error parse(DWARFDataExtractorBase<T> &Data, uint64_t *Offset,
- uint64_t EndOffset) {
- // See DWARF standard v3, section 7.23
- const uint8_t DWARF_CFI_PRIMARY_OPCODE_MASK = 0xc0;
- const uint8_t DWARF_CFI_PRIMARY_OPERAND_MASK = 0x3f;
-
- DataExtractor::Cursor C(*Offset);
- while (C && C.tell() < EndOffset) {
- uint8_t Opcode = Data.getRelocatedValue(C, 1);
- if (!C)
- break;
-
- // Some instructions have a primary opcode encoded in the top bits.
- if (uint8_t Primary = Opcode & DWARF_CFI_PRIMARY_OPCODE_MASK) {
- // If it's a primary opcode, the first operand is encoded in the
- // bottom bits of the opcode itself.
- uint64_t Op1 = Opcode & DWARF_CFI_PRIMARY_OPERAND_MASK;
- switch (Primary) {
- case DW_CFA_advance_loc:
- case DW_CFA_restore:
- addInstruction(Primary, Op1);
- break;
- case DW_CFA_offset:
- addInstruction(Primary, Op1, Data.getULEB128(C));
- break;
- default:
- llvm_unreachable("invalid primary CFI opcode");
- }
- continue;
- }
-
- // Extended opcode - its value is Opcode itself.
- switch (Opcode) {
- default:
- return createStringError(errc::illegal_byte_sequence,
- "invalid extended CFI opcode 0x%" PRIx8,
- Opcode);
- case DW_CFA_nop:
- case DW_CFA_remember_state:
- case DW_CFA_restore_state:
- case DW_CFA_GNU_window_save:
- case DW_CFA_AARCH64_negate_ra_state_with_pc:
- // No operands
- addInstruction(Opcode);
- break;
- case DW_CFA_set_loc:
- // Operands: Address
- addInstruction(Opcode, Data.getRelocatedAddress(C));
- break;
- case DW_CFA_advance_loc1:
- // Operands: 1-byte delta
- addInstruction(Opcode, Data.getRelocatedValue(C, 1));
- break;
- case DW_CFA_advance_loc2:
- // Operands: 2-byte delta
- addInstruction(Opcode, Data.getRelocatedValue(C, 2));
- break;
- case DW_CFA_advance_loc4:
- // Operands: 4-byte delta
- addInstruction(Opcode, Data.getRelocatedValue(C, 4));
- break;
- case DW_CFA_restore_extended:
- case DW_CFA_undefined:
- case DW_CFA_same_value:
- case DW_CFA_def_cfa_register:
- case DW_CFA_def_cfa_offset:
- case DW_CFA_GNU_args_size:
- // Operands: ULEB128
- addInstruction(Opcode, Data.getULEB128(C));
- break;
- case DW_CFA_def_cfa_offset_sf:
- // Operands: SLEB128
- addInstruction(Opcode, Data.getSLEB128(C));
- break;
- case DW_CFA_LLVM_def_aspace_cfa:
- case DW_CFA_LLVM_def_aspace_cfa_sf: {
- auto RegNum = Data.getULEB128(C);
- auto CfaOffset = Opcode == DW_CFA_LLVM_def_aspace_cfa
- ? Data.getULEB128(C)
- : Data.getSLEB128(C);
- auto AddressSpace = Data.getULEB128(C);
- addInstruction(Opcode, RegNum, CfaOffset, AddressSpace);
- break;
- }
- case DW_CFA_offset_extended:
- case DW_CFA_register:
- case DW_CFA_def_cfa:
- case DW_CFA_val_offset: {
- // Operands: ULEB128, ULEB128
- // Note: We can not embed getULEB128 directly into function
- // argument list. getULEB128 changes Offset and order of evaluation
- // for arguments is unspecified.
- uint64_t op1 = Data.getULEB128(C);
- uint64_t op2 = Data.getULEB128(C);
- addInstruction(Opcode, op1, op2);
- break;
- }
- case DW_CFA_offset_extended_sf:
- case DW_CFA_def_cfa_sf:
- case DW_CFA_val_offset_sf: {
- // Operands: ULEB128, SLEB128
- // Note: see comment for the previous case
- uint64_t op1 = Data.getULEB128(C);
- uint64_t op2 = (uint64_t)Data.getSLEB128(C);
- addInstruction(Opcode, op1, op2);
- break;
- }
- case DW_CFA_def_cfa_expression: {
- uint64_t ExprLength = Data.getULEB128(C);
- addInstruction(Opcode, 0);
- StringRef Expression = Data.getBytes(C, ExprLength);
-
- DataExtractor Extractor(Expression, Data.isLittleEndian(),
- Data.getAddressSize());
- // Note. We do not pass the DWARF format to DWARFExpression, because
- // DW_OP_call_ref, the only operation which depends on the format, is
- // prohibited in call frame instructions, see sec. 6.4.2 in DWARFv5.
- Instructions.back().Expression =
- DWARFExpression(Extractor, Data.getAddressSize());
- break;
- }
- case DW_CFA_expression:
- case DW_CFA_val_expression: {
- uint64_t RegNum = Data.getULEB128(C);
- addInstruction(Opcode, RegNum, 0);
-
- uint64_t BlockLength = Data.getULEB128(C);
- StringRef Expression = Data.getBytes(C, BlockLength);
- DataExtractor Extractor(Expression, Data.isLittleEndian(),
- Data.getAddressSize());
- // Note. We do not pass the DWARF format to DWARFExpression, because
- // DW_OP_call_ref, the only operation which depends on the format, is
- // prohibited in call frame instructions, see sec. 6.4.2 in DWARFv5.
- Instructions.back().Expression =
- DWARFExpression(Extractor, Data.getAddressSize());
- break;
- }
- }
- }
-
- *Offset = C.tell();
- return C.takeError();
- }
+ LLVM_ABI Error parse(DWARFDataExtractor Data, uint64_t *Offset,
+ uint64_t EndOffset);
void addInstruction(const Instruction &I) { Instructions.push_back(I); }
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
index def291046c7db..005ccd208cdda 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
@@ -10,10 +10,10 @@
#define LLVM_DEBUGINFO_DWARF_DWARFDATAEXTRACTOR_H
#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h"
#include "llvm/DebugInfo/DWARF/DWARFObject.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h
similarity index 100%
rename from llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h
rename to llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index e0d60f605964f..3b367009a379d 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -12,8 +12,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/iterator.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"
-#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
+#include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h"
+#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/TargetParser/Triple.h"
diff --git a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
similarity index 67%
rename from llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h
rename to llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
index 06840b20f9690..ea414278c35d6 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -65,7 +65,7 @@ class DWARFExpression {
/// Description of the encoding of one expression Op.
struct Description {
- DwarfVersion Version; ///< Dwarf version where the Op was introduced.
+ DwarfVersion Version; ///< Dwarf version where the Op was introduced.
SmallVector<Encoding> Op; ///< Encoding for Op operands.
template <typename... Ts>
@@ -77,6 +77,7 @@ class DWARFExpression {
private:
friend class DWARFExpression::iterator;
+ friend class DWARFExpressionPrinter;
friend class DWARFVerifier;
uint8_t Opcode; ///< The Op Opcode, DW_OP_<something>.
@@ -155,6 +156,7 @@ class DWARFExpression {
StringRef getData() const { return Data.getData(); }
+ friend class DWARFExpressionPrinter;
friend class DWARFVerifier;
private:
@@ -168,6 +170,65 @@ inline bool operator==(const DWARFExpression::iterator &LHS,
return LHS.Expr == RHS.Expr && LHS.Offset == RHS.Offset;
}
+// This functionality is separated from the main data structure so that nothing
+// in DWARFExpression.cpp needs build-time dependencies on DWARFUnit or other
+// higher-level Dwarf structures. This approach creates better layering and
+// allows DWARFExpression to be used from code which can't have dependencies on
+// those higher-level structures.
+
+class DWARFUnit;
+struct DIDumpOptions;
+class raw_o...
[truncated]
|
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp bolt/include/bolt/Core/DIEBuilder.h bolt/lib/Core/DIEBuilder.cpp bolt/lib/Core/DebugNames.cpp bolt/lib/Rewrite/DWARFRewriter.cpp lldb/source/Expression/DWARFExpression.cpp lldb/source/Symbol/UnwindPlan.cpp lldb/unittests/Symbol/PostfixExpressionTest.cpp lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp llvm/include/llvm/DWARFLinker/AddressesMap.h llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp llvm/lib/DebugInfo/DWARF/DWARFCFIPrinter.cpp llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp llvm/lib/DebugInfo/DWARF/DWARFDie.cpp llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp llvm/lib/ProfileData/InstrProfCorrelator.cpp llvm/tools/dsymutil/DwarfLinkerForBinary.cpp llvm/tools/llvm-dwarfdump/Statistics.cpp llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp llvm/tools/llvm-objdump/SourcePrinter.cpp llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h llvm/lib/DebugInfo/DWARF/DWARFCFIProgram.cpp View the diff from clang-format here.diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
index ea414278c..ec8fb97c1 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -65,7 +65,7 @@ public:
/// Description of the encoding of one expression Op.
struct Description {
- DwarfVersion Version; ///< Dwarf version where the Op was introduced.
+ DwarfVersion Version; ///< Dwarf version where the Op was introduced.
SmallVector<Encoding> Op; ///< Encoding for Op operands.
template <typename... Ts>
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 8255e013a..5203b25f2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -214,8 +214,8 @@ bool DWARFExpression::Operation::extract(DataExtractor Data,
Operands[Operand] = Data.getULEB128(&Offset);
break;
case 3: // global as uint32
- Operands[Operand] = Data.getU32(&Offset);
- break;
+ Operands[Operand] = Data.getU32(&Offset);
+ break;
default:
return false; // Unknown Wasm location
}
@@ -354,7 +354,8 @@ bool DWARFExpressionPrinter::printOp(const DWARFExpression::Operation *Op,
case 4:
OS << format(" 0x%" PRIx64, Op->Operands[Operand]);
break;
- default: assert(false);
+ default:
+ assert(false);
}
} else if (Size == DWARFExpression::Operation::SizeBlock) {
uint64_t Offset = Op->Operands[Operand];
|
FYI: per https://llvm.org/docs/CodeReview.html#code-review-workflow - please don't commit a PR without approval, once it's sent for review. If the intent wasn't to precommit review the PR, it should be created with the |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/198/builds/5640 Here is the relevant piece of the build log for the reference
|
…#… (#145959) (#146112) Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) This reapplies cbf781f, with fixes for the shared-library build and the unconventional sanitizer-runtime build. Original Description: This is the culmination of a series of changes described in [1]. Although somewhat large by line count, it is almost entirely mechanical, creating a new library in DebugInfo/DWARF/LowLevel. This new library has very minimal dependencies, allowing it to be used from more places than the normal DebugInfo/DWARF library--in particular from MC. 1. https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
…ibrary (#… (llvm#145959) (llvm#146112)" This reverts commit 23f1ba3.
…145081)"
This reverts commit cbf781f.
Breaks a couple of buildbots.