[lldb] [llvm] Add support for using foreign type units in .debug_names. (PR #87740)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 20:39:36 PDT 2024
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 6aa53888a8e8a6e3f0bd279539703f4d4701b4e7 d69497fc66ce092fd75fcbe7c64460a49a6e2172 -- lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index ba35b3b872..7200421b6f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -34,7 +34,6 @@ DebugNamesDWARFIndex::Create(Module &module, DWARFDataExtractor debug_names,
module, std::move(index_up), debug_names, debug_str, dwarf));
}
-
llvm::DenseSet<uint64_t>
DebugNamesDWARFIndex::GetTypeUnitSigs(const DebugNames &debug_names) {
llvm::DenseSet<uint64_t> result;
@@ -301,7 +300,6 @@ void DebugNamesDWARFIndex::GetFullyQualifiedType(
if (!isType(entry.tag()))
continue;
-
DWARFTypeUnit *foreign_tu = GetForeignTypeUnit(entry);
if (foreign_tu) {
// If this entry represents a foreign type unit, we need to verify that
@@ -325,8 +323,8 @@ void DebugNamesDWARFIndex::GetFullyQualifiedType(
// unit came from a specific .dwo file.
if (name_index->getCUCount() == 1) {
dw_offset_t cu_offset = name_index->getCUOffset(0);
- DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::DebugInfo,
- cu_offset);
+ DWARFUnit *cu =
+ m_debug_info.GetUnitAtOffset(DIERef::DebugInfo, cu_offset);
if (cu) {
DWARFBaseDIE cu_die = cu->GetUnitDIEOnly();
DWARFBaseDIE tu_die = foreign_tu->GetUnitDIEOnly();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index 6b48ce4eea..c316884180 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -99,7 +99,8 @@ private:
llvm::StringRef name);
static llvm::DenseSet<dw_offset_t> GetUnits(const DebugNames &debug_names);
- static llvm::DenseSet<uint64_t> GetTypeUnitSigs(const DebugNames &debug_names);
+ static llvm::DenseSet<uint64_t>
+ GetTypeUnitSigs(const DebugNames &debug_names);
};
} // namespace dwarf
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 103e157d3c..e1a7cfc794 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -60,7 +60,8 @@ void ManualDWARFIndex::Index() {
}
if (dwp_info && dwp_info->ContainsTypeUnits()) {
for (size_t U = 0; U < dwp_info->GetNumUnits(); ++U) {
- if (auto *tu = llvm::dyn_cast<DWARFTypeUnit>(dwp_info->GetUnitAtIndex(U))) {
+ if (auto *tu =
+ llvm::dyn_cast<DWARFTypeUnit>(dwp_info->GetUnitAtIndex(U))) {
if (m_type_sigs_to_avoid.count(tu->GetTypeHash()) == 0)
units_to_index.push_back(tu);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b828b56cc3..355fcfb2b6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1751,7 +1751,7 @@ SymbolFileDWARF *SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
if (file_index) {
SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile();
if (debug_map) {
- // We have a SymbolFileDWARFDebugMap, so let it find the right file
+ // We have a SymbolFileDWARFDebugMap, so let it find the right file
return debug_map->GetSymbolFileByOSOIndex(*file_index);
} else {
// Handle the .dwp file case correctly
@@ -1759,8 +1759,9 @@ SymbolFileDWARF *SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
return GetDwpSymbolFile().get(); // DWP case
// Handle the .dwo file case correctly
- return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
- ->GetDwoSymbolFile(); // DWO case
+ return DebugInfo()
+ .GetUnitAtIndex(*die_ref.file_index())
+ ->GetDwoSymbolFile(); // DWO case
}
}
return this;
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
index 3662059166..2c8894784f 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
@@ -56,7 +56,6 @@
// VARIANT-NEXT: (lldb) type lookup IntegerType
// VARIANT-NEXT: unsigned int
-
// We need to do this so we end with a type unit in each .dwo file and that has
// the same signature but different contents. When we make the .dwp file, then
// one of the type units will end up in the .dwp file and we will have
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 54d8f54aff..17ada92b0c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -671,11 +671,11 @@ DWARFDebugNames::Entry::getForeignTUTypeSignature() const {
std::optional<uint64_t> Index = getLocalTUIndex();
const uint32_t NumLocalTUs = NameIdx->getLocalTUCount();
if (!Index || *Index < NumLocalTUs)
- return std::nullopt; // Invalid TU index or TU index is for a local TU
+ return std::nullopt; // Invalid TU index or TU index is for a local TU
// The foreign TU index is the TU index minus the number of local TUs.
const uint64_t ForeignTUIndex = *Index - NumLocalTUs;
if (ForeignTUIndex >= NameIdx->getForeignTUCount())
- return std::nullopt; // Invalid foreign TU index.
+ return std::nullopt; // Invalid foreign TU index.
return NameIdx->getForeignTUSignature(ForeignTUIndex);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/87740
More information about the llvm-commits
mailing list