summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-reflection-api.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-07-05 14:37:48 -0700
committerGitHub <noreply@github.com>2023-07-05 14:37:48 -0700
commit6c7120d684cc46caafbe348d658158c0060a7638 (patch)
treee8ba738564b5cdceda22013900a0ed762c184bd3 /source/slang/slang-reflection-api.cpp
parent6063304cb8d73d430e7ef81c62cd9822302fcc19 (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-reflection-api.cpp')
-rw-r--r--source/slang/slang-reflection-api.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp
index 8ec0979e4..07857c293 100644
--- a/source/slang/slang-reflection-api.cpp
+++ b/source/slang/slang-reflection-api.cpp
@@ -432,7 +432,11 @@ SLANG_API unsigned int spReflectionType_GetFieldCount(SlangReflectionType* inTyp
auto declRef = declRefType->declRef;
if( auto structDeclRef = declRef.as<StructDecl>())
{
- return (unsigned int)getFields(structDeclRef, MemberFilterStyle::Instance).getCount();
+ return (unsigned int)getFields(
+ getModule(declRef.decl)->getLinkage()->getASTBuilder(),
+ structDeclRef,
+ MemberFilterStyle::Instance)
+ .getCount();
}
}
@@ -451,7 +455,8 @@ SLANG_API SlangReflectionVariable* spReflectionType_GetFieldByIndex(SlangReflect
auto declRef = declRefType->declRef;
if( auto structDeclRef = declRef.as<StructDecl>())
{
- auto fields = getFields(structDeclRef, MemberFilterStyle::Instance);
+ auto fields = getFields(
+ getModule(declRef)->getLinkage()->getASTBuilder(), structDeclRef, MemberFilterStyle::Instance);
auto fieldDeclRef = fields[index];
return (SlangReflectionVariable*) fieldDeclRef.getDecl();
}