r368172 - [OPENMP]Set default version to OpenMP 4.5.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 07:39:18 PDT 2019
Author: abataev
Date: Wed Aug 7 07:39:17 2019
New Revision: 368172
URL: http://llvm.org/viewvc/llvm-project?rev=368172&view=rev
Log:
[OPENMP]Set default version to OpenMP 4.5.
Since clang fully supports OpenMP 4.5, set the default version to 4.5
instead of 3.1.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/OpenMP/driver.c
cfe/trunk/test/OpenMP/parallel_default_messages.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=368172&r1=368171&r2=368172&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Aug 7 07:39:17 2019
@@ -2894,8 +2894,8 @@ static void ParseLangArgs(LangOptions &O
}
}
- // Check if -fopenmp is specified.
- Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0;
+ // Check if -fopenmp is specified and set default version to 4.5.
+ Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 45 : 0;
// Check if -fopenmp-simd is specified.
bool IsSimdSpecified =
Args.hasFlag(options::OPT_fopenmp_simd, options::OPT_fno_openmp_simd,
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=368172&r1=368171&r2=368172&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Aug 7 07:39:17 2019
@@ -1032,18 +1032,18 @@ static void InitializePredefinedMacros(c
switch (LangOpts.OpenMP) {
case 0:
break;
+ case 31:
+ Builder.defineMacro("_OPENMP", "201107");
+ break;
case 40:
Builder.defineMacro("_OPENMP", "201307");
break;
- 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");
+ // Default version is OpenMP 4.5
+ Builder.defineMacro("_OPENMP", "201511");
break;
}
}
Modified: cfe/trunk/test/OpenMP/driver.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/driver.c?rev=368172&r1=368171&r2=368172&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/driver.c (original)
+++ cfe/trunk/test/OpenMP/driver.c Wed Aug 7 07:39:17 2019
@@ -15,9 +15,12 @@
// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=1 | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=0 | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=100 | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
-// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=31 | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
+// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=45 | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s
-// CHECK-DEFAULT-VERSION: #define _OPENMP 201107
+// CHECK-DEFAULT-VERSION: #define _OPENMP 201511
+
+// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=31 | FileCheck --check-prefix=CHECK-31-VERSION %s
+// CHECK-31-VERSION: #define _OPENMP 201107
// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=40 | FileCheck --check-prefix=CHECK-40-VERSION %s
// CHECK-40-VERSION: #define _OPENMP 201307
Modified: cfe/trunk/test/OpenMP/parallel_default_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_default_messages.cpp?rev=368172&r1=368171&r2=368172&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_default_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_default_messages.cpp Wed Aug 7 07:39:17 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
+// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=50 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=40 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
More information about the cfe-commits
mailing list