From 6c7120d684cc46caafbe348d658158c0060a7638 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 5 Jul 2023 14:37:48 -0700 Subject: 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 --- source/slang/slang-reflection-api.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-reflection-api.cpp') 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()) { - 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()) { - auto fields = getFields(structDeclRef, MemberFilterStyle::Instance); + auto fields = getFields( + getModule(declRef)->getLinkage()->getASTBuilder(), structDeclRef, MemberFilterStyle::Instance); auto fieldDeclRef = fields[index]; return (SlangReflectionVariable*) fieldDeclRef.getDecl(); } -- cgit v1.2.3