Allow logging the exact list of options passed to clang

Since the options get splitted and not just passed as-is
this can be useful for debugging.
This commit is contained in:
Martchus 2020-01-26 20:41:34 +01:00
parent ed3f89953f
commit e7bbdd0af6
1 changed files with 8 additions and 1 deletions

View File

@ -39,10 +39,11 @@ int main(int argc, char *argv[])
generatorsArg.setCombinable(true);
ConfigValueArgument clangOptionsArg("clang-opt", '\0', "specifies arguments/options to be passed to Clang", { "option" });
clangOptionsArg.setRequiredValueCount(Argument::varValueCount);
ConfigValueArgument logClangOptions("log-clang-opt", '\0', "logs the options passed to Clang");
ConfigValueArgument errorResilientArg("error-resilient", '\0', "turns most errors into warnings");
HelpArgument helpArg(parser);
NoColorArgument noColorArg;
generateArg.setSubArguments({ &inputFileArg, &outputFileArg, &generatorsArg, &clangOptionsArg, &errorResilientArg });
generateArg.setSubArguments({ &inputFileArg, &outputFileArg, &generatorsArg, &clangOptionsArg, &logClangOptions, &errorResilientArg });
JsonSerializationCodeGenerator::Options jsonOptions;
jsonOptions.appendTo(&generateArg);
BinarySerializationCodeGenerator::Options binaryOptions;
@ -79,6 +80,12 @@ int main(int argc, char *argv[])
}
}
}
if (logClangOptions.isPresent()) {
cerr << Phrases::Info << "Options passed to clang:" << Phrases::End;
for (const auto &opt : clangOptions) {
cerr << opt << '\n';
}
}
// instantiate the code factory and add generators to it
CodeFactory factory(parser.executable(), inputFileArg.values(0), clangOptions, *os);