<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/151898>151898</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Can Clang Static Analyzer Detect C++ Smart Pointer Issues like Null Dereference or Use-After-Move?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MingxiuWang
      </td>
    </tr>
</table>

<pre>
    I'm researching static analysis tools for C++ and I'm particularly interested in their support for detecting issues related to smart pointers (e.g., std::unique_ptr, std::shared_ptr).

Can Clang Static Analyzer detect bugs such as:

Null dereference of smart pointers

Use-after-move

Double deletion or invalid access via smart pointers

If CSA supports these, are there specific checkers, compiler flags, or patterns I should follow to improve detection? Any example reports or references to documentation would be much appreciated.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0k8GPqzYQxv8acxkFEQMJHDiwiSLlsFWlVdVjNTEDuGtsOjbZTf_6yrBp-57eOyFGMx8z3_cDvdeDJWpE-SLKc4JLGB03r9oOn3r5He2Q3Fz3aK5CHidg8oSsRm0H8AGDVoAWzcNrD8E546F3DCchX4R8AbQdbHMzctBqMcjmAdoGYvKBOtAWwkiawS_z7Dis4x0FUiF-Qnu_kAcmg7E7OPATcoDZrRoehKwoHVIhT-BDJ_JW5O1i9V8L_TEH_qbsR2TqtnKdiqwVWXtCCyeDdoC37Zg2HvM3PXeA2zJ48IsaAX2UWad-WYyBjph6YrKKwPXf7bX1_eZph30g3k3uTlvt7JabIejIUNDOgmPQ9o5Gd4BKkfdw1_hDtWsPp7f2aZSPvnmKFyJTfGECP5PSvVagRlLvcVKeQLlp1oYYeoPDWnEMM4ZAbD1cwY9uMR30zhj3ES3W08zuTs8YnBX5BVr7APrEaTYETNsGjuFfD2L80Dm1TGSjlc7Cx6p7I5hW_-aZSemYY5p0Td7VeY0JNftjWcgqrw55MjZ1VlWENR6747Gu8iMe1L7Y1yX2B1UeqirRjcxkmVVZkZVZIfP0VlJWVMUhV0fqEAtRZDShNqkx9yl1PCQrQ82-3Fd1lRi8kfEr61KqmLyQMmLPTRzYxbxFkRntg_9PIuhgqPk5LOcNlif2b2t6v27pwXVj2Oh3gpWc8__JYYiUtCslr5GS_JIsbJoxhHklTl6EvAw6jMstVW4S8hLX-nrsZnZ_kgpCXrZfRcjL16X3Rv4TAAD__1a1T1A">