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

    <tr>
        <th>Summary</th>
        <td>
            Clang analyzer can't detect null dereferencing
        </td>
    </tr>

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

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

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

<pre>
    I came across a simple example of dereferencing a null pointer, but clang tidy doesn't detect this problem. 
```
class ClassA {
private:
    int *a = new int(5);

public:
    int *get() {
        return a;
    }
    void set(int* newA) {
        a = newA;
    }
};

int main() {
    ClassA classA = ClassA();
    classA.set(nullptr);
    return *classA.get();
}
```
The problem is in the getter, if you make the field public and get it directly, everything works correctly. 
Why is that? Is there any restriction on the detection of such situations or is it a bug? Or maybe I'm doing something wrong?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU0uPmzAQ_jXmMmrEI4Rw4MAmWmnVQy-VejZ4AHeNHdkmW_rrOwaSKFUQCZ7355lvGiPm6gNaPiLw1hrngIOT40Uh4B--fE0HAi129NOt1D156EkpuBipPVqWnqCZPLSKk81LMYMw6DRLC0-BHlsPfpAOLtY0CscdsPjM4pod4u1dRAqn4qfwXwMr3lbtxcor98iyepWBHqoKLK05sOwMGr-CgqXHnKUly7a4LXpqlGxfBfcYQijiUQq2x6KfrAZ-zxWUrDg_hKuRAtySYSldBxT1y2R3kPXrdOHwjDkAHLnUr-Bt3Wm3JlHmVbP6PlVYfXYryjCui7f_-2w3pQts3veuPDDdgT5P6-eAt3kCjVZqGjECxW-EkB3MZqKLfOJi6SQqAes8gGsRXEESP6Qlfqg5xOAV7UxMIRZ9GfvpoDV2td4o82uYQzU_cM-yd_gIR2IlJZzpMs5b2XppNJgVzkq-RdGBm9qBmO0nHjQOjF2AexpRM_Uh3Q9LeOcG4YOoOxKJAxJnRtwwWaODX4RVcsjL-JhkSRaJKhNlVvLIS6-wOi1LwDVX81-0tFdPa7CszdMuRZNV1eD9xQWWpu_09tIPU7NrzUiCUtfb5xv1-zdlIVE6N6GjQ34oyiwaqoLvm3x_6Mq0xEy0osjjOMmxSDgvmizHSPEGlatY_sbycySrNE7TuEjLuMjzJN01DR470WTHfZslnRBsHyORUO1C4Z2xfWSrBQO1ypFRSefdw0jkkb1GvOXnkx-Mrb5zKzUnKHm0IK4WuP8AYwtZ2Q">