[LLVMbugs] [Bug 7078] New: clang -ast-print output doesn't build
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu May 6 14:57:42 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7078
Summary: clang -ast-print output doesn't build
Product: clang
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: alp at nuanti.com
CC: llvmbugs at cs.uiuc.edu
clang -ast-print output, with source code generated from the clang AST is a
good marker of how close our AST is to the syntactic representation. As such,
it'd be great to make sure the output can be parsed, build, and perhaps
eventually be tested for token-equivalence to the input (rountripping AST).
This could be important in refactoring consumers, for example.
Right now, this happens (examples from system siginfo.h):
Input:
typedef union sigval
{
int sival_int;
void *sival_ptr;
} sigval_t;
Output:
union sigval {
public:
int sival_int;
void *sival_ptr;
};
typedef union sigval sigval_t;
The above perhaps isn't so bad, but the current AST representation falls down
completely in cases like this:
Input:
/* kill(). */
struct
{
__pid_t si_pid; /* Sending process ID. */
__uid_t si_uid; /* Real user ID of sending process. */
} _kill;
Output:
struct {
public:
__pid_t si_pid;
__uid_t si_uid;
};
struct siginfo::<anonymous struct at
/usr/include/bits/siginfo.h:63:2> _kill;
First thoughts are that this might need changes to TypeDecl / TagDecl /
RecordDecl and maybe TypedefDecl. Alternatively perhaps getTypedefForAnonDecl()
provides enough information to stitch back the original representation and the
AST doesn't need such a rework?
Filed as 'enhancement'. Thoughts welcome.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list