Skip to content

Commit b80d063

Browse files
Doxygen corrections
1 parent 369dd62 commit b80d063

10 files changed

+90
-69
lines changed

src/java_bytecode/java_string_library_preprocess.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,18 @@ void add_array_to_length_association(
712712
symbol_table));
713713
}
714714

715-
/// \param string_expr: a string expression
716715
/// \param function_name: the name of the function
717716
/// \param arguments: arguments of the function
717+
/// \param loc: source location
718718
/// \param symbol_table: symbol table
719-
/// \return return the following code:
719+
/// \param [out] code: gets added the following code:
720720
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
721721
/// int return_code;
722722
/// int str.length;
723723
/// char str.data[str.length]
724724
/// return_code = <function_name>_data(str.length, str.data, arguments)
725725
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
726+
/// \return a new string expression
726727
refined_string_exprt java_string_library_preprocesst::string_expr_of_function(
727728
const irep_idt &function_name,
728729
const exprt::operandst &arguments,
@@ -845,14 +846,15 @@ void java_string_library_preprocesst::code_assign_java_string_to_string_expr(
845846
}
846847

847848
/// Create a string expression whose value is given by a literal
848-
/// \param lhs: an expression representing a java string
849849
/// \param s: the literal to be assigned
850+
/// \param loc: location in the source
850851
/// \param symbol_table: symbol table
851-
/// \param code: gets added the following:
852+
/// \param [out] code: gets added the following:
852853
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
853854
/// tmp_string = "<s>"
854855
/// lhs = cprover_string_literal_func(tmp_string)
855856
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
857+
/// \return a new refined string
856858
refined_string_exprt
857859
java_string_library_preprocesst::string_literal_to_string_expr(
858860
const std::string &s,

src/solvers/refinement/string_constraint.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Author: Romain Brenguier, [email protected]
1313
/// \file
1414
/// Defines string constraints. These are formulas talking about strings. We
1515
/// implemented two forms of constraints: `string_constraintt` are formulas
16-
/// of the form $\forall univ_var \in [lb,ub[. prem => body$, and
17-
/// not_contains_constraintt of the form: $\forall x in [lb,ub[. p(x) =>
18-
/// \exists y in [lb,ub[. s1[x+y] != s2[y]$.
16+
/// of the form \f$\forall univ\_var \in [lb,ub[. prem => body\f$, and
17+
/// not_contains_constraintt of the form: \f$\forall x \in [lb,ub[. p(x) =>
18+
/// \exists y \in [lb,ub[. s1[x+y] \ne s2[y]\f$.
1919

2020
#ifndef CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H
2121
#define CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H

src/solvers/refinement/string_constraint_generator_code_points.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Author: Romain Brenguier, [email protected]
1414

1515
/// add axioms for the conversion of an integer representing a java
1616
/// code point to a utf-16 string
17-
/// \param code_point an expression representing a java code point
17+
/// \param res: array of characters corresponding to the result fo the function
18+
/// \param code_point: an expression representing a java code point
1819
/// \return an expression
1920
exprt string_constraint_generatort::add_axioms_for_code_point(
2021
const array_string_exprt &res,
@@ -69,7 +70,7 @@ exprt string_constraint_generatort::add_axioms_for_code_point(
6970
/// encoding, see https://en.wikipedia.org/wiki/UTF-16 for more explenation
7071
/// about the encoding; this is true when the character is in the range
7172
/// 0xD800..0xDBFF
72-
/// \par parameters: a character expression
73+
/// \param chr: a character expression
7374
/// \return a Boolean expression
7475
exprt string_constraint_generatort::is_high_surrogate(const exprt &chr)
7576
{
@@ -82,7 +83,7 @@ exprt string_constraint_generatort::is_high_surrogate(const exprt &chr)
8283
/// encoding, see https://en.wikipedia.org/wiki/UTF-16 for more explenation
8384
/// about the encoding; this is true when the character is in the range
8485
/// 0xDC00..0xDFFF
85-
/// \par parameters: a character expression
86+
/// \param chr: a character expression
8687
/// \return a Boolean expression
8788
exprt string_constraint_generatort::is_low_surrogate(const exprt &chr)
8889
{
@@ -96,8 +97,9 @@ exprt string_constraint_generatort::is_low_surrogate(const exprt &chr)
9697
/// https://en.wikipedia.org/wiki/UTF-16 for more explenation about the
9798
/// encoding; the operation we perform is:
9899
/// pair_value=0x10000+(((char1%0x0800)*0x0400)+char2%0x0400)
99-
/// \par parameters: two character expressions and a return type
100-
/// char1 and char2 should be of type return_type
100+
/// \param char1: a character expression
101+
/// \param char2: a character expression
102+
/// \param return_type: type of the expression to return
101103
/// \return an integer expression of type return_type
102104
exprt pair_value(exprt char1, exprt char2, typet return_type)
103105
{

src/solvers/refinement/string_constraint_generator_concat.cpp

+16-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Author: Romain Brenguier, [email protected]
1313

1414
#include <solvers/refinement/string_constraint_generator.h>
1515

16-
/// Add axioms enforcing that `s0` is the concatenation of `s1` with
16+
/// Add axioms enforcing that `res` is the concatenation of `s1` with
1717
/// the substring of `s2` starting at index `start_index` and ending
1818
/// at index `end_index`.
1919
///
@@ -64,6 +64,12 @@ exprt string_constraint_generatort::add_axioms_for_concat_substr(
6464
return from_integer(0, res.length().type());
6565
}
6666

67+
/// Add axioms enforcing that `res` is the concatenation of `s1` with
68+
/// character `c`.
69+
/// \param res: string expression
70+
/// \param s1: string expression
71+
/// \param c: character expression
72+
/// \return code 0 on success
6773
exprt string_constraint_generatort::add_axioms_for_concat_char(
6874
const array_string_exprt &res,
6975
const array_string_exprt &s1,
@@ -87,15 +93,14 @@ exprt string_constraint_generatort::add_axioms_for_concat_char(
8793
m_axioms.push_back(a3);
8894

8995
// We should have a enum type for the possible error codes
90-
return from_integer(0, res.length().type());
96+
return from_integer(0, return_code_type);
9197
}
9298

93-
/// Add axioms to say that `s0` is equal to the concatenation of `s1` and `s2`.
94-
/// \param s0: string_expression corresponding to the result
99+
/// Add axioms to say that `res` is equal to the concatenation of `s1` and `s2`.
100+
/// \param res: string_expression corresponding to the result
95101
/// \param s1: the string expression to append to
96102
/// \param s2: the string expression to append to the first one
97103
/// \return an integer expression
98-
99104
exprt string_constraint_generatort::add_axioms_for_concat(
100105
const array_string_exprt &res,
101106
const array_string_exprt &s1,
@@ -129,6 +134,12 @@ exprt string_constraint_generatort::add_axioms_for_concat(
129134
return add_axioms_for_concat(res, s1, s2);
130135
}
131136

137+
/// Add axioms enforcing that the string represented by the two first
138+
/// expressions is equal to the concatenation of the string argument and
139+
/// the character argument of the function application.
140+
/// \param f: function application with a length, pointer, string and character
141+
/// argument.
142+
/// \return code 0 on success
132143
exprt string_constraint_generatort::add_axioms_for_concat_char(
133144
const function_application_exprt &f)
134145
{

src/solvers/refinement/string_constraint_generator_float.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ exprt get_significand(
7171

7272
/// Create an expression to represent a float or double value.
7373
/// \param f: a floating point value in double precision
74+
/// \param float_spec: a specification for floats
7475
/// \return an expression representing this floating point
7576
exprt constant_float(const double f, const ieee_float_spect &float_spec)
7677
{
@@ -97,7 +98,6 @@ exprt round_expr_to_zero(const exprt &f)
9798
/// Note that the rounding mode is set to ROUND_TO_EVEN.
9899
/// \param f: a floating point expression
99100
/// \param g: a floating point expression
100-
/// \param rounding: rounding mode
101101
/// \return An expression representing floating point multiplication.
102102
exprt floatbv_mult(const exprt &f, const exprt &g)
103103
{
@@ -124,8 +124,8 @@ exprt floatbv_of_int_expr(const exprt &i, const ieee_float_spect &spec)
124124

125125
/// Estimate the decimal exponent that should be used to represent a given
126126
/// floating point value in decimal.
127-
/// We are looking for d such that n * 10^d = m * 2^e, so:
128-
/// d = log_10(m) + log_10(2) * e - log_10(n)
127+
/// We are looking for \f$d\f$ such that \f$n * 10^d = m * 2^e\f$, so:
128+
/// \f$d = log_10(m) + log_10(2) * e - log_10(n)\f$
129129
/// m -- the fraction -- should be between 1 and 2 so log_10(m)
130130
/// in [0,log_10(2)].
131131
/// n -- the fraction in base 10 -- should be between 1 and 10 so
@@ -169,10 +169,10 @@ exprt string_constraint_generatort::add_axioms_from_double(
169169
}
170170

171171
/// Add axioms corresponding to the integer part of m, in decimal form with no
172-
/// leading zeroes, followed by '.' ('\u002E'), followed by one or more decimal
173-
/// digits representing the fractional part of m. This specification is correct
174-
/// for inputs that do not exceed 100000 and the function is unspecified for
175-
/// other values.
172+
/// leading zeroes, followed by `'.'` (`'\\u002E'`), followed by one or more
173+
/// decimal digits representing the fractional part of m. This specification is
174+
/// correct for inputs that do not exceed 100000 and the function is unspecified
175+
/// for other values.
176176
///
177177
/// TODO: this specification is not correct for negative numbers and
178178
/// double precision
@@ -219,11 +219,11 @@ exprt string_constraint_generatort::add_axioms_for_string_of_float(
219219

220220
/// Add axioms for representing the fractional part of a floating point starting
221221
/// with a dot
222+
/// \param res: string expression for the result
222223
/// \param int_expr: an integer expression
223224
/// \param max_size: a maximal size for the string, this includes the
224225
/// potential minus sign and therefore should be greater than 2
225-
/// \param ref_type: a type for refined strings
226-
/// \return a string expression
226+
/// \return code 0 on success
227227
exprt string_constraint_generatort::add_axioms_for_fractional_part(
228228
const array_string_exprt &res,
229229
const exprt &int_expr,
@@ -297,20 +297,18 @@ exprt string_constraint_generatort::add_axioms_for_fractional_part(
297297

298298
/// Add axioms to write the float in scientific notation.
299299
///
300-
/// A float is represented as $f = m * 2^e$ where $0 <= m < 2$ is the
301-
/// significand and $-126 <= e <= 127$ is the exponent.
302-
/// We want an alternate representation by finding $n$ and
303-
/// $d$ such that $f=n*10^d$. We can estimate $d$ the following way:
304-
/// $d ~= log_10(f/n) ~= log_10(m) + log_10(2) * e - log_10(n)$
305-
/// $d = floor(log_10(2) * e)$
306-
/// Then $n$ can be expressed by the equation:
307-
/// $log_10(n) = log_10(m) + log_10(2) * e - d$
308-
/// $n = f / 10^d = m * 2^e / 10^d = m * 2^e / 10^(floor(log_10(2) * e))$
300+
/// A float is represented as \f$f = m * 2^e\f$ where \f$0 <= m < 2\f$ is the
301+
/// significand and \f$-126 <= e <= 127\f$ is the exponent.
302+
/// We want an alternate representation by finding \f$n\f$ and
303+
/// \f$d\f$ such that \f$f=n*10^d\f$. We can estimate \f$d\f$ the following way:
304+
/// \f$d ~= log_10(f/n) ~= log_10(m) + log_10(2) * e - log_10(n)\f$
305+
/// \f$d = floor(log_10(2) * e)\f$
306+
/// Then \f$n\f$ can be expressed by the equation:
307+
/// \f$log_10(n) = log_10(m) + log_10(2) * e - d\f$
308+
/// \f$n = f / 10^d = m * 2^e / 10^d = m * 2^e / 10^(floor(log_10(2) * e))\f$
309309
/// TODO: For now we only consider single precision.
310310
/// \param res: string expression representing the float in scientific notation
311311
/// \param f: a float expression, which is positive
312-
/// \param max_size: a maximal size for the string
313-
/// \param ref_type: a type for refined strings
314312
/// \return a integer expression different from 0 to signal an exception
315313
exprt string_constraint_generatort::add_axioms_from_float_scientific_notation(
316314
const array_string_exprt &res,
@@ -476,7 +474,7 @@ exprt string_constraint_generatort::add_axioms_from_float_scientific_notation(
476474
/// Add axioms corresponding to the scientific representation of floating point
477475
/// values
478476
/// \param f: a function application expression
479-
/// \return a new string expression
477+
/// \return code 0 on succes
480478
exprt string_constraint_generatort::add_axioms_from_float_scientific_notation(
481479
const function_application_exprt &f)
482480
{

src/solvers/refinement/string_constraint_generator_format.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ static exprt get_component_in_struct(
253253
/// specifier.
254254
/// \param fs: a format specifier
255255
/// \param arg: a struct containing the possible value of the argument to format
256-
/// \param ref_type: a type for refined string type
256+
/// \param index_type: type for indexes in strings
257+
/// \param char_type: type of characters
257258
/// \return String expression representing the output of String.format.
258259
array_string_exprt
259260
string_constraint_generatort::add_axioms_for_format_specifier(
@@ -341,10 +342,10 @@ string_constraint_generatort::add_axioms_for_format_specifier(
341342

342343
/// Parse `s` and add axioms ensuring the output corresponds to the output of
343344
/// String.format.
345+
/// \param res: string expression for the result of the format function
344346
/// \param s: a format string
345347
/// \param args: a vector of arguments
346-
/// \param ref_type: a type for refined string type
347-
/// \return String expression representing the output of String.format.
348+
/// \return code, 0 on success
348349
exprt string_constraint_generatort::add_axioms_for_format(
349350
const array_string_exprt &res,
350351
const std::string &s,

src/solvers/refinement/string_constraint_generator_transformation.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ exprt string_constraint_generatort::add_axioms_for_to_upper_case(
317317
}
318318

319319
/// add axioms corresponding to the String.toUpperCase java function
320-
/// \param expr: function application with one string argument
320+
/// \param f: function application with one string argument
321321
/// \return a new string expression
322322
exprt string_constraint_generatort::add_axioms_for_to_upper_case(
323323
const function_application_exprt &f)
@@ -332,9 +332,8 @@ exprt string_constraint_generatort::add_axioms_for_to_upper_case(
332332
/// add axioms corresponding stating that the result is similar to that of the
333333
/// StringBuilder.setCharAt java function Warning: this may be underspecified in
334334
/// the case wher the index exceed the length of the string
335-
/// \par parameters: function application with three arguments, the first is a
336-
/// string
337-
/// the second an index and the third a character
335+
/// \param f: function application with three arguments, the first is a
336+
/// string, the second an index and the third a character
338337
/// \return a new string expression
339338
exprt string_constraint_generatort::add_axioms_for_char_set(
340339
const function_application_exprt &f)

0 commit comments

Comments
 (0)