forked from OSchip/llvm-project
OpenCL: semantic analysis support for cl_khr_fp64 extension
llvm-svn: 125588
This commit is contained in:
parent
d39ae3eec8
commit
e87167b7d8
|
@ -3635,6 +3635,8 @@ def ext_c99_array_usage : Extension<
|
|||
"use of C99-specific array features, accepted as an extension">;
|
||||
def err_c99_array_usage_cxx : Error<
|
||||
"C99-specific array features are not permitted in C++">;
|
||||
def err_double_requires_fp64 : Error<
|
||||
"use of type 'double' requires cl_khr_fp64 extension to be enabled">;
|
||||
|
||||
def note_getter_unavailable : Note<
|
||||
"or because setter is declared here, but no getter method %0 is found">;
|
||||
|
|
|
@ -671,6 +671,11 @@ static QualType ConvertDeclSpecToType(Sema &S, TypeProcessingState &state) {
|
|||
Result = Context.LongDoubleTy;
|
||||
else
|
||||
Result = Context.DoubleTy;
|
||||
|
||||
if (S.getLangOptions().OpenCL && !S.getOpenCLOptions().cl_khr_fp64) {
|
||||
S.Diag(DS.getTypeSpecTypeLoc(), diag::err_double_requires_fp64);
|
||||
declarator.setInvalidType(true);
|
||||
}
|
||||
break;
|
||||
case DeclSpec::TST_bool: Result = Context.BoolTy; break; // _Bool or bool
|
||||
case DeclSpec::TST_decimal32: // _Decimal32
|
||||
|
|
|
@ -23,6 +23,7 @@ set(CLANG_TEST_DIRECTORIES
|
|||
"SemaCXX"
|
||||
"SemaObjC"
|
||||
"SemaObjCXX"
|
||||
"SemaOpenCL"
|
||||
"SemaTemplate")
|
||||
|
||||
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
|
||||
|
||||
void f1(double da) { // expected-error {{requires cl_khr_fp64 extension}}
|
||||
double d; // expected-error {{requires cl_khr_fp64 extension}}
|
||||
}
|
||||
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
|
||||
void f2(void) {
|
||||
double d;
|
||||
}
|
||||
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : disable
|
||||
|
||||
void f3(void) {
|
||||
double d; // expected-error {{requires cl_khr_fp64 extension}}
|
||||
}
|
Loading…
Reference in New Issue