Skip to content

[lldb][NFCI] Remove unused parameter from BreakpointResolver*::CreateFromStructuredData #75374

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

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

bulbazord
Copy link
Member

These appear to be unused.

…FromStructuredData

These appear to be unused.
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2023

@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)

Changes

These appear to be unused.


Full diff: https://github.com/llvm/llvm-project/pull/75374.diff

11 Files Affected:

  • (modified) lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h (+1-2)
  • (modified) lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h (+1-2)
  • (modified) lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h (+1-2)
  • (modified) lldb/include/lldb/Breakpoint/BreakpointResolverName.h (+1-2)
  • (modified) lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h (+1-2)
  • (modified) lldb/source/Breakpoint/BreakpointResolver.cpp (+5-5)
  • (modified) lldb/source/Breakpoint/BreakpointResolverAddress.cpp (+2-3)
  • (modified) lldb/source/Breakpoint/BreakpointResolverFileLine.cpp (+2-3)
  • (modified) lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp (+2-3)
  • (modified) lldb/source/Breakpoint/BreakpointResolverName.cpp (+4-4)
  • (modified) lldb/source/Breakpoint/BreakpointResolverScripted.cpp (+3-4)
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h b/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
index 03ae69acae4c4f..3a09892f3f1943 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
@@ -31,8 +31,7 @@ class BreakpointResolverAddress : public BreakpointResolver {
   ~BreakpointResolverAddress() override = default;
 
   static lldb::BreakpointResolverSP
-  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
-                           const StructuredData::Dictionary &options_dict,
+  CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
                            Status &error);
 
   StructuredData::ObjectSP SerializeToStructuredData() override;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index 7635729c50a6e0..610d81727c6c6a 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -28,8 +28,7 @@ class BreakpointResolverFileLine : public BreakpointResolver {
       std::optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
 
   static lldb::BreakpointResolverSP
-  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
-                           const StructuredData::Dictionary &data_dict,
+  CreateFromStructuredData(const StructuredData::Dictionary &data_dict,
                            Status &error);
 
   StructuredData::ObjectSP SerializeToStructuredData() override;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
index 43e1217c13d5ef..1dcdba91a5a8d5 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
@@ -28,8 +28,7 @@ class BreakpointResolverFileRegex : public BreakpointResolver {
       const std::unordered_set<std::string> &func_name_set, bool exact_match);
 
   static lldb::BreakpointResolverSP
-  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
-                           const StructuredData::Dictionary &options_dict,
+  CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
                            Status &error);
 
   StructuredData::ObjectSP SerializeToStructuredData() override;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
index 94b19db3085d76..c83814c174e883 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverName.h
@@ -51,8 +51,7 @@ class BreakpointResolverName : public BreakpointResolver {
                          bool skip_prologue);
 
   static lldb::BreakpointResolverSP
-  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
-                           const StructuredData::Dictionary &data_dict,
+  CreateFromStructuredData(const StructuredData::Dictionary &data_dict,
                            Status &error);
 
   StructuredData::ObjectSP SerializeToStructuredData() override;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h b/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
index c0bbc1c2bafb70..133fa8058637bb 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
@@ -31,8 +31,7 @@ class BreakpointResolverScripted : public BreakpointResolver {
   ~BreakpointResolverScripted() override = default;
 
   static lldb::BreakpointResolverSP
-  CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
-                           const StructuredData::Dictionary &options_dict,
+  CreateFromStructuredData(const StructuredData::Dictionary &options_dict,
                            Status &error);
 
   StructuredData::ObjectSP SerializeToStructuredData() override;
diff --git a/lldb/source/Breakpoint/BreakpointResolver.cpp b/lldb/source/Breakpoint/BreakpointResolver.cpp
index 60406bdc44625d..89ea308b1eb070 100644
--- a/lldb/source/Breakpoint/BreakpointResolver.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolver.cpp
@@ -113,23 +113,23 @@ BreakpointResolverSP BreakpointResolver::CreateFromStructuredData(
   switch (resolver_type) {
   case FileLineResolver:
     result_sp = BreakpointResolverFileLine::CreateFromStructuredData(
-        nullptr, *subclass_options, error);
+        *subclass_options, error);
     break;
   case AddressResolver:
     result_sp = BreakpointResolverAddress::CreateFromStructuredData(
-        nullptr, *subclass_options, error);
+        *subclass_options, error);
     break;
   case NameResolver:
     result_sp = BreakpointResolverName::CreateFromStructuredData(
-        nullptr, *subclass_options, error);
+        *subclass_options, error);
     break;
   case FileRegexResolver:
     result_sp = BreakpointResolverFileRegex::CreateFromStructuredData(
-        nullptr, *subclass_options, error);
+        *subclass_options, error);
     break;
   case PythonResolver:
     result_sp = BreakpointResolverScripted::CreateFromStructuredData(
-        nullptr, *subclass_options, error);
+        *subclass_options, error);
     break;
   case ExceptionResolver:
     error.SetErrorString("Exception resolvers are hard.");
diff --git a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
index 19fc81a28a7f4a..a0c628a8e299ce 100644
--- a/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverAddress.cpp
@@ -31,8 +31,7 @@ BreakpointResolverAddress::BreakpointResolverAddress(const BreakpointSP &bkpt,
       m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS) {}
 
 BreakpointResolverSP BreakpointResolverAddress::CreateFromStructuredData(
-    const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict,
-    Status &error) {
+    const StructuredData::Dictionary &options_dict, Status &error) {
   llvm::StringRef module_name;
   lldb::offset_t addr_offset;
   FileSpec module_filespec;
@@ -56,7 +55,7 @@ BreakpointResolverSP BreakpointResolverAddress::CreateFromStructuredData(
     }
     module_filespec.SetFile(module_name, FileSpec::Style::native);
   }
