[OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.

According to the OpenMP standard, compiler must define _OPENMP macro,
which has value in format yyyymm, where yyyy is the year of the standard
and mm is the month of the standard. For OpenMP 5.0 this value must be
set to 201811.

llvm-svn: 368170
This commit is contained in:
Alexey Bataev 2019-08-07 14:02:11 +00:00
parent 0e1fea6754
commit 2e3a07fcb8
3 changed files with 7 additions and 0 deletions

View file

@ -1038,6 +1038,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
case 45:
Builder.defineMacro("_OPENMP", "201511");
break;
case 50:
Builder.defineMacro("_OPENMP", "201811");
break;
default:
// Default version is OpenMP 3.1
Builder.defineMacro("_OPENMP", "201107");

View file

@ -28,6 +28,9 @@
// CHECK-45-VERSION: #define _OPENMP 201511
// CHECK-45-VERSION2: #define _OPENMP 201511
// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=50 | FileCheck --check-prefix=CHECK-50-VERSION %s
// CHECK-50-VERSION: #define _OPENMP 201811
// RUN: %clang %s -c -E -dM -fopenmp-version=1 | FileCheck --check-prefix=CHECK-VERSION %s
// RUN: %clang %s -c -E -dM -fopenmp-version=31 | FileCheck --check-prefix=CHECK-VERSION %s
// RUN: %clang %s -c -E -dM -fopenmp-version=40 | FileCheck --check-prefix=CHECK-VERSION %s

View file

@ -3,6 +3,7 @@
// RUN: %clang_cc1 -fopenmp-simd -verify -o - %s
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -verify -o - %s
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify -o - %s
// expected-no-diagnostics
#ifdef FOPENMP
// -fopenmp option is specified