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:
parent
ed3f89953f
commit
e7bbdd0af6
|
@ -39,10 +39,11 @@ int main(int argc, char *argv[])
|
||||||
generatorsArg.setCombinable(true);
|
generatorsArg.setCombinable(true);
|
||||||
ConfigValueArgument clangOptionsArg("clang-opt", '\0', "specifies arguments/options to be passed to Clang", { "option" });
|
ConfigValueArgument clangOptionsArg("clang-opt", '\0', "specifies arguments/options to be passed to Clang", { "option" });
|
||||||
clangOptionsArg.setRequiredValueCount(Argument::varValueCount);
|
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");
|
ConfigValueArgument errorResilientArg("error-resilient", '\0', "turns most errors into warnings");
|
||||||
HelpArgument helpArg(parser);
|
HelpArgument helpArg(parser);
|
||||||
NoColorArgument noColorArg;
|
NoColorArgument noColorArg;
|
||||||
generateArg.setSubArguments({ &inputFileArg, &outputFileArg, &generatorsArg, &clangOptionsArg, &errorResilientArg });
|
generateArg.setSubArguments({ &inputFileArg, &outputFileArg, &generatorsArg, &clangOptionsArg, &logClangOptions, &errorResilientArg });
|
||||||
JsonSerializationCodeGenerator::Options jsonOptions;
|
JsonSerializationCodeGenerator::Options jsonOptions;
|
||||||
jsonOptions.appendTo(&generateArg);
|
jsonOptions.appendTo(&generateArg);
|
||||||
BinarySerializationCodeGenerator::Options binaryOptions;
|
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
|
// instantiate the code factory and add generators to it
|
||||||
CodeFactory factory(parser.executable(), inputFileArg.values(0), clangOptions, *os);
|
CodeFactory factory(parser.executable(), inputFileArg.values(0), clangOptions, *os);
|
||||||
|
|
Loading…
Reference in New Issue