Author: joerg Date: Wed Sep 23 09:06:52 2015 New Revision: 248379 URL: http://llvm.org/viewvc/llvm-project?rev=248379&view=rev Log: Refactor library decision for -fopenmp support from Darwin into a function for sharing with other platforms.
Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248379&r1=248378&r2=248379&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep 23 09:06:52 2015 @@ -2516,6 +2516,28 @@ static OpenMPRuntimeKind getOpenMPRuntim return RT; } +static void addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC, + const ArgList &Args) { + if (!Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, + options::OPT_fno_openmp, false)) + return; + + switch (getOpenMPRuntime(TC, Args)) { + case OMPRT_OMP: + CmdArgs.push_back("-lomp"); + break; + case OMPRT_GOMP: + CmdArgs.push_back("-lgomp"); + break; + case OMPRT_IOMP5: + CmdArgs.push_back("-liomp5"); + break; + case OMPRT_Unknown: + // Already diagnosed. + break; + } +} + static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs, StringRef Sanitizer, bool IsShared) { @@ -6727,23 +6749,7 @@ void darwin::Linker::ConstructJob(Compil Args.AddAllArgs(CmdArgs, options::OPT_L); - if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, - options::OPT_fno_openmp, false)) { - switch (getOpenMPRuntime(getToolChain(), Args)) { - case OMPRT_OMP: - CmdArgs.push_back("-lomp"); - break; - case OMPRT_GOMP: - CmdArgs.push_back("-lgomp"); - break; - case OMPRT_IOMP5: - CmdArgs.push_back("-liomp5"); - break; - case OMPRT_Unknown: - // Already diagnosed. - break; - } - } + addOpenMPRuntime(CmdArgs, getToolChain(), Args); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); // Build the input file for -filelist (list of linker input files) in case we _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits