Skip to content

Commit 9ab06d1

Browse files
[opencl-aot] Fix regression in error reporting (#12022)
This patch fixes a regression in error reporting, previously compiler build log was printed to `std::cerr`, but now it doesn't print by default. It makes it difficult for developers to understand what's going on. So now the compiler build log is printed to `std::cerr` if there is an error message, and to verbose logs if compilation was successful but there is something in the compiler build logs.
1 parent 5d75245 commit 9ab06d1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

opencl/opencl-aot/source/main.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,13 @@ int main(int Argc, char *Argv[]) {
604604
}
605605

606606
if (!CompilerBuildLog.empty()) {
607-
logs() << "\n"
608-
<< CmdToCmdInfoMap[OptCommand].first << " log:\n"
609-
<< CompilerBuildLog << '\n';
607+
std::string CompilerBuildLogMessage = "\n" +
608+
CmdToCmdInfoMap[OptCommand].first +
609+
" log:\n" + CompilerBuildLog + '\n';
610+
if (!ErrorMessage.empty())
611+
std::cerr << CompilerBuildLogMessage;
612+
else
613+
logs() << CompilerBuildLogMessage;
610614
}
611615

612616
if (clFailed(CLErr)) {

0 commit comments

Comments
 (0)