diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp b/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp index bca0bb4ada67..0ecb024fc6b9 100644 --- a/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp +++ b/contrib/llvm-project/clang/lib/Frontend/InitPreprocessor.cpp @@ -371,7 +371,10 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, // value is, are implementation-defined. // (Removed in C++20.) if (!LangOpts.CPlusPlus) { - if (LangOpts.C17) + // FIXME: Use correct value for C23. + if (LangOpts.C2x) + Builder.defineMacro("__STDC_VERSION__", "202000L"); + else if (LangOpts.C17) Builder.defineMacro("__STDC_VERSION__", "201710L"); else if (LangOpts.C11) Builder.defineMacro("__STDC_VERSION__", "201112L"); @@ -433,11 +436,18 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, // OpenCL v1.0/1.1 s6.9, v1.2/2.0 s6.10: Preprocessor Directives and Macros. if (LangOpts.OpenCL) { if (LangOpts.CPlusPlus) { - if (LangOpts.OpenCLCPlusPlusVersion == 100) + switch (LangOpts.OpenCLCPlusPlusVersion) { + case 100: Builder.defineMacro("__OPENCL_CPP_VERSION__", "100"); - else + break; + case 202100: + Builder.defineMacro("__OPENCL_CPP_VERSION__", "202100"); + break; + default: llvm_unreachable("Unsupported C++ version for OpenCL"); + } Builder.defineMacro("__CL_CPP_VERSION_1_0__", "100"); + Builder.defineMacro("__CL_CPP_VERSION_2021__", "202100"); } else { // OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the // language standard with which the program is compiled. __OPENCL_VERSION__ @@ -590,7 +600,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, //Builder.defineMacro("__cpp_consteval", "201811L"); Builder.defineMacro("__cpp_constexpr_dynamic_alloc", "201907L"); Builder.defineMacro("__cpp_constinit", "201907L"); - //Builder.defineMacro("__cpp_coroutines", "201902L"); + Builder.defineMacro("__cpp_impl_coroutine", "201902L"); Builder.defineMacro("__cpp_designated_initializers", "201707L"); Builder.defineMacro("__cpp_impl_three_way_comparison", "201907L"); //Builder.defineMacro("__cpp_modules", "201907L"); @@ -600,6 +610,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, if (LangOpts.CPlusPlus2b) { Builder.defineMacro("__cpp_implicit_move", "202011L"); Builder.defineMacro("__cpp_size_t_suffix", "202011L"); + Builder.defineMacro("__cpp_if_consteval", "202106L"); } if (LangOpts.Char8) Builder.defineMacro("__cpp_char8_t", "201811L"); @@ -1141,6 +1152,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI, case 45: Builder.defineMacro("_OPENMP", "201511"); break; + case 51: + Builder.defineMacro("_OPENMP", "202011"); + break; + case 52: + Builder.defineMacro("_OPENMP", "202111"); + break; default: // Default version is OpenMP 5.0 Builder.defineMacro("_OPENMP", "201811"); @@ -1171,7 +1188,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, if (LangOpts.OpenCL) { InitializeOpenCLFeatureTestMacros(TI, LangOpts, Builder); - if (TI.getTriple().isSPIR()) + if (TI.getTriple().isSPIR() || TI.getTriple().isSPIRV()) Builder.defineMacro("__IMAGE_SUPPORT__"); } |