<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Codegen: DeclPrinter.cpp: wrong struct declaration"
href="http://llvm.org/bugs/show_bug.cgi?id=18366">18366</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Codegen: DeclPrinter.cpp: wrong struct declaration
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>Nemanicka@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Source function (FunctionDecl * foo ) :
void foo()
{
struct STR1 {
int x;
} a,b; <- Source declaration
struct STR1 c;
int y =2;
}
After making smth like
"FunctionDecl * foo1 = foo"
"Rewriter.insertText(..., (AsText)foo1)"
Output function
void foo1() {
struct STR1 {
int x;
} struct a, b; <- extra "struct" declaration!
struct STR1 c;
int y = 2;
}
DeclPrinter.cpp:
In function void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent):
for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
D != DEnd; ++D)
{
std::cout << (*D)->getDeclKindName() << std::endl; <- INSERTION
// The next bits of code handles stuff like "struct {int x;} a,b"; we're
// forced to merge the declarations because there's no other way to
// refer to the struct in question. This limited merging is safe without
// a bunch of other checks because it only merges declarations directly
// referring to the tag, not typedefs.
//
// Check whether the current declaration should be grouped with a previous
// unnamed struct.
/*
...code...
*/
}
OUTPUT:
1. Field
...
...
...
N. Field
1. Does this block of code handle only field?
2. How to detect "a,b" struct declarations?</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>