[cfe-commits] PATCH: support for pretty-printing OpenCL/CUDA keywords/attributes

Richard Membarth richard.membarth at informatik.uni-erlangen.de
Tue Nov 8 10:04:52 PST 2011


On 2011.11.08 03:09, Peter Collingbourne wrote:
> On Fri, Oct 28, 2011 at 05:49:56PM +0200, Richard Membarth wrote:
> > > >  void DeclPrinter::VisitVarDecl(VarDecl *D) {
> > > > -  if (!Policy.SuppressSpecifiers && D->getStorageClass() != SC_None)
> > > > +  if (!Policy.SuppressSpecifiers && D->getStorageClass() != SC_None &&
> > > > +          D->getStorageClass() != SC_OpenCLWorkGroupLocal)
> > > >      Out << VarDecl::getStorageClassSpecifierString(D->getStorageClass()) << " ";
> > > 
> > > I think that this should use getStorageClassAsWritten, which reflects
> > > the original storage class used in the source code (which would always
> > > be SC_None for OpenCL and in particular for __local variables).
> > > 
> > 
> > You're right, using getStorageClassAsWritten() is sufficient.
> 
> Committed with some modifications in r144062.
> 
> > > This seems fine, but is the whitespace after the address space names
> > > necessary?  If you add a test case (testing that diagnostics use the
> > > OpenCL address spaces), I will commit this.
> > 
> > The whitespace is not required here.
> > 
> > Attached is an updated patch for OpenCL qualifiers and a test case
> > to check if the OpenCL address space is used.
> 
> I meant that we should test that the error diagnostics normally emitted
> by Clang should provide the correct address space names.  I applied
> your patch plus such a test case in r144063.  If you would like to
> test the AST printer then please modify your test to use FileCheck.
> 

Thanks for clarification and providing the test case. I attached
also my updated test case for the pretty printer using FileCheck.

Thanks,
  Richard


> Thanks,
> -- 
> Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_prettyprint_opencl_qualifiers.patch
Type: text/x-diff
Size: 450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111108/0b9c6538/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111108/0b9c6538/attachment.sig>


More information about the cfe-commits mailing list