diff options
Diffstat (limited to 'source/slang/slang-target-program.cpp')
| -rw-r--r-- | source/slang/slang-target-program.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/slang/slang-target-program.cpp b/source/slang/slang-target-program.cpp index ffb859b55..d7e7a73bb 100644 --- a/source/slang/slang-target-program.cpp +++ b/source/slang/slang-target-program.cpp @@ -98,16 +98,28 @@ IArtifact* TargetProgram::getOrCreateEntryPointResult(Int entryPointIndex, Diagn if (IArtifact* artifact = m_entryPointResults[entryPointIndex]) return artifact; - // If we haven't yet computed a layout for this target - // program, we need to make sure that is done before - // code generation. - // - if (!getOrCreateIRModuleForLayout(sink)) + try + { + // If we haven't yet computed a layout for this target + // program, we need to make sure that is done before + // code generation. + // + if (!getOrCreateIRModuleForLayout(sink)) + { + return nullptr; + } + + return _createEntryPointResult(entryPointIndex, sink); + } + catch (const Exception& e) { + sink->diagnose( + SourceLoc(), + Diagnostics::compilationAbortedDueToException, + typeid(e).name(), + e.Message); return nullptr; } - - return _createEntryPointResult(entryPointIndex, sink); } } // namespace Slang |
