Externals-MSVC.List.Iterator.CopyConstructor¶
User-provided summary of relevant effects of a function
This rule describes the effects of a function specifically for pointer/semantic analysis and several error checks. This can, for example, be used to tell the analysis about relevant effects of calls to the function if the function body itself is unknown to the analysis because it is only linked into the project as binary code and thus not seen during analysis (e.g. functions from third-party libraries that your project links against).Possible Messages
This rule has no predefined messages.
Options¶
The following places define options that affect this rule: Analysis-GlobalOptions
exceptions¶
exceptions : None | bool | set[bauhaus.analysis.config.QualifiedName] = None
- If this option is None:
- Use what the declaration in source explicitly says
- If the declaration does not specify exceptions explicitly, then option
StaticSemanticAnalysis/semantics.exceptions.missing_specifier_means_throw_any
determines the effect:
- either consider as
noexcept(true)to accelerate analysis, - or refer to the language standard's definition of potentially-throwing and non-throwing functions
- either consider as
- Otherwise, if you set this option, you explicitly overwrite the source/language
specification with either:
- False, meaning no exception will escape (like
noexcept(true)) - True, meaning some exceptions may escape (like
noexcept(false)); option StaticSemanticAnalysis/semantics.exceptions.base_class_for_throw_any can be used to improve the analysis by restricting the set of possibly escaping exception types - or an explicit set of type names that could escape (an empty set here
has the same effect as
throw()ornoexcept(true))
- False, meaning no exception will escape (like
frees¶
frees : int | None = None
functions¶
functions
A set of names or globbing patterns of functions for which the summary appliesType: set[bauhaus.analysis.config.GlobPattern]
Default:
{'std::_List_*const_iterator::_List_*const_iterator(const std::_List_*const_iterator&)', 'std::_List_iterator::_List_iterator(const std::_List_iterator&)'}
noreturn¶
noreturn : bool = False
post_conditions¶
post_conditions : set[str] = {'@pre(*@param1) == *@param0'}
Formula Syntax
Terms that can be used in formulas:- Integers given in decimal notation like
0or42 - Null pointer value, expressed by
@null - Values of first, second, etc. function parameters are expressed by
@param0,@param1, etc. - Return value of a call is expressed by
@ret - Dereferencing parameters is expressed by
*term, e.g.*@param0 - Fields of memory objects are specified by
., e.g.@param0.fieldor(*@param1).field - To refer to the value of a memory access (like a parameter value) evaluated before the call,
@precan be used, e.g.@pre(@param0) - The predicate
@alloc_with_size(pointer,size)specifies that a block of memory with sizesizein bytes at the locationpointerwill be allocated if the function returns. - For specifying the behaviour of operations dealing with smart pointers, the predicate
@valid_refcan be used to express that a memory access (like a return value of an operation) is a smart pointer instance that can be dereferenced, e.g.@valid_ref(@ret) - For specifying the behaviour of operations dealing with iterators, the predicates
@iterator_ofresp.@end_iterator_ofto express that a memory access (like a return value of an operation) is an iterator into a container resp. is an end iterator into a container (i.e., an iterator that is *not* safely dereferenceable). The first argument of the predicate is the iterator instance, the second refers to the container of the iterator, e.g.@end_iterator_of(@ret, *@param0)as condition forstd::vector::end(). - For expressing that two iterators or smart pointers point to the same element,
the predicate
@same_refcan be used, e.g.@same_ref(*@param0, *@param1) - The predicate
@same_container(m1, m2)is true if the iterator instancem1refers to the same container asm2. In contrast to@same_ref(m1, m2),@same_container(m1, m2)being true does not necessarily mean that argumentsm1andm2refer to the same iterator value, i.e. to the same position within the container, but to positions within the same container. This is useful for representing effects of increment / decrement operators. E.g.,@same_container(@pre(*@param0), @ret)is used to model the behaviour of post-decrement operators likeoperator++. Here@pre()is used to express that the iterator instance*@param0before the call refers to the same instance as the return value@retof the call.
- Arithmetic comparisons between parameters and constants: E.g.
@param0 > 100,@param1 == 0,1 != param. Only atomic types can be compared by==, not structured type instances like struct or class instances (but see also@same_ref). - Null checks: E.g.
@param0 == @nullor*@param1 != @null - Predicates for boolean checks:
@is_true(term)resp.@is_false(term)evaluate to true resp. false if the boolean term given as argument corresponds to true resp. false: e.g.@is_true(@ret) - Predicate to express that the function call does not return:
@noret() - Combination of "or", "and", "implication", and "equivalence": E.g.
@param0 == 1 || @param0 == 2,@param0 == 1 && @param1 != 0,@param0 == 0 ==> @noret(),@is_true(@ret) <-> ((*@param0)._Ptr == (*@param1)._Ptr) - Parentheses can be used to group formulas
f of the dereferenced second parameter
contains a number greater 100, then the function does not return:
(@param0 == @null && (*@param1).f > 100) ==> @noret()
Specifying properties of smart pointer / iterator operations
In the following formulae examples for the special predicates for smart pointers and iterators are given that can efficiently be processed and used by the corresponding analysis. Use these as templates if you want to specify effects of operators acting on iterator / smart pointer instances. You can adapt e.g. parameter indices to match the semantics.@is_true(@ret) <-> @same_ref(*@param0, *@param1)resp.@is_true(@ret) <-> !@same_ref(*@param0, *@param1)for specifying that the return value of the call is true if and only if the following holds: the values to which the first and second parameter refer to (*@param0and*@param1) are the same reference or iterator value (resp. are not the same reference or iterator value). Used for comparison operators likeoperator==()oroperator!=().@is_true(@ret) <-> @valid_ref(*@param0)resp.@is_true(@ret) <-> !@valid_ref(*@param0)for specifying that the return value of the call is true if and only if the value the first parameter refers to (i.e.,*@param0) can be safely dereferenced (resp. cannot be safely dereferenced). Used e.g. foroperator bool()or special comparisons againstnullptr.@iterator_of(@ret, *@param0)for specifying that the return value of the call is an iterator of the container specified by*@param0. Used e.g. forfind()operations.@same_ref(@ret, @pre(*@param0))for specifying that@retrefers to the same memory location as the value of*param0before invoking the call. Here@retoften is an actual raw pointer. Used e.g. foroperator->()oroperator*()of smart pointer types.@same_container(@pre(*@param0), *@ret)for specifying that*@retis an iterator referencing the same container as@pre(*@param0), the value of*@param0before executing the call. The variant@same_container(@pre(*@param0), @ret)can be used if the operator does return by value (not in form of a reference to the iterator). Used e.g. for increment/decrement operations on iterators (e.g.operator++(),operator--()).*@param0 == @pre(*@param1)for specifying that*@param0is assigned the value of*@param1before the call. Used e.g. foroperator=()of smart pointer types.
pre_conditions¶
pre_conditions : set[str] = set()
@param0 == 0 || @param1 == 0 || @param2 > 0
prepare_action¶
prepare_action : typing.Callable[[bauhaus.ir.Graph, bauhaus.ir.Node], NoneType] | None = None
return_value¶
return_value : bauhaus.ir.common.routines.external_summaries.ValueSummary = ''
alloc: function is an allocator, returns a freshly created instancenonnull: return value is nevernullptrnull: return value can benullptr- integer literal: the function returns the given integer value
[a:b]ora:bwith integersaandb: the function returns an integer value within the bounds of the given interval- name: the name of a variable of which the value is
returned; you can also use *name for the dereferenced value, or
&name for the address. To refer to a parameter, you can use the
syntax
param0for the first,param1for the second parameter, etc.
{ term1, ...., termN }.
writes¶
writes : dict[bauhaus.ir.common.routines.external_summaries.ObjectDescription, bauhaus.ir.common.routines.external_summaries.ValueSummary] | None = {}
- If
writeshas the valueNone, the rule does not specify side-effects, i.e., there are unknown/unspecified side-effects for the function. - If
writesis a non-empty dictionary, its entries specify the side-effects of the function completely. - If
writesis an empty dictionary, there are no write side-effects at all when calling the function.