summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 19c3cad68..66e5714c3 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -466,6 +466,10 @@ String emitEntryPointSourceFromIR(
desc.effectiveProfile = getEffectiveProfile(entryPoint, targetRequest);
desc.sourceWriter = &sourceWriter;
+ // Define here, because must be in scope longer than the sourceEmitter, as sourceEmitter might reference
+ // items in the linkedIR module
+ LinkedIR linkedIR;
+
RefPtr<CLikeSourceEmitter> sourceEmitter;
typedef CLikeSourceEmitter::SourceStyle SourceStyle;
@@ -502,8 +506,6 @@ String emitEntryPointSourceFromIR(
return String();
}
- // Outside because we want to keep IR in scope whilst we are processing emits
- LinkedIR linkedIR;
{
LinkingAndOptimizationOptions linkingAndOptimizationOptions;