From 63a24816f561a5d8e28ca7054892bd8602618be4 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 21 Dec 2020 14:28:09 +0100 Subject: [clang][cli] Implement `getAllArgValues` marshalling This infrastructure can be used ~30 more command line options. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D93631 --- clang/lib/Frontend/CompilerInvocation.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index fc5fd15..d7c1a6f 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -323,6 +323,23 @@ static Optional normalizeStringIntegral(OptSpecifier Opt, int, return Res; } +static Optional> +normalizeStringVector(OptSpecifier Opt, int, const ArgList &Args, + DiagnosticsEngine &) { + return Args.getAllArgValues(Opt); +} + +static void denormalizeStringVector(SmallVectorImpl &Args, + const char *Spelling, + CompilerInvocation::StringAllocator SA, + Option::OptionClass OptClass, + unsigned TableIndex, + const std::vector &Values) { + for (const std::string &Value : Values) { + denormalizeString(Args, Spelling, SA, OptClass, TableIndex, Value); + } +} + static Optional normalizeTriple(OptSpecifier Opt, int TableIndex, const ArgList &Args, DiagnosticsEngine &Diags) { @@ -1715,7 +1732,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.LLVMArgs = Args.getAllArgValues(OPT_mllvm); Opts.ASTDumpDecls = Args.hasArg(OPT_ast_dump, OPT_ast_dump_EQ); Opts.ASTDumpAll = Args.hasArg(OPT_ast_dump_all, OPT_ast_dump_all_EQ); - Opts.ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file); // Only the -fmodule-file= form. for (const auto *A : Args.filtered(OPT_fmodule_file)) { StringRef Val = A->getValue(); -- cgit v1.1