pxli168 added inline comments. ================ Comment at: include/clang/Basic/DiagnosticSemaKinds.td:593 @@ -592,2 +592,3 @@ InGroup<MissingDeclarations>; +def err_no_declarators : Error<"declaration does not declare anything">; def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">, ---------------- I think this no declarator is just for bit-field in C. And OpenCL C does not support the bit-field I think we need not to support that. If you think it is useless I think we can remove it then.
================ Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7666 @@ +7665,3 @@ +def err_opencl_atomic_init_addressspace : Error< + "initialization of atomic variables is restricted to variables in global address space in opencl">; +def err_opencl_block_proto_variadic : Error< ---------------- It seems that this two are very different and need a big select. Then it seems two maybe OK. ================ Comment at: lib/Sema/SemaDecl.cpp:5724 @@ +5723,3 @@ + // Pipes can only be passed as arguments to a function. + if (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200 && + R->isPipeType()) { ---------------- It seems all other check for OpenCL goes this way. I don't know if we just check OpenCL version will cause any error. ================ Comment at: lib/Sema/SemaDecl.cpp:6718 @@ +6717,3 @@ + const BlockPointerType *BlkTy = T->getAs<BlockPointerType>(); + assert(BlkTy && "Not a block pointer."); + ---------------- agree. I will remove it. ================ Comment at: lib/Sema/SemaExpr.cpp:6299 @@ +6298,3 @@ + // should output error for both LHS and RHS, use | instead || + if (checkBlockType(*this, LHS.get()) | checkBlockType(*this, RHS.get())) + return QualType(); ---------------- But how can we know if LHS or RHS is Block, or they both are? ================ Comment at: lib/Sema/SemaExpr.cpp:10095 @@ -10060,1 +10094,3 @@ Result = PT->getPointeeType(); + // OpenCL v2.0 s6.12.5 --The unary operators (* and &) cannot be used with a + // Block. ---------------- Fixed ================ Comment at: lib/Sema/SemaInit.cpp:6138 @@ -6137,1 +6137,3 @@ + // OpenCL v2.0 s6.13.1.1 - This macro can only be used to initialize atomic + // objects that are declared in program scope in the global address space. ---------------- yes, thank you! ================ Comment at: lib/Sema/SemaInit.cpp:6147 @@ +6146,3 @@ + Args.size() > 0) { + const Expr *Init = Args[0]; + S.Diag(Init->getLocStart(), diag::err_opencl_atomic_init_addressspace) ---------------- I just follow the surrounding code style. ================ Comment at: test/CodeGenOpenCL/opencl_types.cl:39 @@ -38,3 @@ - -void __attribute__((overloadable)) bad1(image1d_t *b, image2d_t *c, image2d_t *d) {} -// CHECK-LABEL: @{{_Z4bad1P11ocl_image1dP11ocl_image2dS2_|"\\01\?bad1@@\$\$J0YAXPE?APAUocl_image1d@@PE?APAUocl_image2d@@1@Z"}} ---------------- As you can see, it used pointer of image type which I just added a semacheck for it. ================ Comment at: test/SemaOpenCL/invalid-decl.cl:11 @@ +10,3 @@ +void test2(image1d_t *i){} // expected-error {{pointer to image is invalid in OpenCL}} + +void test3() { ---------------- I will find some place to put these test in. ================ Comment at: test/SemaOpenCL/invalid-decl.cl:19 @@ +18,2 @@ + atomic_int guide = ATOMIC_VAR_INIT(42); // expected-error {{initialization of atomic variables is restricted to variables in global address space in opencl}} +} ---------------- It seems strange to put sema test cases in Parser, just let them be together then. http://reviews.llvm.org/D16047 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits