Skip to content

Commit e67d229

Browse files
author
thk123
committed
Renamed find declaration method
To be more consistent, renamed to require rather than find since it throws if the declaration is not found
1 parent fa14b47 commit e67d229

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

unit/testing-utils/require_goto_statements.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
\*******************************************************************/
88

99
#include "require_goto_statements.h"
10+
#include "catch.hpp"
1011

1112
#include <algorithm>
1213
#include <util/expr_iterator.h>
@@ -120,7 +121,7 @@ require_goto_statements::find_pointer_assignments(
120121
/// \param variable_name: The name of the variable.
121122
/// \param entry_point_instructions: The statements to look through
122123
/// \return The declaration statement corresponding to that variable
123-
const code_declt &require_goto_statements::find_declaration_by_name(
124+
const code_declt &require_goto_statements::require_declaration_of_name(
124125
const irep_idt &variable_name,
125126
const std::vector<codet> &entry_point_instructions)
126127
{

unit/testing-utils/require_goto_statements.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
#ifndef CPROVER_TESTING_UTILS_CHECK_GOTO_FUNCTIONS_H
2020
#define CPROVER_TESTING_UTILS_CHECK_GOTO_FUNCTIONS_H
2121

22+
namespace require_goto_statements
23+
{
24+
struct pointer_assignment_locationt
25+
{
26+
optionalt<code_assignt> null_assignment;
27+
std::vector<code_assignt> non_null_assignments;
28+
};
29+
2230
class no_decl_found_exception : public std::exception
2331
{
2432
public:
@@ -38,26 +46,18 @@ class no_decl_found_exception : public std::exception
3846
std::string _varname;
3947
};
4048

41-
namespace require_goto_statements
42-
{
4349
std::vector<code_assignt> find_struct_component_assignments(
4450
const std::vector<codet> &statements,
4551
const irep_idt &structure_name,
4652
const irep_idt &component_name);
4753

48-
struct pointer_assignment_locationt
49-
{
50-
optionalt<code_assignt> null_assignment;
51-
std::vector<code_assignt> non_null_assignments;
52-
};
53-
5454
std::vector<codet> get_all_statements(const exprt &function_value);
5555

5656
pointer_assignment_locationt find_pointer_assignments(
5757
const irep_idt &pointer_name,
5858
const std::vector<codet> &instructions);
5959

60-
const code_declt &find_declaration_by_name(
60+
const code_declt &require_declaration_of_name(
6161
const irep_idt &variable_name,
6262
const std::vector<codet> &entry_point_instructions);
6363
}

0 commit comments

Comments
 (0)