[Lldb-commits] [lldb] [lldb][DWARFIndex][NFC] Change GetNamespace/GetGlobalVariables APIs to use IterationAction (PR #151668)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 1 01:14:05 PDT 2025
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,cpp -- lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.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
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index 8e09ce865..0414d83b9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -136,7 +136,8 @@ void AppleDWARFIndex::SearchFor(const llvm::AppleAcceleratorTable &table,
}
void AppleDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
if (!m_apple_names_up)
return;
SearchFor(*m_apple_names_up, basename, IterationActionAdaptor(callback));
@@ -148,7 +149,8 @@ void AppleDWARFIndex::GetGlobalVariables(
if (!m_apple_names_up)
return;
- DIERefCallbackImpl converted_cb = DIERefCallback(IterationActionAdaptor(callback), regex.GetText());
+ DIERefCallbackImpl converted_cb =
+ DIERefCallback(IterationActionAdaptor(callback), regex.GetText());
for (const auto &entry : m_apple_names_up->entries())
if (std::optional<llvm::StringRef> name = entry.readName();
@@ -169,7 +171,8 @@ void AppleDWARFIndex::GetGlobalVariables(
return val.has_value() && *val >= lower_bound && *val < upper_bound;
};
- DIERefCallbackImpl converted_cb = DIERefCallback(IterationActionAdaptor(callback));
+ DIERefCallbackImpl converted_cb =
+ DIERefCallback(IterationActionAdaptor(callback));
for (auto entry : m_apple_names_up->entries()) {
if (is_in_range(entry.BaseEntry.getDIESectionOffset()))
if (!converted_cb(entry.BaseEntry))
@@ -267,7 +270,8 @@ void AppleDWARFIndex::GetTypes(
}
void AppleDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
if (!m_apple_namespaces_up)
return;
SearchFor(*m_apple_namespaces_up, name, IterationActionAdaptor(callback));
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
index 1965ba7b5..74da0b2d0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
@@ -41,15 +41,15 @@ public:
void Preload() override {}
- void
- GetGlobalVariables(ConstString basename,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(DWARFUnit &cu,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ const RegularExpression ®ex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ DWARFUnit &cu,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void GetObjCMethods(ConstString class_name,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetCompleteObjCClass(
@@ -59,8 +59,9 @@ public:
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetNamespaces(ConstString name,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetNamespaces(
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void GetFunctions(
const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
index bef0d4244..6718024a4 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
@@ -33,17 +33,17 @@ public:
/// Finds global variables with the given base name. Any additional filtering
/// (e.g., to only retrieve variables from a given context) should be done by
/// the consumer.
- virtual void
- GetGlobalVariables(ConstString basename,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
+ virtual void GetGlobalVariables(
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
- virtual void
- GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
+ virtual void GetGlobalVariables(
+ const RegularExpression ®ex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
/// \a cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
- virtual void
- GetGlobalVariables(DWARFUnit &cu,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
+ virtual void GetGlobalVariables(
+ DWARFUnit &cu,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) = 0;
virtual void
GetObjCMethods(ConstString class_name,
llvm::function_ref<bool(DWARFDIE die)> callback) = 0;
@@ -76,10 +76,9 @@ public:
/// parent_decl_ctx in its decl parent chain. A base implementation
/// is provided. Specializations should override this if they are able to
/// provide a faster implementation.
- virtual void
- GetNamespacesWithParents(ConstString name,
- const CompilerDeclContext &parent_decl_ctx,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback);
+ virtual void GetNamespacesWithParents(
+ ConstString name, const CompilerDeclContext &parent_decl_ctx,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback);
virtual void
GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index b998a2115..8944005ab 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -178,7 +178,8 @@ void DebugNamesDWARFIndex::MaybeLogLookupError(llvm::Error error,
}
void DebugNamesDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(basename.GetStringRef())) {
if (entry.tag() != DW_TAG_variable)
@@ -482,7 +483,8 @@ void DebugNamesDWARFIndex::GetTypes(
}
void DebugNamesDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(name.GetStringRef())) {
llvm::dwarf::Tag entry_tag = entry.tag();
@@ -583,20 +585,21 @@ void DebugNamesDWARFIndex::GetNamespacesWithParents(
if (!parent_chain) {
// Fallback: use the base class implementation.
if (!ProcessEntry(entry, IterationActionAdaptor([&](DWARFDIE die) {
- return ProcessNamespaceDieMatchParents(parent_decl_ctx, die,
- callback);
- })))
+ return ProcessNamespaceDieMatchParents(
+ parent_decl_ctx, die, callback);
+ })))
return;
continue;
}
if (WithinParentChain(parent_named_contexts, *parent_chain)) {
if (!ProcessEntry(entry, IterationActionAdaptor([&](DWARFDIE die) {
- // After .debug_names filtering still sending to base class for
- // further filtering before calling the callback.
- return ProcessNamespaceDieMatchParents(parent_decl_ctx, die,
- callback);
- })))
+ // After .debug_names filtering still sending to
+ // base class for further filtering before calling
+ // the callback.
+ return ProcessNamespaceDieMatchParents(
+ parent_decl_ctx, die, callback);
+ })))
// If the callback returns false, we're done.
return;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
index ebf23cbab..deee6b7c3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
@@ -27,15 +27,15 @@ public:
void Preload() override { m_fallback.Preload(); }
- void
- GetGlobalVariables(ConstString basename,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(DWARFUnit &cu,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ const RegularExpression ®ex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ DWARFUnit &cu,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void
GetObjCMethods(ConstString class_name,
llvm::function_ref<bool(DWARFDIE die)> callback) override {}
@@ -51,8 +51,9 @@ public:
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetNamespaces(ConstString name,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetNamespaces(
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void
GetTypesWithQuery(TypeQuery &query,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 542dec110..45179274c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -414,23 +414,27 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
}
void ManualDWARFIndex::GetGlobalVariables(
- ConstString basename, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
- m_set.globals.Find(basename,
- DIERefCallback(IterationActionAdaptor(callback), basename.GetStringRef()));
+ m_set.globals.Find(basename, DIERefCallback(IterationActionAdaptor(callback),
+ basename.GetStringRef()));
}
void ManualDWARFIndex::GetGlobalVariables(
const RegularExpression ®ex,
llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
- m_set.globals.Find(regex, DIERefCallback(IterationActionAdaptor(callback), regex.GetText()));
+ m_set.globals.Find(
+ regex, DIERefCallback(IterationActionAdaptor(callback), regex.GetText()));
}
void ManualDWARFIndex::GetGlobalVariables(
- DWARFUnit &unit, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ DWARFUnit &unit,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
- m_set.globals.FindAllEntriesForUnit(unit, DIERefCallback(IterationActionAdaptor(callback)));
+ m_set.globals.FindAllEntriesForUnit(
+ unit, DIERefCallback(IterationActionAdaptor(callback)));
}
void ManualDWARFIndex::GetObjCMethods(
@@ -464,9 +468,11 @@ void ManualDWARFIndex::GetTypes(
}
void ManualDWARFIndex::GetNamespaces(
- ConstString name, llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) {
Index();
- m_set.namespaces.Find(name, DIERefCallback(IterationActionAdaptor(callback), name.GetStringRef()));
+ m_set.namespaces.Find(name, DIERefCallback(IterationActionAdaptor(callback),
+ name.GetStringRef()));
}
void ManualDWARFIndex::GetFunctions(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
index d58f49f00..746170cad 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
@@ -31,15 +31,15 @@ public:
void Preload() override { Index(); }
- void
- GetGlobalVariables(ConstString basename,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(const RegularExpression ®ex,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
- void
- GetGlobalVariables(DWARFUnit &unit,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ ConstString basename,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ const RegularExpression ®ex,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetGlobalVariables(
+ DWARFUnit &unit,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void GetObjCMethods(ConstString class_name,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetCompleteObjCClass(
@@ -49,8 +49,9 @@ public:
llvm::function_ref<bool(DWARFDIE die)> callback) override;
void GetTypes(const DWARFDeclContext &context,
llvm::function_ref<bool(DWARFDIE die)> callback) override;
- void GetNamespaces(ConstString name,
- llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
+ void GetNamespaces(
+ ConstString name,
+ llvm::function_ref<IterationAction(DWARFDIE die)> callback) override;
void GetFunctions(
const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf,
const CompilerDeclContext &parent_decl_ctx,
``````````
</details>
https://github.com/llvm/llvm-project/pull/151668
More information about the lldb-commits
mailing list