<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88276>88276</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Comment removed from AST, if attribute parameter contains a semicolon
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cnx-tcsikos
</td>
</tr>
</table>
<pre>
Hi,
I'm experiencing an issue, where the comment removed from AST, if attribute parameter contains a semicolon.
Code:
```c++
class Bar
{
public:
// Comment stays in AST
[[deprecated("just because")]]
double MyFoo() const { return foo; }
// Comment removed from AST
[[deprecated("just;because")]]
double MyFoo2() const { return foo; }
private:
double foo;
};
```
Relevevant part of dumped AST:
```
|-CXXRecordDecl 0x1d4e502c1c8 <col:1, col:7> col:7 implicit class A
|-AccessSpecDecl 0x1d4e502c288 <line:4:1, col:7> col:1 public
|-CXXMethodDecl 0x1d4e502c368 <line:8:3, col:38> col:10 MyFoo 'double () const' implicit-inline
| |-CompoundStmt 0x1d4e502c798 <col:24, col:38>
| | `-ReturnStmt 0x1d4e502c788 <col:26, col:33>
| | `-ImplicitCastExpr 0x1d4e502c770 <col:33> 'double' <LValueToRValue>
| | `-MemberExpr 0x1d4e502c740 <col:33> 'const double' lvalue ->foo 0x1d4e502c690
| | `-CXXThisExpr 0x1d4e502c730 <col:33> 'const A *' implicit this
| |-DeprecatedAttr 0x1d4e502c410 <line:7:5, col:30> "just because" ""
| `-FullComment 0x1d4e502c8b8 <line:6:5, col:25>
| `-ParagraphComment 0x1d4e502c890 <col:5, col:25>
| `-TextComment 0x1d4e502c868 <col:5, col:25> Text=" Comment stays in AST"
|-CXXMethodDecl 0x1d4e502c518 <line:11:3, col:39> col:10 MyFoo2 'double () const' implicit-inline
| |-CompoundStmt 0x1d4e502c818 <col:25, col:39>
| | `-ReturnStmt 0x1d4e502c808 <col:27, col:34>
| | `-ImplicitCastExpr 0x1d4e502c7f0 <col:34> 'double' <LValueToRValue>
| | `-MemberExpr 0x1d4e502c7c0 <col:34> 'const double' lvalue ->foo 0x1d4e502c690
| | `-CXXThisExpr 0x1d4e502c7b0 <col:34> 'const A *' implicit this
| `-DeprecatedAttr 0x1d4e502c5c0 <line:10:5, col:30> "just;because" ""
|-AccessSpecDecl 0x1d4e502c648 <line:12:1, col:8> col:1 private
`-FieldDecl 0x1d4e502c690 <line:13:3, col:10> col:10 referenced foo 'double'
```
Had the issue with clang 15.0.0, same with latest (18.1.3)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vllv6yoX_TXkBSXCgKeHPGQ40TnSV-lTW131FeOdhHOxsQCn7b-_8pCGuEnVI90rWfEQWGtPi72Fc-pQAyxRvEbxdiZafzR2Keu3uZdO_W3crDDl-_KnQnSDyBaR1fD7C9G0wvDWgFVQS1UfsKixcq4FRDf49QgWsD8ClqaqoPbYQmVOUOK9NRVePT13q9QeC--tKloPuBFWVODBYmlqL1TtsMAOKiWNNvUiJN-YEhAbX1BChksiuu6u_qvUwjm8FnZclI7fm7bQSn5sxhjRHaI7vBnNdF68O6zq3sTzki426xIaC1J4KBHNEKW_W-dxAVK0DhCliOYo3nbXuKs0baEBP7zvjOl35J1jzmOUrrEF39oa741BbI1Rur1jzqeoDcvuW4TY-ps20e8a1Vh1Eh6CmI0ww8JzgLeX53NGhtdH0HCCk6h9l2OPzR6XbdVA2Tv0KY0fkUg3883LyyNIY8stSI3JW1RyiAmVkcwwYhtpNGKrqCul4TFF7Mf5Eauq0Uoqj4daWIXAKynBuacG5ASZZj2yVnXnML8LH-Gxkq6tfQB_NFNrWRJiZoit2AWTZQEoGVKDEU3HGIdJQvTi1FzVPd6FfjDBVI1p6_LJVz6wIM2DeFE-YZ-AYJSQ-WNfC1OYLIRJAhh2Awb3QL9GgzfC-R9vjQ3hUnKB6yEujne-Irb5319Ct_BsHvv7heTCMbA8QFWAneLzW_hDvV9Y9KmDxnPEfuyN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