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

diff --git a/test/SemaOpenCL/qualifiers_print.cl b/test/SemaOpenCL/qualifiers_print.cl
index e69de29..8df32b8 100644
--- a/test/SemaOpenCL/qualifiers_print.cl
+++ b/test/SemaOpenCL/qualifiers_print.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -ast-print -o - | FileCheck %s
+
+// CHECK: __constant float cf
+// CHECK: __global int *gip
+// CHECK: __local int li
+
+__constant float cf;
+
+__kernel void foo(__global int *gip) {
+  __local int li;
+}
+

Attachment: signature.asc
Description: Digital signature

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to