summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-mangle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-mangle.cpp')
-rw-r--r--source/slang/slang-mangle.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index 7951ddc38..5a0d41f09 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -608,6 +608,48 @@ namespace Slang
{
emitType(context, getResultType(context->astBuilder, callableDeclRef));
}
+
+ // Include key modifiers in the mangled name so we never deduplicate
+ // things like a nonmutating method and a mutating method.
+ bool isMutating = false;
+ bool isRefThis = false;
+ bool isFwdDiff = false;
+ bool isBwdDiff = false;
+ bool isNoDiffThis = false;
+ for (auto modifier : callableDeclRef.getDecl()->modifiers)
+ {
+ if (as<MutatingAttribute>(modifier))
+ {
+ isMutating = true;
+ }
+ else if (as<RefAttribute>(modifier))
+ {
+ isRefThis = true;
+ }
+ else if (as<ForwardDifferentiableAttribute>(modifier))
+ {
+ isFwdDiff = true;
+ }
+ else if (as<BackwardDifferentiableAttribute>(modifier))
+ {
+ isBwdDiff = true;
+ }
+ else if (as<NoDiffThisAttribute>(modifier))
+ {
+ isNoDiffThis = true;
+ }
+ }
+
+ if (isMutating)
+ emitRaw(context, "m");
+ if (isRefThis)
+ emitRaw(context, "r");
+ if (isFwdDiff)
+ emitRaw(context, "f");
+ if (isBwdDiff)
+ emitRaw(context, "b");
+ if (isNoDiffThis)
+ emitRaw(context, "n");
}
}