diff options
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 36 |
2 files changed, 22 insertions, 21 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 032c9c10daf..74e9fed7f12 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1954,15 +1954,16 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, } // Check if -fopenmp is specified. - Opts.OpenMP = Args.hasArg(options::OPT_fopenmp); + Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0; Opts.OpenMPUseTLS = Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls); Opts.OpenMPIsDevice = Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device); if (Opts.OpenMP) { - if (int Version = getLastArgIntValue(Args, OPT_fopenmp_version_EQ, - Opts.OpenMP, Diags)) + int Version = + getLastArgIntValue(Args, OPT_fopenmp_version_EQ, Opts.OpenMP, Diags); + if (Version != 0) Opts.OpenMP = Version; // Provide diagnostic when a given target is not expected to be an OpenMP // device or host. diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 2ebf9668796..27ef59a0c20 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -922,24 +922,24 @@ static void InitializePredefinedMacros(const TargetInfo &TI, } // OpenMP definition - if (LangOpts.OpenMP) { - // OpenMP 2.2: - // In implementations that support a preprocessor, the _OPENMP - // 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 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; - } + // OpenMP 2.2: + // In implementations that support a preprocessor, the _OPENMP + // 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 + Builder.defineMacro("_OPENMP", "201107"); + break; } // CUDA device path compilaton |