[Lldb-commits] [lldb] r333639 - Remove append parameter to FindGlobalVariables

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu May 31 02:46:26 PDT 2018


Author: labath
Date: Thu May 31 02:46:26 2018
New Revision: 333639

URL: http://llvm.org/viewvc/llvm-project?rev=333639&view=rev
Log:
Remove append parameter to FindGlobalVariables

Summary:
As discussed in https://bugs.llvm.org/show_bug.cgi?id=37317,
FindGlobalVariables does not properly handle the case where
append=false.  As this doesn't seem to be used in the tree, this patch
removes the parameter entirely.

Reviewers: clayborg, jingham, labath

Reviewed By: clayborg

Subscribers: aprantl, lldb-commits, kubamracek, JDevlieghere

Differential Revision: https://reviews.llvm.org/D46885
Patch by Tom Tromey <ttromey at mozilla.com>.

Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Core/ModuleList.h
    lldb/trunk/include/lldb/Symbol/SymbolFile.h
    lldb/trunk/include/lldb/Symbol/SymbolVendor.h
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp
    lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
    lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
    lldb/trunk/source/Symbol/SymbolFile.cpp
    lldb/trunk/source/Symbol/SymbolVendor.cpp
    lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu May 31 02:46:26 2018
@@ -447,26 +447,19 @@ public:
   /// @param[in] parent_decl_ctx
   ///     If valid, a decl context that results must exist within
   ///
-  /// @param[in] append
-  ///     If \b true, any matches will be appended to \a
-  ///     variable_list, else matches replace the contents of
-  ///     \a variable_list.
-  ///
   /// @param[in] max_matches
   ///     Allow the number of matches to be limited to \a
   ///     max_matches. Specify UINT32_MAX to get all possible matches.
   ///
   /// @param[in] variable_list
-  ///     A list of variables that gets the matches appended to (if
-  ///     \a append it \b true), or replace (if \a append is \b false).
+  ///     A list of variables that gets the matches appended to.
   ///
   /// @return
   ///     The number of matches added to \a variable_list.
   //------------------------------------------------------------------
   size_t FindGlobalVariables(const ConstString &name,
                              const CompilerDeclContext *parent_decl_ctx,
-                             bool append, size_t max_matches,
-                             VariableList &variable_list);
+                             size_t max_matches, VariableList &variable_list);
 
   //------------------------------------------------------------------
   /// Find global and static variables by regular expression.
@@ -474,24 +467,18 @@ public:
   /// @param[in] regex
   ///     A regular expression to use when matching the name.
   ///
-  /// @param[in] append
-  ///     If \b true, any matches will be appended to \a
-  ///     variable_list, else matches replace the contents of
-  ///     \a variable_list.
-  ///
   /// @param[in] max_matches
   ///     Allow the number of matches to be limited to \a
   ///     max_matches. Specify UINT32_MAX to get all possible matches.
   ///
   /// @param[in] variable_list
-  ///     A list of variables that gets the matches appended to (if
-  ///     \a append it \b true), or replace (if \a append is \b false).
+  ///     A list of variables that gets the matches appended to.
   ///
   /// @return
   ///     The number of matches added to \a variable_list.
   //------------------------------------------------------------------
-  size_t FindGlobalVariables(const RegularExpression &regex, bool append,
-                             size_t max_matches, VariableList &variable_list);
+  size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
+                             VariableList &variable_list);
 
   //------------------------------------------------------------------
   /// Find types by name.

Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Thu May 31 02:46:26 2018
@@ -324,24 +324,17 @@ public:
   ///     The name of the global or static variable we are looking
   ///     for.
   ///
-  /// @param[in] append
-  ///     If \b true, any matches will be appended to \a
-  ///     variable_list, else matches replace the contents of
-  ///     \a variable_list.
-  ///
   /// @param[in] max_matches
   ///     Allow the number of matches to be limited to \a
   ///     max_matches. Specify UINT32_MAX to get all possible matches.
   ///
   /// @param[in] variable_list
-  ///     A list of variables that gets the matches appended to (if
-  ///     \a append it \b true), or replace (if \a append is \b false).
+  ///     A list of variables that gets the matches appended to.
   ///
   /// @return
   ///     The number of matches added to \a variable_list.
   //------------------------------------------------------------------
