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

    <tr>
        <th>Summary</th>
        <td>
            [TableGen] Cyclic super classes cause stack overflows
        </td>
    </tr>

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

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

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

<pre>
    The following TableGen code causes an infinite recursion leading to a stack overflow:
```td
class Foo;

class Bar : Foo {

}

class Foo : Bar {

}
```
https://godbolt.org/z/3Gb75f8o6

There seem to be no guards against this behaviour when it should probably error out
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxckk1u4zAMhU8jb4gGkmzVycILdwr3Ar2AfmhbM4oZiFKK9vQDJy1mEECAAD2Sj9RHyxyXDXEQ5kWY18bWslIevjDTSfXHxlH4HN5XhJlSoo-4LfBuXcI33MBTQPC2MjLYDeI2xy0WhIy-Zo60QUIb9pRCYIGL9X-ArpjnRB-iHYUcxbO8nxKEHH2yzDARifZlF39eXmwG0Y67AqL_lkT_-n_MTWvHe-xDzI-JkONayoV3bz0JPS0UHKVyoLwIPX0JPbVvrjfzkZ7vBd5XzAiMeN5ncAgbwVJtDgx2sXHjAmWNDA5Xe41UM3ysuEEswCvVFOCSyVmXPgFzpgxUSxOGNpzak21wUL0xp2epVNesg5dH3fXz6eg66Y5auaDbFj2i6uXc976Jg5bayKNuVdcp0x2CDr3vpVIzmhaNEp3Es43pkNL1vA_VROaKgzJGybZJ1mHiG2mty05xwU1ovXPPw57z5OrCopMpcuF_VUos6bYhP-iFeYVfnz5FD1wvmOHGAPm-DQ-kuak5DQ8fH8ta3cHTWehp9_m-ni6ZfqMvQk-31lno6bv766D_BgAA__9kl9j9">