"sampler_t variable required - got %0">;
def err_wrong_sampler_addressspace: Error<
"sampler type cannot be used with the __local and __global address space qualifiers">;
-
+def err_opencl_global_invalid_addr_space : Error<
+ "global variables must have a constant address space qualifier">;
+
// OpenMP support.
def err_omp_expected_var_arg_suggest : Error<
"%0 is not a global variable, static local variable or static data member%select{|; did you mean %2?}1">;
return false;
}
+ // OpenCL v1.2 s6.5 - All program scope variables must be declared in the
+ // __constant address space.
+ if (getLangOpts().OpenCL && NewVD->isFileVarDecl()
+ && T.getAddressSpace() != LangAS::opencl_constant
+ && !T->isSamplerT()){
+ Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space);
+ NewVD->setInvalidDecl();
+ return false;
+ }
+
// OpenCL v1.2 s6.8 -- The static qualifier is valid only in program
// scope.
if ((getLangOpts().OpenCLVersion >= 120)
TEST(CompoundLiteralExpr, ParensCompoundVectorLiteralRange) {
RangeVerifier<CompoundLiteralExpr> Verifier;
- Verifier.expectRange(2, 11, 2, 22);
+ Verifier.expectRange(2, 20, 2, 31);
EXPECT_TRUE(Verifier.match(
"typedef int int2 __attribute__((ext_vector_type(2)));\n"
- "int2 i2 = (int2)(1, 2);",
+ "constant int2 i2 = (int2)(1, 2);",
compoundLiteralExpr(), Lang_OpenCL));
}
TEST(InitListExpr, VectorLiteralInitListParens) {
RangeVerifier<InitListExpr> Verifier;
- Verifier.expectRange(2, 17, 2, 22);
+ Verifier.expectRange(2, 26, 2, 31);
EXPECT_TRUE(Verifier.match(
"typedef int int2 __attribute__((ext_vector_type(2)));\n"
- "int2 i2 = (int2)(1, 2);", initListExpr(), Lang_OpenCL));
+ "constant int2 i2 = (int2)(1, 2);", initListExpr(), Lang_OpenCL));
}
} // end namespace ast_matchers