[cfe-commits] PATCH: support for pretty-printing OpenCL/CUDA keywords/attributes
Peter Collingbourne
peter at pcc.me.uk
Mon Nov 7 19:09:15 PST 2011
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,
--
Peter
More information about the cfe-commits
mailing list