[clang] [Clang][RISCV] Add preprocessor macros for Zicfilp CFI scheme (PR #109600)

Ming-Yi Lai via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 24 03:50:31 PDT 2024


================
@@ -2022,6 +2035,20 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
       Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Name;
   }
 
+  if (const Arg *A = Args.getLastArg(OPT_mcf_branch_label_scheme_EQ)) {
+    if (Opts.CFProtectionBranch) {
+      const StringRef Scheme = A->getValue();
+      if (Scheme == "unlabeled")
+        Opts.setCFBranchLabelScheme(CFBranchLabelSchemeKind::Unlabeled);
+      else if (Scheme == "func-sig")
+        Opts.setCFBranchLabelScheme(CFBranchLabelSchemeKind::FuncSig);
+      else
+        Diags.Report(diag::err_drv_invalid_value)
+            << A->getAsString(Args) << Scheme;
+    } else
+      Diags.Report(diag::warn_drv_unused_argument) << A->getAsString(Args);
----------------
mylai-mtk wrote:

Fixed in #109784.

https://github.com/llvm/llvm-project/pull/109600


More information about the cfe-commits mailing list