aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2020-12-18 15:24:39 +0100
committerJan Svoboda <jan_svoboda@apple.com>2020-12-21 11:32:47 +0100
commit5a85526728c9e57efe26f322e4718fffd2634d23 (patch)
tree3be06e9bdf494158076a1058aafd58be84cd84c0 /clang/lib/Frontend/CompilerInvocation.cpp
parent70410a264949101ced3ce3458f37dd4cc2f5af85 (diff)
downloadllvm-5a85526728c9e57efe26f322e4718fffd2634d23.zip
llvm-5a85526728c9e57efe26f322e4718fffd2634d23.tar.gz
llvm-5a85526728c9e57efe26f322e4718fffd2634d23.tar.bz2
[clang] Use enum for LangOptions::SYCLVersion instead of unsigned
`LangOptions::SYCLVersion` can only have two values. This patch introduces an enum that allows us to reduce the member size from 32 bits to 1 bit. Consequently, this also makes marshalling of this option fit into our model for enums: D84674. Reviewed By: bader Differential Revision: https://reviews.llvm.org/D93540
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index f71b14e..fc5fd15 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2277,11 +2277,13 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
// -sycl-std applies to any SYCL source, not only those containing kernels,
// but also those using the SYCL API
if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
- Opts.SYCLVersion = llvm::StringSwitch<unsigned>(A->getValue())
- .Cases("2017", "1.2.1", "121", "sycl-1.2.1", 2017)
- .Default(0U);
+ Opts.setSYCLVersion(
+ llvm::StringSwitch<LangOptions::SYCLMajorVersion>(A->getValue())
+ .Cases("2017", "1.2.1", "121", "sycl-1.2.1",
+ LangOptions::SYCL_2017)
+ .Default(LangOptions::SYCL_None));
- if (Opts.SYCLVersion == 0U) {
+ if (Opts.getSYCLVersion() == LangOptions::SYCL_None) {
// User has passed an invalid value to the flag, this is an error
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue();