summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-05-21 16:40:32 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-05-21 16:40:32 +0000
commit66f9577f09bdc980509c75cbefea6fdb8f0f9bdb (patch)
tree892b1b662164e19a17bd08f12d249d0dd591fa4c /clang/lib/Frontend/InitPreprocessor.cpp
parentb5757abefbfc27dfeb543dfb6d26ea360e7bd3a4 (diff)
downloadbcm5719-llvm-66f9577f09bdc980509c75cbefea6fdb8f0f9bdb.tar.gz
bcm5719-llvm-66f9577f09bdc980509c75cbefea6fdb8f0f9bdb.zip
[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be defined. If `-fopenmp-simd` is specified along with the `-fopenmp`, `_OPENMP` macro should be defined with the value `201511`. llvm-svn: 332852
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 2e77c39bd8c..f2182c8ebc6 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1027,19 +1027,21 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
// macro name is defined to have the decimal value yyyymm where
// yyyy and mm are the year and the month designations of the
// version of the OpenMP API that the implementation support.
- switch (LangOpts.OpenMP) {
- case 0:
- break;
- case 40:
- Builder.defineMacro("_OPENMP", "201307");
- break;
- case 45:
- Builder.defineMacro("_OPENMP", "201511");
- break;
- default:
- // Default version is OpenMP 3.1, in Simd only mode - 4.5
- Builder.defineMacro("_OPENMP", LangOpts.OpenMPSimd ? "201511" : "201107");
- break;
+ if (!LangOpts.OpenMPSimd) {
+ switch (LangOpts.OpenMP) {
+ case 0:
+ break;
+ case 40:
+ Builder.defineMacro("_OPENMP", "201307");
+ break;
+ case 45:
+ Builder.defineMacro("_OPENMP", "201511");
+ break;
+ default:
+ // Default version is OpenMP 3.1
+ Builder.defineMacro("_OPENMP", "201107");
+ break;
+ }
}
// CUDA device path compilaton
OpenPOWER on IntegriCloud