AutosarC++19_03-A8.4.12

A std::unique_ptr shall be passed to a function as: (1) a copy to express the function assumes ownership (2) an lvalue reference to express that the function replaces the managed object

Required inputs: IR

A std::shared_ptr shall be passed to a function as:
  1. a copy to express the function shares ownership an lvalue reference to express that the function replaces the managed object
  2. a const lvalue reference to express that the function retains a reference count.
    1. A std::unique_ptr shall be passed to a function as:
      1. a copy to express the function assumes ownership
      2. an lvalue reference to express that the function replaces the managed object.

      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_shared_ptrs

      consider_shared_ptrs : bool = False

      Whether std::shared_ptrs should be considered
       

      consider_unique_ptrs

      consider_unique_ptrs : bool = True

      Whether std::unique_ptrs should be considered