[PATCH] Make pretty-print output valid OpenCL code
Paul Fox
fox at emphotonics.com
Mon Jul 7 12:39:27 PDT 2014
Pretty-printing OpenCL code from an AST does not produce valid,
compilable code. Making this possible is valuable for certain kinds of
source-to-source translation.
In this patch, I try to rectify two issues with the pretty-printed code.
Specifically:
1) The AST treats "local" variable declarations as having a special
storage class specifier, which pretty-prints as <<work-group-local>> in
VisitVarDecl. As a result, these declarations give a syntax error when
one attempts to compile the pretty-printed code.
2) VisitFunctionDecl will print function attributes after the function
declaration, which is valid syntax for most attributes, but OpenCL
function attributes specifically must come before the function declaration.
Regards,
Paul Fox
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compilable_ocl_dumps.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140707/8fd05c3e/attachment.bin>
More information about the cfe-commits
mailing list