summaryrefslogtreecommitdiff
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-05-08 14:31:40 -0400
committerGitHub <noreply@github.com>2020-05-08 14:31:40 -0400
commit798f3bc2236ce81499b05662dc11e7c071e7cde8 (patch)
treefbfa2ef90d4cfdace9ce3667cf441e22137792fb /source/slang/slang.cpp
parentc16abd4fe1bda5ebcd50dbb22f30c6be43bb885f (diff)
AST nodes using C++ Extractor (#1341)
* Extractor builds without any reference to syntax (as it will be helping to produce this!). * Change macros to include the super class. * WIP replacing defs files. * Added indexOf(const UnownedSubString& in) to UnownedSubString. Refactored extractor * Output a macro for each type with the extracted info - can be used during injection in class * Simplify the header file - as can get super type and last from macro now * Store the 'origin' of a definition * Some small tidy ups to the extractor. * Improve comments on the extractor options. * Made CPPExtractor own SourceOrigins * Small fixes around SourceOrigin. * Small tidy up around macroOrign * WIP Visitor seems now to work correctly. Split out types used by ast into slang-ast-support-types.h * Fix remaining problems with C++ extractor being used with AST nodes. Add CountOf to extractor type ids. Added ReflectClassInfo::getInfo to turn an ASTNodeType into a ReflectClassInfo * Fix compiling on linux. Fix typo in memset. * Small tidy up around comments/layout. Moved NodeBase casting to NodeBase. * Make premake generate project that builds with cpp-extractor for AST. * Get the source directory from the filter in premake. * Fix typo in source path * Explicitly set the source path for premake generation for AST. * Special case handling of override to apease Clang. * Use a more general way to find the slang-ast-reflect.h file to run the extractor. * Appveyor is not triggering slang-cpp-extractor - try putting dependson together. * Put building slang-cpp-extractor first. * Disable some project options to stop MSBuild producing internal compiler errors. * Try reordering the projects in premake5.lua * Hack to try and make slang-cpp-extractor built on appveyor. * Disable flags - not required for MSBuild on appveyor. * Disable flags not required for build on AppVeyor. * Updated Visual Studio projects with slang-cpp-extractor. * Added Visual Studio slang-cpp-extractor project.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 1f8f79af2..34f1402b5 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -116,19 +116,19 @@ void Session::init()
// Set all the shared library function pointers to nullptr
::memset(m_sharedLibraryFunctions, 0, sizeof(m_sharedLibraryFunctions));
- {
- static auto res = SyntaxClassBase::ClassInfo::initRanges();
- }
-
+
// Initialize the lookup table of syntax classes:
// We can just iterate over the class pointers.
// NOTE! That this adds the names of the abstract classes too(!)
{
- const SyntaxClassBase::ClassInfo* info = SyntaxClassBase::ClassInfo::s_first;
- for (; info; info = info->m_next)
+ for (Index i = 0; i < Index(ASTNodeType::CountOf); ++i)
{
- mapNameToSyntaxClass.Add(getNamePool()->getName(info->m_name), SyntaxClass<Slang::RefObject>(info));
+ const ReflectClassInfo* info = ReflectClassInfo::getInfo(ASTNodeType(i));
+ if (info)
+ {
+ mapNameToSyntaxClass.Add(getNamePool()->getName(info->m_name), SyntaxClass<Slang::RefObject>(info));
+ }
}
}