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

    <tr>
        <th>Summary</th>
        <td>
            [ASTImporter] Circular referenced fields renders corrupted layout and cached
        </td>
    </tr>

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

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

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

<pre>
    UnaryOperator(&)'s creation might need layout of some records
whose fields importation are still on fly, the layout is incorrectly
computed and cached. Clients relying on this will not work properly
or crash direclty (e.g StaticAnalyzer's MemRegion.cpp (calculateOffset)).

```
      class B;
      class A {
        B* b;
        int c;
      };
 class B {
        A *f() { return &((B *)0)->a; }
        A a;
 };
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkk9GOszYQhZ9muBktInYIcMEF2TRSL6qVuu0DOPYAbo2NxqZb-vQVbNL030UIxDD-Doc5VjHawRO1UJ6hvGRqSWPg1ihv_66LIrsFs7a_e8Xr20ysUmAQNYgTiAZEFVEzqWSDx8kOY0JPZNCpNSwJQ48xTIRMOrCJUFyg6D7GEAl7S85EtNMcOH2uV0wYk3UOg8ferSBeMY30gNmI1uvATDq59ZOlwzQviQwqb1ArPZLJ8dVZ8ikik1utHzZaGm3Ejw3tQ8KPwH_izGEmfoACo2YVRzSWSbu0Ioia8gHft4_TnVdu_Yd4N_wLTb_SYIPP9TxvfVo5vTiV6K3vI6X9xzT5J_h-PRX3c3_E_dBOxYhnkOfv1Q6h-qGMeAbR4e1LN6L1CfWXKlSXZ-Uu8x3YIYiu34fZbG-RKS3scZ9tDaI-bw0gmgJE8wLyJwXyvLO_YNRT7P_K_5nOTCtNIxuVUXs4NcWxFpUos7GV-nQ69loabW7H8mAapcuSSmlMKVQpKLOtKIQsKlEdaimKMj9RLY5lIyvZSKVlD8eCJmVd7txfUx54yGyMC7Wn46EqMqdu5OIj2NxuTS-3ZYhwLJyNKT6XJZvcvgW6999-3kNJDOUFXy1vs2Vk6onJazKP7DJ5Qxxxy-Qyp2fsn2HMFnbtmNIcQXYgriCug03jcst1mEBcN_n77WXm8AfpBOK6W4ggrruLfwMAAP__rugXew">