diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-06-08 15:28:48 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-08 15:28:48 -0400 |
| commit | 78696a6aced6567af791d1741183b15ab4a49a1b (patch) | |
| tree | f5c59ebcdf68104a16be04603d9de2dd23f89560 /source | |
| parent | b3fbb92b3f8147cb37eb8b49e1c125890a6a0be6 (diff) | |
Small fixes/improvements based on review. (#1379)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ast-builder.cpp | 8 | ||||
| -rw-r--r-- | source/slang/slang-ast-builder.h | 7 | ||||
| -rw-r--r-- | source/slang/slang-ast-support-types.h | 8 | ||||
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 1 | ||||
| -rw-r--r-- | source/slang/slang-check-impl.h | 17 | ||||
| -rw-r--r-- | source/slang/slang-check-shader.cpp | 3 |
6 files changed, 18 insertions, 26 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index 048ba7437..3ff6130bd 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -154,16 +154,16 @@ ASTBuilder::ASTBuilder(): m_id(-1), m_arena(2048) { - m_name = "ShadedASTBuilder::m_astBuilder"; + m_name = "SharedASTBuilder::m_astBuilder"; } ASTBuilder::~ASTBuilder() { - for (NodeBase* node : m_nodes) + for (NodeBase* node : m_dtorNodes) { const ReflectClassInfo* info = ReflectClassInfo::getInfo(node->astNodeType); - SLANG_ASSERT(info->m_destroyFunc); - info->m_destroyFunc(node); + SLANG_ASSERT(info->m_destructorFunc); + info->m_destructorFunc(node); } } diff --git a/source/slang/slang-ast-builder.h b/source/slang/slang-ast-builder.h index b6aa83a8c..5bf7441f4 100644 --- a/source/slang/slang-ast-builder.h +++ b/source/slang/slang-ast-builder.h @@ -181,12 +181,11 @@ protected: SLANG_COMPILE_TIME_ASSERT(IsValidType<T>::Value); node->init(T::kType, this); - // Only add it if it has a dtor that does some work if (!std::is_trivially_destructible<T>::value) { // Keep such that dtor can be run on ASTBuilder being dtored - m_nodes.add(node); + m_dtorNodes.add(node); } return node; } @@ -194,8 +193,8 @@ protected: String m_name; Index m_id; - /// All of the nodes constructed on this builder - List<NodeBase*> m_nodes; + /// List of all nodes that require being dtored when ASTBuilder is dtored + List<NodeBase*> m_dtorNodes; SharedASTBuilder* m_sharedASTBuilder; diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h index 50182d56d..759930aac 100644 --- a/source/slang/slang-ast-support-types.h +++ b/source/slang/slang-ast-support-types.h @@ -463,7 +463,7 @@ namespace Slang typedef ReflectClassInfo ThisType; typedef void* (*CreateFunc)(ASTBuilder* astBuilder); - typedef void (*DestroyFunc)(void* ptr); + typedef void (*DestructorFunc)(void* ptr); /// A constant time implementation of isSubClassOf SLANG_FORCE_INLINE bool isSubClassOf(const ThisType& super) const @@ -493,8 +493,8 @@ namespace Slang const ReflectClassInfo* m_superClass; ///< The super class of this class, or nullptr if has no super class. const char* m_name; ///< Textual class name, for debugging - CreateFunc m_createFunc; ///< Callback to use when creating instances - DestroyFunc m_destroyFunc; ///< Called to inplace destroy (ie not backing memory) of this type + CreateFunc m_createFunc; ///< Callback to use when creating instances (using an ASTBuilder for backing memory) + DestructorFunc m_destructorFunc; ///< The destructor for this type. Being just destructor, does not free backing memory for type. struct Infos { @@ -510,8 +510,6 @@ namespace Slang // used to create instances on the fly struct SyntaxClassBase { - typedef void* (*CreateFunc)(); - SyntaxClassBase() {} diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 7adda8c77..17bd5e263 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -1327,7 +1327,6 @@ namespace Slang InitializerListExpr* initListExpr = m_astBuilder->create<InitializerListExpr>(); auto checkedInitListExpr = visitInitializerListExpr(initListExpr); - // TODO(JS): I changed this to checkInitListExpr form initListExpr return coerce(typeExp.type, checkedInitListExpr); } } diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index b6e0264be..72965e8c5 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -919,18 +919,17 @@ namespace Slang DeclRef<Decl> declRef; }; - // Create a subtype witness based on the declared relationship - // found in a single breadcrumb + // Create a subtype witness based on the declared relationship + // found in a single breadcrumb DeclaredSubtypeWitness* createSimpleSubtypeWitness( TypeWitnessBreadcrumb* breadcrumb); - /// Create a withness that `subType` is a sub-type of `superTypeDeclRef`. - /// - /// The `inBreadcrumbs` parameter represents a linked list of steps - /// in the process that validated the sub-type relationship, which - /// will be used to inform the construction of the witness. - /// - + /// Create a witness that `subType` is a sub-type of `superTypeDeclRef`. + /// + /// The `inBreadcrumbs` parameter represents a linked list of steps + /// in the process that validated the sub-type relationship, which + /// will be used to inform the construction of the witness. + /// Val* createTypeWitness( Type* subType, DeclRef<AggTypeDecl> superTypeDeclRef, diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp index 4af6a4328..ab1c7f580 100644 --- a/source/slang/slang-check-shader.cpp +++ b/source/slang/slang-check-shader.cpp @@ -1456,9 +1456,6 @@ namespace Slang { auto sink = endToEndReq->getSink(); - // TODO(JS): Not used - //auto entryPointFuncDecl = unspecializedEntryPoint->getFuncDecl(); - // If the user specified generic arguments for the entry point, // then we will need to parse the arguments first. // |
