Skip to content

Instantly share code, notes, and snippets.

@rui314
Created June 12, 2017 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rui314/f82e5e42a79d86b3e273abf8e911314d to your computer and use it in GitHub Desktop.
Save rui314/f82e5e42a79d86b3e273abf8e911314d to your computer and use it in GitHub Desktop.
/// Compute the desired OpenMP runtime from the flags provided.
Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
- StringRef RuntimeName(CLANG_DEFAULT_OPENMP_RUNTIME);
+ OptValue 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) {
+ RuntimeName = A->getEnumValue();
+
+ switch (RuntimeName) {
+ case options::VALUE_fopenmp_EQ::libomp:
+ return OMPRT_OMP;
+ case options::VALUE_fopenmp_EQ::libgomp:
+ return OMPRT_GOMP;
+ case options::VALUE_fopenmp_EQ::libiomp5:
+ return OMPRT_IOMP5
+ default:
if (A)
Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << A->getValue();
else
// FIXME: We could use a nicer diagnostic here.
Diag(diag::err_drv_unsupported_opt) << "-fopenmp";
+ return RT;
}
-
- return RT;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment