diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-05 14:37:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-05 14:37:48 -0700 |
| commit | 6c7120d684cc46caafbe348d658158c0060a7638 (patch) | |
| tree | e8ba738564b5cdceda22013900a0ed762c184bd3 /source/slang/slang-check-expr.cpp | |
| parent | 6063304cb8d73d430e7ef81c62cd9822302fcc19 (diff) | |
Bottleneck DeclRef creation through ASTBuilder. (#2689)
* Bottleneck DeclRef creation through ASTBuilder.
* Fix clang error.
* Fix.
* Fix.
* More fix.
* Rebase on top of tree.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 587dcc2b5..aa3ca889d 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -538,7 +538,7 @@ namespace Slang synthesizedDecl = structDecl; auto typeDef = m_astBuilder->create<TypeAliasDecl>(); typeDef->nameAndLoc.name = getName("Differential"); - auto declRef = createDefaultSubstitutionsIfNeeded(m_astBuilder, this, DeclRef<Decl>(structDecl, nullptr)); + auto declRef = createDefaultSubstitutionsIfNeeded(m_astBuilder, this,m_astBuilder->getSpecializedDeclRef(structDecl, nullptr)); typeDef->type.type = m_astBuilder->getOrCreateDeclRefType(declRef.decl, declRef.substitutions); typeDef->parentDecl = structDecl; structDecl->members.add(typeDef); @@ -1577,8 +1577,9 @@ namespace Slang { Val* valResult = m_astBuilder->getOrCreate<GenericParamIntVal>( declRef.substitute(m_astBuilder, genericValParamRef.getDecl()->getType()), - genericValParamRef.getDecl(), - genericValParamRef.substitutions.substitutions); + m_astBuilder->getSpecializedDeclRef( + genericValParamRef.getDecl(), + genericValParamRef.substitutions.substitutions)); valResult = valResult->substitute(m_astBuilder, expr.getSubsts()); return as<IntVal>(valResult); } @@ -2472,7 +2473,7 @@ namespace Slang if (auto baseFuncGenericDeclRef = declRefExpr->declRef.as<GenericDecl>()) { // Get inner function - DeclRef<Decl> unspecializedInnerRef = DeclRef<Decl>( + DeclRef<Decl> unspecializedInnerRef = astBuilder->getSpecializedDeclRef<Decl>( getInner(baseFuncGenericDeclRef), baseFuncGenericDeclRef.substitutions); auto callableDeclRef = unspecializedInnerRef.as<CallableDecl>(); @@ -3576,7 +3577,7 @@ namespace Slang for (auto lookupResult : overloadedExpr->lookupResult2) { bool shouldRemove = false; - if (lookupResult.declRef.getParent().as<InterfaceDecl>()) + if (lookupResult.declRef.getParent(m_astBuilder).as<InterfaceDecl>()) { shouldRemove = true; } |