-  size_t FindGlobalVariables(const ConstString &name, bool append,
-                             size_t max_matches,
+  size_t FindGlobalVariables(const ConstString &name, size_t max_matches,
                              VariableList &variable_list) const;
 
   //------------------------------------------------------------------
@@ -350,24 +343,17 @@ public:
   /// @param[in] regex
   ///     A regular expression to use when matching the name.
   ///
-  /// @param[in] append
-  ///     If \b true, any matches will be appended to \a
-  ///     variable_list, else matches replace the contents of
-  ///     \a variable_list.
-  ///
   /// @param[in] max_matches
   ///     Allow the number of matches to be limited to \a
   ///     max_matches. Specify UINT32_MAX to get all possible matches.
   ///
   /// @param[in] variable_list
-  ///     A list of variables that gets the matches appended to (if
-  ///     \a append it \b true), or replace (if \a append is \b false).
+  ///     A list of variables that gets the matches appended to.
   ///
   /// @return
   ///     The number of matches added to \a variable_list.
   //------------------------------------------------------------------
-  size_t FindGlobalVariables(const RegularExpression &regex, bool append,
-                             size_t max_matches,
+  size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
                              VariableList &variable_list) const;
 
   //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Thu May 31 02:46:26 2018
@@ -148,10 +148,10 @@ public:
                                         SymbolContextList &sc_list);
   virtual uint32_t
   FindGlobalVariables(const ConstString &name,
-                      const CompilerDeclContext *parent_decl_ctx, bool append,
+                      const CompilerDeclContext *parent_decl_ctx,
                       uint32_t max_matches, VariableList &variables);
   virtual uint32_t FindGlobalVariables(const RegularExpression &regex,
-                                       bool append, uint32_t max_matches,
+                                       uint32_t max_matches,
                                        VariableList &variables);
   virtual uint32_t FindFunctions(const ConstString &name,
                                  const CompilerDeclContext *parent_decl_ctx,

Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Thu May 31 02:46:26 2018
@@ -81,11 +81,11 @@ public:
 
   virtual size_t FindGlobalVariables(const ConstString &name,
                                      const CompilerDeclContext *parent_decl_ctx,
-                                     bool append, size_t max_matches,
+                                     size_t max_matches,
                                      VariableList &variables);
 
   virtual size_t FindGlobalVariables(const RegularExpression &regex,
-                                     bool append, size_t max_matches,
+                                     size_t max_matches,
                                      VariableList &variables);
 
   virtual size_t FindFunctions(const ConstString &name,

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Thu May 31 02:46:26 2018
@@ -367,7 +367,7 @@ SBValueList SBModule::FindGlobalVariable
   if (name && module_sp) {
     VariableList variable_list;
     const uint32_t match_count = module_sp->FindGlobalVariables(
-        ConstString(name), NULL, false, max_matches, variable_list);
+        ConstString(name), NULL, max_matches, variable_list);
 
     if (match_count > 0) {
       for (uint32_t i = 0; i < match_count; ++i) {

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Thu May 31 02:46:26 2018
@@ -1804,9 +1804,8 @@ SBValueList SBTarget::FindGlobalVariable
   TargetSP target_sp(GetSP());
   if (name && target_sp) {
     VariableList variable_list;
-    const bool append = true;
     const uint32_t match_count = target_sp->GetImages().FindGlobalVariables(
-        ConstString(name), append, max_matches, variable_list);
+        ConstString(name), max_matches, variable_list);
 
     if (match_count > 0) {
       ExecutionContextScope *exe_scope = target_sp->GetProcessSP().get();
@@ -1833,23 +1832,22 @@ SBValueList SBTarget::FindGlobalVariable
   if (name && target_sp) {
     llvm::StringRef name_ref(name);
     VariableList variable_list;
-    const bool append = true;
 
     std::string regexstr;
     uint32_t match_count;
     switch (matchtype) {
     case eMatchTypeNormal:
       match_count = target_sp->GetImages().FindGlobalVariables(
-          ConstString(name), append, max_matches, variable_list);
+          ConstString(name), max_matches, variable_list);
       break;
     case eMatchTypeRegex:
       match_count = target_sp->GetImages().FindGlobalVariables(
-          RegularExpression(name_ref), append, max_matches, variable_list);
+          RegularExpression(name_ref), max_matches, variable_list);
       break;
     case eMatchTypeStartsWith:
       regexstr = llvm::Regex::escape(name) + ".*";
       match_count = target_sp->GetImages().FindGlobalVariables(
-          RegularExpression(regexstr), append, max_matches, variable_list);
+          RegularExpression(regexstr), max_matches, variable_list);
       break;
     }
 

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu May 31 02:46:26 2018
@@ -752,7 +752,7 @@ public:
                                     VariableList &variable_list) {
     Target *target = static_cast<Target *>(baton);
     if (target) {
-      return target->GetImages().FindGlobalVariables(ConstString(name), true,
+      return target->GetImages().FindGlobalVariables(ConstString(name),
                                                      UINT32_MAX, variable_list);
     }
     return 0;
@@ -818,8 +818,8 @@ protected:
             return false;
           }
           use_var_name = true;
-          matches = target->GetImages().FindGlobalVariables(
-              regex, true, UINT32_MAX, variable_list);
+          matches = target->GetImages().FindGlobalVariables(regex, UINT32_MAX,
+                                                            variable_list);
         } else {
           Status error(Variable::GetValuesForVariableExpressionPath(
               arg, m_exe_ctx.GetBestExecutionContextScope(),
@@ -947,8 +947,8 @@ protected:
                     llvm::StringRef(
                         ".")); // Any global with at least one character
                 VariableList variable_list;
-                sc.module_sp->FindGlobalVariables(all_globals_regex, append,
-                                                  UINT32_MAX, variable_list);
+                sc.module_sp->FindGlobalVariables(all_globals_regex, UINT32_MAX,
+                                                  variable_list);
                 DumpGlobalVariableList(m_exe_ctx, sc, variable_list, s);
               }
             }

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Thu May 31 02:46:26 2018
@@ -838,7 +838,7 @@ protected:
                                     VariableList &variable_list) {
     Target *target = static_cast<Target *>(baton);
     if (target) {
-      return target->GetImages().FindGlobalVariables(ConstString(name), true,
+      return target->GetImages().FindGlobalVariables(ConstString(name),
                                                      UINT32_MAX, variable_list);
     }
     return 0;

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Thu May 31 02:46:26 2018
@@ -599,21 +599,21 @@ uint32_t Module::ResolveSymbolContextsFo
 
 size_t Module::FindGlobalVariables(const ConstString &name,
                                    const CompilerDeclContext *parent_decl_ctx,
-                                   bool append, size_t max_matches,
+                                   size_t max_matches,
                                    VariableList &variables) {
   SymbolVendor *symbols = GetSymbolVendor();
   if (symbols)
-    return symbols->FindGlobalVariables(name, parent_decl_ctx, append,
-                                        max_matches, variables);
+    return symbols->FindGlobalVariables(name, parent_decl_ctx, max_matches,
+                                        variables);
   return 0;
 }
 
-size_t Module::FindGlobalVariables(const RegularExpression &regex, bool append,
+size_t Module::FindGlobalVariables(const RegularExpression &regex,
                                    size_t max_matches,
                                    VariableList &variables) {
   SymbolVendor *symbols = GetSymbolVendor();
   if (symbols)
-    return symbols->FindGlobalVariables(regex, append, max_matches, variables);
+    return symbols->FindGlobalVariables(regex, max_matches, variables);
   return 0;
 }
 

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Thu May 31 02:46:26 2018
@@ -432,27 +432,26 @@ size_t ModuleList::FindCompileUnits(cons
   return sc_list.GetSize();
 }
 
-size_t ModuleList::FindGlobalVariables(const ConstString &name, bool append,
+size_t ModuleList::FindGlobalVariables(const ConstString &name,
                                        size_t max_matches,
                                        VariableList &variable_list) const {
   size_t initial_size = variable_list.GetSize();
   std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
   collection::const_iterator pos, end = m_modules.end();
   for (pos = m_modules.begin(); pos != end; ++pos) {
-    (*pos)->FindGlobalVariables(name, nullptr, append, max_matches,
-                                variable_list);
+    (*pos)->FindGlobalVariables(name, nullptr, max_matches, variable_list);
   }
   return variable_list.GetSize() - initial_size;
 }
 
 size_t ModuleList::FindGlobalVariables(const RegularExpression &regex,
-                                       bool append, size_t max_matches,
+                                       size_t max_matches,
                                        VariableList &variable_list) const {
   size_t initial_size = variable_list.GetSize();
   std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
   collection::const_iterator pos, end = m_modules.end();
   for (pos = m_modules.begin(); pos != end; ++pos) {
-    (*pos)->FindGlobalVariables(regex, append, max_matches, variable_list);
+    (*pos)->FindGlobalVariables(regex, max_matches, variable_list);
   }
   return variable_list.GetSize() - initial_size;
 }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Thu May 31 02:46:26 2018
@@ -720,9 +720,9 @@ lldb::VariableSP ClangExpressionDeclMap:
   VariableList vars;
 
   if (module && namespace_decl)
-    module->FindGlobalVariables(name, namespace_decl, true, -1, vars);
+    module->FindGlobalVariables(name, namespace_decl, -1, vars);
   else
-    target.GetImages().FindGlobalVariables(name, true, -1, vars);
+    target.GetImages().FindGlobalVariables(name, -1, vars);
 
   if (vars.GetSize()) {
     if (type) {

Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp Thu May 31 02:46:26 2018
@@ -171,12 +171,11 @@ private:
 VariableSP FindGlobalVariable(TargetSP target, llvm::Twine name) {
   ConstString fullname(name.str());
   VariableList variable_list;
-  const bool append = true;
   if (!target) {
     return nullptr;
   }
-  const uint32_t match_count = target->GetImages().FindGlobalVariables(
-      fullname, append, 1, variable_list);
+  const uint32_t match_count =
+      target->GetImages().FindGlobalVariables(fullname, 1, variable_list);
   if (match_count == 1) {
     return variable_list.GetVariableAtIndex(0);
   }

Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp Thu May 31 02:46:26 2018
@@ -573,7 +573,7 @@ static void GetSymbolDeclarationFromAddr
     return;
 
   VariableList var_list;
-  module->FindGlobalVariables(sym_name, nullptr, true, 1U, var_list);
+  module->FindGlobalVariables(sym_name, nullptr, 1U, var_list);
   if (var_list.GetSize() < 1)
     return;
 

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu May 31 02:46:26 2018
@@ -2328,7 +2328,7 @@ void RenderScriptRuntime::FindStructType
   VariableList var_list;
   for (auto module_sp : m_rsmodules)
     module_sp->m_module->FindGlobalVariables(
-        RegularExpression(llvm::StringRef(".")), true, UINT32_MAX, var_list);
+        RegularExpression(llvm::StringRef(".")), UINT32_MAX, var_list);
 
   // Iterate over all the global variables looking for one with a matching type
   // to the Element. We make the assumption a match exists since there needs to
@@ -4065,7 +4065,7 @@ void RSModuleDescriptor::Dump(Stream &st
 void RSGlobalDescriptor::Dump(Stream &strm) const {
   strm.Indent(m_name.AsCString());
   VariableList var_list;
-  m_module->m_module->FindGlobalVariables(m_name, nullptr, true, 1U, var_list);
+  m_module->m_module->FindGlobalVariables(m_name, nullptr, 1U, var_list);
   if (var_list.GetSize() == 1) {
     auto var = var_list.GetVariableAtIndex(0);
     auto type = var->GetType();

Modified: lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp Thu May 31 02:46:26 2018
@@ -402,7 +402,6 @@ lldb::ThreadSP OperatingSystemGo::Create
 
 ValueObjectSP OperatingSystemGo::FindGlobal(TargetSP target, const char *name) {
   VariableList variable_list;
-  const bool append = true;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));
 
@@ -414,7 +413,7 @@ ValueObjectSP OperatingSystemGo::FindGlo
   }
 
   uint32_t match_count = target->GetImages().FindGlobalVariables(
-      ConstString(name), append, 1, variable_list);
+      ConstString(name), 1, variable_list);
   if (match_count > 0) {
     ExecutionContextScope *exe_scope = target->GetProcessSP().get();
     if (exe_scope == NULL)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu May 31 02:46:26 2018
@@ -1968,14 +1968,15 @@ bool SymbolFileDWARF::DeclContextMatches
 
 uint32_t SymbolFileDWARF::FindGlobalVariables(
     const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
-    bool append, uint32_t max_matches, VariableList &variables) {
+    uint32_t max_matches, VariableList &variables) {
   Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
   if (log)
     GetObjectFile()->GetModule()->LogMessage(
-        log, "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", "
-             "parent_decl_ctx=%p, append=%u, max_matches=%u, variables)",
-        name.GetCString(), static_cast<const void *>(parent_decl_ctx), append,
+        log,
+        "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", "
+        "parent_decl_ctx=%p, max_matches=%u, variables)",
+        name.GetCString(), static_cast<const void *>(parent_decl_ctx),
         max_matches);
 
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
@@ -1985,12 +1986,7 @@ uint32_t SymbolFileDWARF::FindGlobalVari
   if (info == NULL)
     return 0;
 
-  // If we aren't appending the results to this list, then clear the list
-  if (!append)
-    variables.Clear();
-
-  // Remember how many variables are in the list before we search in case we
-  // are appending the results to a variable list.
+  // Remember how many variables are in the list before we search.
   const uint32_t original_size = variables.GetSize();
 
   DIEArray die_offsets;
@@ -2047,36 +2043,33 @@ uint32_t SymbolFileDWARF::FindGlobalVari
   const uint32_t num_matches = variables.GetSize() - original_size;
   if (log && num_matches > 0) {
     GetObjectFile()->GetModule()->LogMessage(
-        log, "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", "
-             "parent_decl_ctx=%p, append=%u, max_matches=%u, variables) => %u",
-        name.GetCString(), static_cast<const void *>(parent_decl_ctx), append,
+        log,
+        "SymbolFileDWARF::FindGlobalVariables (name=\"%s\", "
+        "parent_decl_ctx=%p, max_matches=%u, variables) => %u",
+        name.GetCString(), static_cast<const void *>(parent_decl_ctx),
         max_matches, num_matches);
   }
   return num_matches;
 }
 
 uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression &regex,
-                                              bool append, uint32_t max_matches,
+                                              uint32_t max_matches,
                                               VariableList &variables) {
   Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
 
   if (log) {
     GetObjectFile()->GetModule()->LogMessage(
-        log, "SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, "
-             "max_matches=%u, variables)",
-        regex.GetText().str().c_str(), append, max_matches);
+        log,
+        "SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", "
+        "max_matches=%u, variables)",
+        regex.GetText().str().c_str(), max_matches);
   }
 
   DWARFDebugInfo *info = DebugInfo();
   if (info == NULL)
     return 0;
 
-  // If we aren't appending the results to this list, then clear the list
-  if (!append)
-    variables.Clear();
-
-  // Remember how many variables are in the list before we search in case we
-  // are appending the results to a variable list.
+  // Remember how many variables are in the list before we search.
   const uint32_t original_size = variables.GetSize();
 
   DIEArray die_offsets;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Thu May 31 02:46:26 2018
@@ -179,11 +179,11 @@ public:
   uint32_t
   FindGlobalVariables(const lldb_private::ConstString &name,
                       const lldb_private::CompilerDeclContext *parent_decl_ctx,
-                      bool append, uint32_t max_matches,
+                      uint32_t max_matches,
                       lldb_private::VariableList &variables) override;
 
   uint32_t FindGlobalVariables(const lldb_private::RegularExpression &regex,
-                               bool append, uint32_t max_matches,
+                               uint32_t max_matches,
                                lldb_private::VariableList &variables) override;
 
   uint32_t

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu May 31 02:46:26 2018
@@ -801,8 +801,8 @@ uint32_t SymbolFileDWARFDebugMap::Privat
     if (comp_unit_info) {
       SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
       if (oso_dwarf) {
-        if (oso_dwarf->FindGlobalVariables(name, parent_decl_ctx, true,
-                                           max_matches, variables))
+        if (oso_dwarf->FindGlobalVariables(name, parent_decl_ctx, max_matches,
+                                           variables))
           if (variables.GetSize() > max_matches)
             break;
       }
@@ -813,21 +813,16 @@ uint32_t SymbolFileDWARFDebugMap::Privat
 
 uint32_t SymbolFileDWARFDebugMap::FindGlobalVariables(
     const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
-    bool append, uint32_t max_matches, VariableList &variables) {
+    uint32_t max_matches, VariableList &variables) {
 
-  // If we aren't appending the results to this list, then clear the list
-  if (!append)
-    variables.Clear();
-
-  // Remember how many variables are in the list before we search in case we
-  // are appending the results to a variable list.
+  // Remember how many variables are in the list before we search.
   const uint32_t original_size = variables.GetSize();
 
   uint32_t total_matches = 0;
 
   ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
     const uint32_t oso_matches = oso_dwarf->FindGlobalVariables(
-        name, parent_decl_ctx, true, max_matches, variables);
+        name, parent_decl_ctx, max_matches, variables);
     if (oso_matches > 0) {
       total_matches += oso_matches;
 
@@ -853,20 +848,15 @@ uint32_t SymbolFileDWARFDebugMap::FindGl
 
 uint32_t
 SymbolFileDWARFDebugMap::FindGlobalVariables(const RegularExpression &regex,
-                                             bool append, uint32_t max_matches,
+                                             uint32_t max_matches,
                                              VariableList &variables) {
-  // If we aren't appending the results to this list, then clear the list
-  if (!append)
-    variables.Clear();
-
-  // Remember how many variables are in the list before we search in case we
-  // are appending the results to a variable list.
+  // Remember how many variables are in the list before we search.
   const uint32_t original_size = variables.GetSize();
 
   uint32_t total_matches = 0;
   ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
     const uint32_t oso_matches =
-        oso_dwarf->FindGlobalVariables(regex, true, max_matches, variables);
+        oso_dwarf->FindGlobalVariables(regex, max_matches, variables);
     if (oso_matches > 0) {
       total_matches += oso_matches;
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Thu May 31 02:46:26 2018
@@ -95,10 +95,10 @@ public:
   uint32_t
   FindGlobalVariables(const lldb_private::ConstString &name,
                       const lldb_private::CompilerDeclContext *parent_decl_ctx,
-                      bool append, uint32_t max_matches,
+                      uint32_t max_matches,
                       lldb_private::VariableList &variables) override;
   uint32_t FindGlobalVariables(const lldb_private::RegularExpression &regex,
-                               bool append, uint32_t max_matches,
+                               uint32_t max_matches,
                                lldb_private::VariableList &variables) override;
   uint32_t
   FindFunctions(const lldb_private::ConstString &name,

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Thu May 31 02:46:26 2018
@@ -949,10 +949,8 @@ SymbolFilePDB::ParseVariables(const lldb
 
 uint32_t SymbolFilePDB::FindGlobalVariables(
     const lldb_private::ConstString &name,
-    const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append,
+    const lldb_private::CompilerDeclContext *parent_decl_ctx,
     uint32_t max_matches, lldb_private::VariableList &variables) {
-  if (!append)
-    variables.Clear();
   if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
     return 0;
   if (name.IsEmpty())
@@ -989,7 +987,7 @@ uint32_t SymbolFilePDB::FindGlobalVariab
 
 uint32_t
 SymbolFilePDB::FindGlobalVariables(const lldb_private::RegularExpression &regex,
-                                   bool append, uint32_t max_matches,
+                                   uint32_t max_matches,
                                    lldb_private::VariableList &variables) {
   if (!regex.IsValid())
     return 0;

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h Thu May 31 02:46:26 2018
@@ -111,11 +111,11 @@ public:
   uint32_t
   FindGlobalVariables(const lldb_private::ConstString &name,
                       const lldb_private::CompilerDeclContext *parent_decl_ctx,
-                      bool append, uint32_t max_matches,
+                      uint32_t max_matches,
                       lldb_private::VariableList &variables) override;
 
   uint32_t FindGlobalVariables(const lldb_private::RegularExpression &regex,
-                               bool append, uint32_t max_matches,
+                               uint32_t max_matches,
                                lldb_private::VariableList &variables) override;
 
   uint32_t

Modified: lldb/trunk/source/Symbol/SymbolFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolFile.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolFile.cpp Thu May 31 02:46:26 2018
@@ -96,19 +96,16 @@ uint32_t SymbolFile::ResolveSymbolContex
   return 0;
 }
 
-uint32_t SymbolFile::FindGlobalVariables(
-    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
-    bool append, uint32_t max_matches, VariableList &variables) {
-  if (!append)
-    variables.Clear();
+uint32_t
+SymbolFile::FindGlobalVariables(const ConstString &name,
+                                const CompilerDeclContext *parent_decl_ctx,
+                                uint32_t max_matches, VariableList &variables) {
   return 0;
 }
 
 uint32_t SymbolFile::FindGlobalVariables(const RegularExpression &regex,
-                                         bool append, uint32_t max_matches,
+                                         uint32_t max_matches,
                                          VariableList &variables) {
-  if (!append)
-    variables.Clear();
   return 0;
 }
 

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Thu May 31 02:46:26 2018
@@ -260,28 +260,28 @@ uint32_t SymbolVendor::ResolveSymbolCont
   return 0;
 }
 
-size_t SymbolVendor::FindGlobalVariables(
-    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
-    bool append, size_t max_matches, VariableList &variables) {
+size_t
+SymbolVendor::FindGlobalVariables(const ConstString &name,
+                                  const CompilerDeclContext *parent_decl_ctx,
+                                  size_t max_matches, VariableList &variables) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
     std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
     if (m_sym_file_ap.get())
-      return m_sym_file_ap->FindGlobalVariables(name, parent_decl_ctx, append,
+      return m_sym_file_ap->FindGlobalVariables(name, parent_decl_ctx,
                                                 max_matches, variables);
   }
   return 0;
 }
 
 size_t SymbolVendor::FindGlobalVariables(const RegularExpression &regex,
-                                         bool append, size_t max_matches,
+                                         size_t max_matches,
                                          VariableList &variables) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
     std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
     if (m_sym_file_ap.get())
-      return m_sym_file_ap->FindGlobalVariables(regex, append, max_matches,
-                                                variables);
+      return m_sym_file_ap->FindGlobalVariables(regex, max_matches, variables);
   }
   return 0;
 }

Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=333639&r1=333638&r2=333639&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Thu May 31 02:46:26 2018
@@ -284,8 +284,7 @@ opts::symbols::getDeclContext(SymbolVend
   if (Context.empty())
     return CompilerDeclContext();
   VariableList List;
-  Vendor.FindGlobalVariables(ConstString(Context), nullptr, false, UINT32_MAX,
-                             List);
+  Vendor.FindGlobalVariables(ConstString(Context), nullptr, UINT32_MAX, List);
   if (List.Empty()) {
     return make_error<StringError>("Context search didn't find a match.",
                                    inconvertibleErrorCode());
@@ -367,7 +366,7 @@ Error opts::symbols::findVariables(lldb_
   if (Regex) {
     RegularExpression RE(Name);
     assert(RE.IsValid());
-    Vendor.FindGlobalVariables(RE, false, UINT32_MAX, List);
+    Vendor.FindGlobalVariables(RE, UINT32_MAX, List);
   } else {
     Expected<CompilerDeclContext> ContextOr = getDeclContext(Vendor);
     if (!ContextOr)
@@ -375,8 +374,7 @@ Error opts::symbols::findVariables(lldb_
     CompilerDeclContext *ContextPtr =
         ContextOr->IsValid() ? &*ContextOr : nullptr;
 
-    Vendor.FindGlobalVariables(ConstString(Name), ContextPtr, false, UINT32_MAX,
-                               List);
+    Vendor.FindGlobalVariables(ConstString(Name), ContextPtr, UINT32_MAX, List);
   }
   outs() << formatv("Found {0} variables:\n", List.GetSize());
   StreamString Stream;




More information about the lldb-commits mailing list