[clang] [CGData] Clang Options (PR #90304)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 09:24:00 PDT 2024
================
@@ -2753,6 +2753,31 @@ void tools::addMachineOutlinerArgs(const Driver &D,
addArg(Twine("-enable-machine-outliner=never"));
}
}
+
+ auto *CodeGenDataGenArg =
+ Args.getLastArg(options::OPT_fcodegen_data_generate_EQ);
+ auto *CodeGenDataUseArg = Args.getLastArg(options::OPT_fcodegen_data_use_EQ);
+
+ // We only allow one of them to be specified.
+ if (CodeGenDataGenArg && CodeGenDataUseArg)
+ D.Diag(diag::err_drv_argument_not_allowed_with)
+ << CodeGenDataGenArg->getAsString(Args)
+ << CodeGenDataUseArg->getAsString(Args);
+
+ // For codegen data gen, the output file is passed to the linker
+ // while a boolean flag is passed to the LLVM backend.
+ if (CodeGenDataGenArg)
+ addArg(Twine("-codegen-data-generate"));
+
+ // For codegen data use, the input file is passed to the LLVM backend.
+ if (CodeGenDataUseArg) {
+ SmallString<128> Path(CodeGenDataUseArg->getNumValues() == 0
+ ? ""
+ : CodeGenDataUseArg->getValue());
----------------
jansvoboda11 wrote:
Would replacing this logic with `AliasArgs<["default.cgdata"]>` in `Options.td` on the alias arg work? That way it would be more declarative and consistent with other flags.
https://github.com/llvm/llvm-project/pull/90304
More information about the cfe-commits
mailing list