diff options
Diffstat (limited to 'clang/lib/Basic/OpenCLOptions.cpp')
-rw-r--r-- | clang/lib/Basic/OpenCLOptions.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/Basic/OpenCLOptions.cpp b/clang/lib/Basic/OpenCLOptions.cpp index 7e89b3f..44edf54 100644 --- a/clang/lib/Basic/OpenCLOptions.cpp +++ b/clang/lib/Basic/OpenCLOptions.cpp @@ -12,14 +12,16 @@ namespace clang { -const OpenCLOptions::FeatureDepList OpenCLOptions::DependentFeaturesList = { +// First feature in a pair requires the second one to be supported. +static const std::pair<StringRef, StringRef> DependentFeaturesList[] = { {"__opencl_c_read_write_images", "__opencl_c_images"}, {"__opencl_c_3d_image_writes", "__opencl_c_images"}, {"__opencl_c_pipes", "__opencl_c_generic_address_space"}, {"__opencl_c_device_enqueue", "__opencl_c_generic_address_space"}, {"__opencl_c_device_enqueue", "__opencl_c_program_scope_global_variables"}}; -const llvm::StringMap<llvm::StringRef> OpenCLOptions::FeatureExtensionMap = { +// Extensions and equivalent feature pairs. +static const std::pair<StringRef, StringRef> FeatureExtensionMap[] = { {"cl_khr_fp64", "__opencl_c_fp64"}, {"cl_khr_3d_image_writes", "__opencl_c_3d_image_writes"}}; @@ -140,11 +142,11 @@ bool OpenCLOptions::diagnoseFeatureExtensionDifferences( bool IsValid = true; for (auto &ExtAndFeat : FeatureExtensionMap) - if (TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.getKey()) != - TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.getValue())) { + if (TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.first) != + TI.hasFeatureEnabled(OpenCLFeaturesMap, ExtAndFeat.second)) { IsValid = false; Diags.Report(diag::err_opencl_extension_and_feature_differs) - << ExtAndFeat.getKey() << ExtAndFeat.getValue(); + << ExtAndFeat.first << ExtAndFeat.second; } return IsValid; } |