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

    <tr>
        <th>Summary</th>
        <td>
            [clang] fails to get raw comment for macro expanded declarations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    ASTContext::getRawCommentForAnyRedecl fails to get a raw comment for non-trivial macro expanded declarations

To reproduce the issue run the LLVM c-index-test tool

`c-index-test -test-print-type input.cpp`

with the following `input.cpp` content:

```c++
#define MAKE_S(s) struct s {};
#define MAKE_SX(s) struct s##x {};

/// comment1
MAKE_S(str)

/// comment2
MAKE_SX(str)
```

Observe the result:
```
...
StructDecl=str:5:8 (Definition) ... RawComment=[/// comment1] ...
...
StructDecl=strx:8:1 (Definition) [type=strx] [typekind=Record] [isPOD=1] [isAnonRecDecl=0]
```

Observe that `StructDecl=str` has the RawComment while `StructDecl=strx` lacks it


The issue occures at least on clang 14.0.6 and 15.0.2
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU01vozAQ_TVwGQVhCAQOHNKyvWyrrtpq1dvKgSF469jINkn673eApEn6pZWGD4_fzPMbz6x0_VosH5-utXK4d168JFuje-C7a73ZoHI32izV6wPWWElouJAWnAaCAAfDd1BNMGi0AaXVzBmxFVzChldGA-47rmqsYQjnhjuhlfXC0guX0_tJg8HO6LqvEFyLIKztEUyvxtXt7e87qGaCcuxnDq0jci3PE3hpeLE_vmedEcrN3GtHCVXXu6DqOkKeB-6Ea0eORkupd0KtgRDnaNJGVVFjVS4ZJ6u86GqwyRvFNTZCIdwtf_748-hFmfWiHKwzfeXAgre48halF3-Bf34fQACy_Ye4Q_TNZMf6s8l_4naGkn0bEp2HPL-POYo8T3G_smi20z0ZtL08K80lPgiC6edxVFPS7XtxORDEy4SeDIivHPSLoSUG3RQCp7YjtJdcfSIzKeEt-Zcs-4GCHvaRhrIObXHEUbqD54WaiLwPWGlTH_zC_rqn0pfsbb2kHifIgSok_3_Vi7uhuT4Ug3qs5Xas50k67Foh8TP8fgiQvHqxINzF3U6z9DY-uqp6uiAgWomcpkIroPmjFmfzIAxSoKEEltBv5GPB0jRJwvl8wfy6iOs8zrnvhJNYkOQxbJB_MfvvJ_-bafd7I4vWuc4OzTLe5ppGr18FlIAWUm6PHxpb_RcrR8tRB83ATZJF-dxvi3ma52mziMJFluYJz-uMY5XkyLKUZyzmvuQrlLYYuyZSuJtKQf90eF8UURhFLGSMpeEiYcEqbFjGWZOmC8QGM28e4oYUBsM5Am3WvinGI636taVNKayzp01urVgrHCs05Oe9a7UptlqQ1f5IXYxH_wdbYKCC">