-  return std::make_shared<BreakpointResolverAddress>(bkpt, address,
+  return std::make_shared<BreakpointResolverAddress>(nullptr, address,
                                                      module_filespec);
 }
 
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index c28b78a0056f9a..61bef498438bdd 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -31,8 +31,7 @@ BreakpointResolverFileLine::BreakpointResolverFileLine(
       m_removed_prefix_opt(removed_prefix_opt) {}
 
 BreakpointResolverSP BreakpointResolverFileLine::CreateFromStructuredData(
-    const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict,
-    Status &error) {
+    const StructuredData::Dictionary &options_dict, Status &error) {
   llvm::StringRef filename;
   uint32_t line;
   uint16_t column;
@@ -91,7 +90,7 @@ BreakpointResolverSP BreakpointResolverFileLine::CreateFromStructuredData(
     return nullptr;
 
   return std::make_shared<BreakpointResolverFileLine>(
-      bkpt, offset, skip_prologue, location_spec);
+      nullptr, offset, skip_prologue, location_spec);
 }
 
 StructuredData::ObjectSP
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
index 13c7f17fd807ee..06d346afb9f620 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -27,7 +27,6 @@ BreakpointResolverFileRegex::BreakpointResolverFileRegex(
       m_function_names(func_names) {}
 
 BreakpointResolverSP BreakpointResolverFileRegex::CreateFromStructuredData(
-    const lldb::BreakpointSP &bkpt,
     const StructuredData::Dictionary &options_dict, Status &error) {
   bool success;
 
@@ -67,8 +66,8 @@ BreakpointResolverSP BreakpointResolverFileRegex::CreateFromStructuredData(
     }
   }
 
-  return std::make_shared<BreakpointResolverFileRegex>(bkpt, std::move(regex),
-                                                       names_set, exact_match);
+  return std::make_shared<BreakpointResolverFileRegex>(
+      nullptr, std::move(regex), names_set, exact_match);
 }
 
 StructuredData::ObjectSP
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 0097046cf511b5..82eef43ad6cfd2 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -87,8 +87,7 @@ BreakpointResolverName::BreakpointResolverName(
       m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {}
 
 BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
-    const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict,
-    Status &error) {
+    const StructuredData::Dictionary &options_dict, Status &error) {
   LanguageType language = eLanguageTypeUnknown;
   llvm::StringRef language_name;
   bool success = options_dict.GetValueForKeyAsString(
@@ -123,7 +122,8 @@ BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
       GetKey(OptionNames::RegexString), regex_text);
   if (success) {
     return std::make_shared<BreakpointResolverName>(
-        bkpt, RegularExpression(regex_text), language, offset, skip_prologue);
+        nullptr, RegularExpression(regex_text), language, offset,
+        skip_prologue);
   } else {
     StructuredData::Array *names_array;
     success = options_dict.GetValueForKeyAsArray(
@@ -173,7 +173,7 @@ BreakpointResolverSP BreakpointResolverName::CreateFromStructuredData(
 
     std::shared_ptr<BreakpointResolverName> resolver_sp =
         std::make_shared<BreakpointResolverName>(
-            bkpt, names[0].c_str(), name_masks[0], language,
+            nullptr, names[0].c_str(), name_masks[0], language,
             Breakpoint::MatchType::Exact, offset, skip_prologue);
     for (size_t i = 1; i < num_elem; i++) {
       resolver_sp->AddNameLookup(ConstString(names[i]), name_masks[i]);
diff --git a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
index 664ce4d573f943..dbfa8b8572f2ab 100644
--- a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
@@ -59,8 +59,7 @@ void BreakpointResolverScripted::NotifyBreakpointSet() {
 }
 
 BreakpointResolverSP BreakpointResolverScripted::CreateFromStructuredData(
-    const BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict,
-    Status &error) {
+    const StructuredData::Dictionary &options_dict, Status &error) {
   llvm::StringRef class_name;
   bool success;
 
@@ -79,8 +78,8 @@ BreakpointResolverSP BreakpointResolverScripted::CreateFromStructuredData(
   if (options_dict.GetValueForKeyAsDictionary(GetKey(OptionNames::ScriptArgs),
                                               args_dict))
     args_data_impl.SetObjectSP(args_dict->shared_from_this());
-  return std::make_shared<BreakpointResolverScripted>(bkpt, class_name, depth,
-                                                      args_data_impl);
+  return std::make_shared<BreakpointResolverScripted>(nullptr, class_name,
+                                                      depth, args_data_impl);
 }
 
 StructuredData::ObjectSP

@clayborg
Copy link
Collaborator

I would make sure with @jimingham that this isn't used for "breakpoints read" or "breakpoints write"? What were these added for?

@jimingham
Copy link
Collaborator

You don't need the breakpoint to create the resolver. It's been a while, but I imagine I was passing in the breakpoint here so that if there were errors with deserializing the resolver from the structured data we could mention the breakpoint number. But that's not really necessary, you can add the breakpoint number to the error reporting after you get the error back from CreateFromStructuredData. So this looks fine to me.

@bulbazord bulbazord merged commit 7113c80 into llvm:main Dec 15, 2023
@bulbazord bulbazord deleted the breakpoint-resolver-unused-param branch December 15, 2023 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants