MCPcopy Create free account
hub / github.com/Kitware/CMake / RunPreprocessor

Method RunPreprocessor

Source/cmcmd.cxx:2715–2747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2713}
2714
2715int cmcmd::RunPreprocessor(std::vector<std::string> const& command,
2716 std::string const& intermediate_file)
2717{
2718 cmUVProcessChainBuilder builder;
2719
2720 uv_fs_t fs_req;
2721 int preprocessedFile =
2722 uv_fs_open(nullptr, &fs_req, intermediate_file.c_str(), O_CREAT | O_RDWR,
2723 0644, nullptr);
2724 uv_fs_req_cleanup(&fs_req);
2725
2726 builder
2727 .SetExternalStream(cmUVProcessChainBuilder::Stream_OUTPUT,
2728 preprocessedFile)
2729 .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR)
2730 .AddCommand(command);
2731 auto process = builder.Start();
2732 if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) {
2733 std::cerr << "Failed to start preprocessor.";
2734 return 1;
2735 }
2736 if (!process.Wait()) {
2737 std::cerr << "Failed to wait for preprocessor";
2738 return 1;
2739 }
2740 if (process.GetStatus(0).ExitStatus != 0) {
2741 cmUVIStream errorStream(process.ErrorStream());
2742 std::cerr << errorStream.rdbuf();
2743
2744 return 1;
2745 }
2746 return 0;
2747}
2748
2749int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
2750{

Callers

nothing calls this directly

Calls 9

c_strMethod · 0.80
GetStatusMethod · 0.80
ErrorStreamMethod · 0.80
uv_fs_openFunction · 0.50
uv_fs_req_cleanupFunction · 0.50
AddCommandMethod · 0.45
StartMethod · 0.45
ValidMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected