diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-07 14:26:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-07 14:26:37 -0700 |
| commit | 643aaa13d2c6e0c4994437aa9fba6716787608ce (patch) | |
| tree | 279794cfafecc89f0be133d2a81750d59d9ee94a /source/slang/slang-mangle.cpp | |
| parent | fb6605c2a7bc17d3b3b79dabd07e1f05267eb33a (diff) | |
Make DeclRefBase a Val, and DeclRef<T> a helper class. (#2967)
* Make DeclRefBase a Val, and DeclRef<T> a helper class.
* Fixes.
* Workaround gcc parser issue.
* Revert NodeOperand change.
* Fix.
* Fix clang incomplete class complains.
* Fix code review.
* Small cleanups and improvements.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-mangle.cpp')
| -rw-r--r-- | source/slang/slang-mangle.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index ee34358ab..de1b58999 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -423,7 +423,7 @@ namespace Slang // There are two cases here: either we have specializations // in place for the parent generic declaration, or we don't. - auto subst = findInnerMostGenericSubstitution(declRef.substitutions); + auto subst = findInnerMostGenericSubstitution(declRef.getSubst()); if( subst && subst->genericDecl == parentGenericDeclRef.getDecl() ) { // This is the case where we *do* have substitutions. @@ -484,7 +484,7 @@ namespace Slang for (auto type : constraint.value) { emitRaw(context, "C"); - emitQualifiedName(context, context->astBuilder->getSpecializedDeclRef(constraint.key, nullptr)); + emitQualifiedName(context, makeDeclRef(constraint.key)); emitType(context, type); } } @@ -531,6 +531,7 @@ namespace Slang // are asked to mangle the name of a `typedef`? auto decl = declRef.getDecl(); + if (!decl) return; // Handle `__extern_cpp` modifier by simply emitting // the given name. @@ -568,11 +569,11 @@ namespace Slang // mangling the generic and the inner entity emitRaw(context, "G"); - SLANG_ASSERT(genericDecl.substitutions == nullptr); + SLANG_ASSERT(genericDecl.getSubst() == nullptr); - auto innerDecl = makeDeclRef(getInner(genericDecl)); + auto innerDecl = getInner(genericDecl); - emitQualifiedName(context, innerDecl); + emitQualifiedName(context, makeDeclRef(innerDecl)); return; } else if (as<ForwardDerivativeRequirementDecl>(decl)) @@ -588,17 +589,16 @@ namespace Slang emitQualifiedName(context, declRef); } - String getMangledName(ASTBuilder* astBuilder, DeclRef<Decl> const& declRef) + static String getMangledName(ASTBuilder* astBuilder, DeclRef<Decl> const& declRef) { ManglingContext context(astBuilder); mangleName(&context, declRef); return context.sb.produceString(); } - String getMangledName(ASTBuilder* astBuilder, DeclRefBase const & declRef) + String getMangledName(ASTBuilder* astBuilder, DeclRefBase* declRef) { - return getMangledName(astBuilder, - astBuilder->getSpecializedDeclRef<Decl>(declRef.decl, declRef.substitutions)); + return getMangledName(astBuilder, DeclRef<Decl>(declRef)); } String getMangledName(ASTBuilder* astBuilder, Decl* decl) |
