r238389 - [omp] Re-work Clang's handling of -fopenmp and undo r237769.

Chandler Carruth chandlerc at gmail.com
Thu May 28 13:47:06 PDT 2015


Thanks for the review!

I'll make these changes shortly, just responding below:

On Thu, May 28, 2015 at 12:39 AM Justin Bogner <mail at justinbogner.com>
wrote:

> Chandler Carruth <chandlerc at gmail.com> writes:
> > +  /// The legacy name for the LLVM OpenMP runtim from when it was the
> Intel
>                                              ^~~~~~
> Typo.
>

Good catch!


> > +  /// OpenMP runtime. We support this mode for users with existing
> dependencies
> > +  /// on this runtime library name.
> > +  OMPRT_IOMP5
> > +};
> > +}
> > +
> > +/// Compute the desired OpenMP runtime from the flag provided.
> > +static OpenMPRuntimeKind getOpenMPRuntime(const ToolChain &TC, const
> ArgList &Args) {
>
> Long line?
>

Doh, will fix.


>
> > +  StringRef RuntimeName(CLANG_DEFAULT_OPENMP_RUNTIME);
> > +
> > +  const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ);
> > +  if (A)
> > +    RuntimeName = A->getValue();
> > +
> > +  auto RT = llvm::StringSwitch<OpenMPRuntimeKind>(RuntimeName)
> > +      .Case("libomp", OMPRT_OMP)
> > +      .Case("libgomp", OMPRT_GOMP)
> > +      .Case("libiomp5", OMPRT_IOMP5)
> > +      .Default(OMPRT_Unknown);
> > +
> > +  if (RT == OMPRT_Unknown) {
> > +    if (A)
> > +      TC.getDriver().Diag(diag::err_drv_unsupported_option_argument)
> > +        << A->getOption().getName() << A->getValue();
> > +    else
> > +      // FIXME: We could use a nicer diagnostic here.
> > +      TC.getDriver().Diag(diag::err_drv_unsupported_opt) << "-fopenmp";
>
> Is this even reachable in a meaningful way? CLANG_DEFAULT_OPENMP_RUNTIME
> has to be something we don't understand. If we can somehow get here, the
> error is really "You're using a version of LLVM that was configured
> wrong, get a better one".
>

Totally open to suggestions about how to approach this. I wasn't sure of
the best one myself, and left a FIXME to try and find a better one. At the
least, as you say, this isn't really reachable in any sensible setup. Ideas
about how to actually check this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150528/08d831b4/attachment.html>


More information about the cfe-commits mailing list