diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-01-21 18:05:39 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-21 18:05:39 -0800 |
| commit | 41311209af4963f44acf34942d42828590d4b156 (patch) | |
| tree | 97318b544324b26f056fc824f22ba91e821c6330 /source/slang/mangle.cpp | |
| parent | 8196dc4a684a75344e507697273e2123af97b979 (diff) | |
Fix legalization of generic types (#377)
Previously, all legalizations of a generic type would use the name of the original decl for the "ordinary" part of things, and this would lead to collisions because the names didn't include the mangled generic arguments.
This is now fixed by storing the mangled name of the original inside of `struct` declarations created for legalization, and using those names instead.
Also adds support for `getElementPtr` instructions when doing IR type legalization.
Also tries to make a `DeclRefType` convert to a string using the underlying `DeclRef`. This doesn't help because `DeclRef::toString` doesn't actually include generic arguments either.
Diffstat (limited to 'source/slang/mangle.cpp')
| -rw-r--r-- | source/slang/mangle.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp index 29446d942..f2bf279a2 100644 --- a/source/slang/mangle.cpp +++ b/source/slang/mangle.cpp @@ -373,6 +373,13 @@ namespace Slang String getMangledName(DeclRef<Decl> const& declRef) { + // Special case: if a declaration is the result of a type legalization + // transformation, then it should just get the mangled name of the + // original declaration, and not the one that would be computed + // for it otherwise. + if(auto legalizedModifier = declRef.getDecl()->FindModifier<LegalizedModifier>()) + return legalizedModifier->originalMangledName; + ManglingContext context; mangleName(&context, declRef); return context.sb.ProduceString(); |
