summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-lower-to-ir.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index e9381268b..ad7cec773 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -7154,6 +7154,19 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
auto funcDecl = as<FunctionDeclBase>(dd);
SLANG_ASSERT(funcDecl);
lowerFuncDecl(funcDecl);
+
+ // Note: Because we are iterating over multiple declarations,
+ // but only one will be registered as the value for `decl`
+ // in the global mapping by `ensureDecl()`, we have to take
+ // responsibility here for registering a lowered value
+ // for the remaining (non-primary) declarations.
+ //
+ // It doesn't really matter which one we register here, because
+ // they will all have the same mangled name in the IR, but we
+ // default to the `result` that is returned from this visitor,
+ // so that all the declarations share the same IR representative.
+ //
+ setGlobalValue(context->shared, funcDecl, result);
}
return result;
}