<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - missing AnnotateAttr for member of templated class"
href="https://bugs.llvm.org/show_bug.cgi?id=36415">36415</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>missing AnnotateAttr for member of templated class
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chris.briend@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The AST information generated for a member of an instanciated templated class
only supports one AnnotateAttr in 5.0+. it was supporting multiple attribute
before (clang 3.8 and 4.0).
Given :
//test.h
struct Test
{
int aMember __attribute__((annotate("testAnnotation1"))) \
__attribute__((annotate("testAnnotation2")));
};
template <typename Trait>
struct TemplatedTest
{
int anotherMember __attribute__((annotate("templTestAnnotation1"))) \
__attribute__((annotate("templTestAnnotation2")));
};
struct Dummy
{
TemplatedTest<int> a;
TemplatedTest<bool> b;
};
//EOF
the command :
clang++.exe -Xclang -ast-dump -fsyntax-only test.h
will generate correct attributes for Test::aMember but not for
TemplatedTest<int>::anotherMember.
More precisely it will generate the correct annotation for the FieldDecl inside
a ClassTemplateDecl, but not inside a ClassTemplateSpecializationDecl.
partial output :
...
|-CXXRecordDecl 0x1edbd5fabb8 <D:\projects\RefTest\test.h:2:1, line:6:1>
line:2:8 struct Test definition
| |-CXXRecordDecl 0x1edbd653468 <col:1, col:8> col:8 implicit struct Test
| `-FieldDecl 0x1edbd653600 <line:4:5, col:9> col:9 aMember 'int'
| |-AnnotateAttr 0x1edbd653650 <line:5:24, col:50> "testAnnotation2"
| `-AnnotateAttr 0x1edbd6536b0 <line:4:32, col:58> "testAnnotation1"
|-ClassTemplateDecl 0x1edbd653848 <line:8:1, line:13:1> line:9:8 TemplatedTest
| |-TemplateTypeParmDecl 0x1edbd6536f8 <line:8:11, col:20> col:20 typename
depth 0 index 0 Trait
| |-CXXRecordDecl 0x1edbd6537b0 <line:9:1, line:13:1> line:9:8 struct
TemplatedTest definition
| | |-CXXRecordDecl 0x1edbd653ac0 <col:1, col:8> col:8 implicit struct
TemplatedTest
| | `-FieldDecl 0x1edbd653c70 <line:11:5, col:9> col:9 anotherMember 'int'
| | |-AnnotateAttr 0x1edbd653cc0 <line:12:24, col:55> "templTestAnnotation2"
| | `-AnnotateAttr 0x1edbd653d28 <line:11:38, col:69> "templTestAnnotation1"
| |-ClassTemplateSpecializationDecl 0x1edbd653f48 <line:8:1, line:13:1>
line:9:8 struct TemplatedTest definition
| | |-TemplateArgument type 'int'
| | |-CXXRecordDecl 0x1edbd654160 prev 0x1edbd653f48 <col:1, col:8> col:8
implicit struct TemplatedTest
| | `-FieldDecl 0x1edbd6541f8 <line:11:5, col:9> col:9 anotherMember 'int'
| | `-AnnotateAttr 0x1edbd654278 <line:12:24> "templTestAnnotation2"
| `-ClassTemplateSpecializationDecl 0x1edbd6503d0 <line:8:1, line:13:1>
line:9:8 struct TemplatedTest definition
| |-TemplateArgument type '_Bool'
| |-CXXRecordDecl 0x1edbd6505f0 prev 0x1edbd6503d0 <col:1, col:8> col:8
implicit struct TemplatedTest
| `-FieldDecl 0x1edbd650688 <line:11:5, col:9> col:9 anotherMember 'int'
| `-AnnotateAttr 0x1edbd650708 <line:12:24> "templTestAnnotation2"</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>