AutosarC++18_10-A12.8.3

Moved-from object shall not be read-accessed

Required inputs: IR

Possible Messages

Key

Text

Severity

Disabled

moved_from_read

Don’t read-access a moved-from object

None

False

Options

moving_functions

moving_functions : set[bauhaus.analysis.config.QualifiedName] = set()

Set of functions considered as putting any parameter passed to them into a moved-from state.
 

read_move_function_exceptions

read_move_function_exceptions

Type: set[bauhaus.analysis.config.QualifiedName]

Default: {'std::basic_filebuf::basic_filebuf', 'std::basic_filebuf::operator=', 'std::future::future', 'std::future::operator=', 'std::get', 'std::make_shared', 'std::make_unique', 'std::packaged_task::operator=', 'std::packaged_task::packaged_task', 'std::promise::operator=', 'std::promise::promise', 'std::shared_future::operator=', 'std::shared_future::shared_future', 'std::shared_lock::operator=', 'std::shared_lock::shared_lock', 'std::shared_ptr::operator=', 'std::shared_ptr::shared_ptr', 'std::thread::operator=', 'std::thread::thread', 'std::unique_lock::operator=', 'std::unique_lock::unique_lock', 'std::unique_ptr::operator=', 'std::unique_ptr::unique_ptr', 'std::weak_ptr::operator=', 'std::weak_ptr::weak_ptr'}

Names of functions that are considered to leave the moved from objects in a well-specified state and are therefore except.
 

read_move_type_exceptions

read_move_type_exceptions : set[bauhaus.analysis.config.QualifiedName] = {'std::basic_ios'}

Names of types that are considered to be left well-specified state after a move and are therefore except.
 

restore_subobjects_with_enclosing_objects

restore_subobjects_with_enclosing_objects : bool = True

If an object is reset to a not-moved state (e.g., by replacing the moved one with a freshly created one), reset all subobjects (e.g., members) to the not-moved state as well. This is quite costly as objects have to be traversed and their fields have to be identified. Disabling may cause false positives but increases performance.
 

restoring_functions

restoring_functions

Type: set[bauhaus.analysis.config.QualifiedName]

Default: {'std::basic_string::clear', 'std::deque::clear', 'std::forward_list::clear', 'std::list::clear', 'std::map::clear', 'std::multimap::clear', 'std::multiset::clear', 'std::set::clear', 'std::unordered_map::clear', 'std::unordered_multimap::clear', 'std::unordered_multiset::clear', 'std::unordered_set::clear', 'std::vector::clear'}

Names of functions that are considered to restore an object to a well-specified state.
 

use_static_semantic_analysis

use_static_semantic_analysis : bool = True

Whether the rule should use the results of the StaticSemanticAnalysis to check object identities. This could lead to additional findings, as additional pairs of moved-from objects and read objects can be detected as referring to the same object. This will not enforce StaticSemanticAnalysis to be enabled, but also will not produce any additional results if it is not.