diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2022-03-05 19:16:01 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2022-03-05 19:16:28 +0100 |
commit | 14af99d375b6c47e4b5ec457fb1f1f02b71a8566 (patch) | |
tree | c1e9272b8ea960cec25e665e4672076597c03463 /clang/lib/Basic/OpenCLOptions.cpp | |
parent | 28bb040ded83b7cffdd6e6102080ccbe7935dbfe (diff) | |
download | llvm-14af99d375b6c47e4b5ec457fb1f1f02b71a8566.zip llvm-14af99d375b6c47e4b5ec457fb1f1f02b71a8566.tar.gz llvm-14af99d375b6c47e4b5ec457fb1f1f02b71a8566.tar.bz2 |
[OpenCL] Turn global vector into static array. NFCI.
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; } |