Skip to content

Commit 8fa666d

Browse files
committed
Fix diag printing.
Signed-off-by: Julian Oppermann <[email protected]>
1 parent 8573612 commit 8fa666d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ getDeviceLibraries(const ArgList &Args, DiagnosticsEngine &Diags) {
211211
if (LinkInfoIter == DeviceLibLinkInfo.end() || Val == "internal") {
212212
Diags.Report(diag::err_drv_unsupported_option_argument)
213213
<< A->getSpelling() << Val;
214-
return {};
215214
}
216215
DeviceLibLinkInfo[Val] = !ExcludeDeviceLibs;
217216
}
@@ -275,10 +274,15 @@ Error jit_compiler::linkDeviceLibraries(llvm::Module &Module,
275274
DiagnosticsEngine Diags(DiagID, DiagOpts, DiagBuffer);
276275

277276
auto LibNames = getDeviceLibraries(UserArgList, Diags);
278-
if (LibNames.empty()) {
279-
assert(std::distance(DiagBuffer->err_begin(), DiagBuffer->err_end()) == 1);
277+
if (auto NumErr =
278+
std::distance(DiagBuffer->err_begin(), DiagBuffer->err_end())) {
279+
std::string DiagMsg;
280+
raw_string_ostream SOS{DiagMsg};
281+
interleave(
282+
DiagBuffer->err_begin(), DiagBuffer->err_end(),
283+
[&](const auto &D) { SOS << D.second; }, [&]() { SOS << '\n'; });
280284
return createStringError("Could not determine list of device libraries: %s",
281-
DiagBuffer->err_begin()->second.c_str());
285+
DiagMsg.c_str());
282286
}
283287
// TODO: Add warnings to build log.
284288

sycl/test-e2e/KernelCompiler/kernel_compiler_sycl_jit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void test_unsupported_options() {
134134
try {
135135
syclex::build(kbSrc, devs,
136136
syclex::properties{syclex::build_options{flags}});
137-
assert(false && "Unsupported option not detected");
137+
assert(false && "unsupported option not detected");
138138
} catch (sycl::exception &e) {
139139
assert(e.code() == sycl::errc::build);
140140
assert(std::string(e.what()).find("Parsing of user arguments failed") !=

0 commit comments

Comments
 (0)