Skip to content

Commit

Permalink
[gccjit] also enforce error checking for compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingerZhu committed Nov 15, 2024
1 parent 7b2c725 commit 5e7854d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Translation/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum class OutputType {
Dylib
};

std::optional<llvm::SmallString<128>>
llvm::Expected<llvm::SmallString<128>>
dumpContextToTempfile(gcc_jit_context *ctxt, OutputType type) {
StringRef suffix;
llvm::SmallString<128> path;
Expand All @@ -63,7 +63,7 @@ dumpContextToTempfile(gcc_jit_context *ctxt, OutputType type) {
}
auto err = llvm::sys::fs::createTemporaryFile("mlir-gccjit", suffix, path);
if (err)
return std::nullopt;
return llvm::createStringError(err, "failed to create temporary file");
switch (type) {
case OutputType::Gimple:
gcc_jit_context_dump_to_file(ctxt, path.c_str(), false);
Expand All @@ -88,6 +88,8 @@ dumpContextToTempfile(gcc_jit_context *ctxt, OutputType type) {
path.c_str());
break;
}
if (const char *err = gcc_jit_context_get_last_error(ctxt))
return llvm::createStringError(llvm::inconvertibleErrorCode(), err);
return path;
}

Expand Down

0 comments on commit 5e7854d

Please sign in to comment.