Skip to content

Commit f5e437a

Browse files
[SYCL RTC] Add one forgotten consumeError (#20405)
Follow-up for #20374. And as part of the change, spell out more `auto` types to make it clearer when such calls are necessary.
1 parent 5a9aa8b commit f5e437a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,19 +435,20 @@ class SYCLToolchain {
435435
return (void)UseCachedPreamble(PCHStorage);
436436
};
437437

438-
auto CacheOrErr =
438+
llvm::Expected<llvm::FileCache> CacheOrErr =
439439
llvm::localCache("SYCL RTC Persistent Preambles", "syclrtc-tmp-",
440440
PersistentPCHDir, CacheCallback);
441441

442442
assert(CacheOrErr && "Don't see any code path returning Error");
443-
auto AddStreamOrErr = (*CacheOrErr)(0, EncodedHash, "");
443+
llvm::Expected<llvm::AddStreamFn> AddStreamOrErr =
444+
(*CacheOrErr)(0, EncodedHash, "");
444445
if (!AddStreamOrErr) {
445446
// Not a hit, but we won't be able to store the data in the cache, so
446447
// no need to generate precompiled preamble.
447448
consumeError(AddStreamOrErr.takeError());
448449
return RunWithoutPCH();
449450
}
450-
auto &AddStream = *AddStreamOrErr;
451+
llvm::AddStreamFn &AddStream = *AddStreamOrErr;
451452
if (!AddStream) {
452453
// UseCachedPreamble was called by the cache after successfully
453454
// reading persistent auto-pch file.
@@ -468,9 +469,12 @@ class SYCLToolchain {
468469
// Any errors updating the persistent preambles cache won't affect
469470
// current compilation, so ignore any error below:
470471

471-
auto FileOrErr = AddStream(1, "");
472-
if (!FileOrErr)
472+
llvm::Expected<std::unique_ptr<llvm::CachedFileStream>> FileOrErr =
473+
AddStream(1, "");
474+
if (!FileOrErr) {
475+
consumeError(FileOrErr.takeError());
473476
return Success;
477+
}
474478

475479
llvm::CachedFileStream *CFS = FileOrErr->get();
476480
raw_pwrite_stream &OS = *CFS->OS;

0 commit comments

Comments
 (0)