AutosarC++18_10-A8.4.13¶
A std::shared_ptr shall be passed to a function as: (1) a copy to express the function shares ownership (2) an lvalue reference to express that the function replaces the managed object (3) a const lvalue reference to express that the function retains a reference count
Required inputs: IR
std::shared_ptr shall be passed to a function as:
- a copy to express the function shares ownership
an lvalue reference to express that the function replaces the managed object - a const lvalue reference to express that the function retains a reference count.
- a copy to express the function assumes ownership
- an lvalue reference to express that the function replaces the managed object.
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
-
A
std::unique_ptr shall be passed to a function as:
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
const_lvalue |
std::shared_ptr passed as const lvalue reference but function does not copy it |
None |
False |
lvalue |
{} passed as lvalue reference but function does not replace object |
None |
False |
shared_ptr_rvalue |
std::shared_ptr passed as rvalue reference |
None |
False |
unique_ptr_rvalue |
std::unique_ptr passed as rvalue reference but function does not move object |
None |
False |
Options¶
consider_unique_ptrs¶
consider_unique_ptrs : bool = False