Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move ignore_local_variable() into Process
[simgrid.git] / src / mc / mcer_ignore.cpp
index 1ef7852..e78f482 100644 (file)
@@ -25,94 +25,3 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mcer_ignore, mc,
                                 "Logging specific to MC ignore mechanism");
 
 }
-
-// ***** Ignore local variables
-
-static void mc_ignore_local_variable_in_scope(const char *var_name,
-                                              const char *subprogram_name,
-                                              simgrid::mc::Frame* subprogram,
-                                              simgrid::mc::Frame* scope);
-static void MC_ignore_local_variable_in_object(const char *var_name,
-                                               const char *subprogram_name,
-                                               simgrid::mc::ObjectInformation* info);
-
-extern "C"
-void MC_ignore_local_variable(const char *var_name, const char *frame_name)
-{
-  simgrid::mc::Process* process = &mc_model_checker->process();
-  if (strcmp(frame_name, "*") == 0)
-    frame_name = NULL;
-
-  for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : process->object_infos)
-    MC_ignore_local_variable_in_object(var_name, frame_name, info.get());
-}
-
-static void MC_ignore_local_variable_in_object(const char *var_name,
-                                               const char *subprogram_name,
-                                               simgrid::mc::ObjectInformation* info)
-{
-  for (auto& entry : info->subprograms)
-    mc_ignore_local_variable_in_scope(
-      var_name, subprogram_name, &entry.second, &entry.second);
-}
-
-/** \brief Ignore a local variable in a scope
- *
- *  Ignore all instances of variables with a given name in
- *  any (possibly inlined) subprogram with a given namespaced
- *  name.
- *
- *  \param var_name        Name of the local variable (or parameter to ignore)
- *  \param subprogram_name Name of the subprogram fo ignore (NULL for any)
- *  \param subprogram      (possibly inlined) Subprogram of the scope
- *  \param scope           Current scope
- */
-static void mc_ignore_local_variable_in_scope(const char *var_name,
-                                              const char *subprogram_name,
-                                              simgrid::mc::Frame* subprogram,
-                                              simgrid::mc::Frame* scope)
-{
-  // Processing of direct variables:
-
-  // If the current subprogram matches the given name:
-  if (subprogram_name == nullptr ||
-      (!subprogram->name.empty()
-        && subprogram->name == subprogram_name)) {
-
-    // Try to find the variable and remove it:
-    int start = 0;
-    int end = scope->variables.size() - 1;
-
-    // Dichotomic search:
-    while (start <= end) {
-      int cursor = (start + end) / 2;
-      simgrid::mc::Variable* current_var = &scope->variables[cursor];
-
-      int compare = current_var->name.compare(var_name);
-      if (compare == 0) {
-        // Variable found, remove it:
-        scope->variables.erase(scope->variables.begin() + cursor);
-
-        // and start again:
-        start = 0;
-        end = scope->variables.size() - 1;
-      } else if (compare < 0) {
-        start = cursor + 1;
-      } else {
-        end = cursor - 1;
-      }
-    }
-
-  }
-  // And recursive processing in nested scopes:
-  for (simgrid::mc::Frame& nested_scope : scope->scopes) {
-    // The new scope may be an inlined subroutine, in this case we want to use its
-    // namespaced name in recursive calls:
-    simgrid::mc::Frame* nested_subprogram =
-        nested_scope.tag ==
-        DW_TAG_inlined_subroutine ? &nested_scope : subprogram;
-
-    mc_ignore_local_variable_in_scope(var_name, subprogram_name,
-                                      nested_subprogram, &nested_scope);
-  }
-}
\ No newline at end of file