From 5a85526728c9e57efe26f322e4718fffd2634d23 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 18 Dec 2020 15:24:39 +0100 Subject: [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 --- clang/lib/Frontend/CompilerInvocation.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') 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(A->getValue()) - .Cases("2017", "1.2.1", "121", "sycl-1.2.1", 2017) - .Default(0U); + Opts.setSYCLVersion( + llvm::StringSwitch(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(); -- cgit v1.1