Clang-Tidy: copy stdout to sterr; ignore original stderr
Clang-Tidy writes the number of warnings, the number of suppressed warnings, and instructions on how to suppress warnings to stderr. Since each source file is checked individually, this repetitive information is disturbing and should be suppressed. The actual warning messages are written to stdout. Some IDEs (eg. QtCreator) analyze only stderr for issues. Redirecting Clang-Tidy's stdout to stderr makes sure the warnings are correctly displayed.
This commit is contained in:
parent
b8a8dfec36
commit
04d74a7f89
|
@ -389,13 +389,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||||
tidy_cmd.push_back("--");
|
tidy_cmd.push_back("--");
|
||||||
tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin()+1, orig_cmd.end());
|
tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin()+1, orig_cmd.end());
|
||||||
|
|
||||||
// Run the tidy command line.
|
// Run the tidy command line. Capture its stdout and hide its stderr.
|
||||||
if(!cmSystemTools::RunSingleCommand(tidy_cmd, 0, 0, &ret, 0,
|
std::string stdOut;
|
||||||
cmSystemTools::OUTPUT_PASSTHROUGH))
|
if(!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, 0, &ret, 0,
|
||||||
|
cmSystemTools::OUTPUT_NONE))
|
||||||
{
|
{
|
||||||
std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
|
std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Output the stdout from clang-tidy to stderr
|
||||||
|
std::cerr << stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now run the real compiler command and return its result value.
|
// Now run the real compiler command and return its result value.
|
||||||
|
|
Loading…
Reference in New Issue