diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-05-26 11:10:11 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-05-26 11:10:11 +0000 |
commit | c6bd8917f26354ddda19fbbc891c05741beb0fe4 (patch) | |
tree | c80252ad18cf55a91330fd9c50aa5cf849fcfb65 /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | ab3809193cd5f6df82348d9e498c6f04d681d7f2 (diff) | |
download | bcm5719-llvm-c6bd8917f26354ddda19fbbc891c05741beb0fe4.tar.gz bcm5719-llvm-c6bd8917f26354ddda19fbbc891c05741beb0fe4.zip |
[OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
OpenMP version.
If '-fopenmp' option is provided '-fopenmp-version=' allows to control,
which version of OpenMP must be supported. Currently it affects only the
value of _OPENMP define.
llvm-svn: 270838
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 9259b1291fe..2ebf9668796 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -928,7 +928,18 @@ 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. - Builder.defineMacro("_OPENMP", "201511"); + switch (LangOpts.OpenMP) { + 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 |