diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-07-09 16:29:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-09 16:29:23 -0400 |
| commit | 7b447bdad29c828b49ba63cefacc677bd7c58b28 (patch) | |
| tree | bb69105c92241b0b8296961cc0a301134a854bbf /source/slang/slang-check-shader.cpp | |
| parent | fa565f96823f3985cffa3a899742fdf1449d5876 (diff) | |
Make Scope non ref counted (#1904)
* Add debug symbols for release build.
* Hack to try and capture failing compilation.
* Typo fix for capture hack.
* Specify return type on lambdas.
* Added const.
* Try breakpoint.
* Up count
* Let's capture everything so we can valgrind.
* Disable always writing repros.
* Make Scope non RefCounted.
* Fix issue with not serializing Scope.
* More comments around changes to Scope.
Remove Scope* from serialization.
* Remove code used for testing original issue.
Diffstat (limited to 'source/slang/slang-check-shader.cpp')
| -rw-r--r-- | source/slang/slang-check-shader.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp index b6ed0224a..025a47c1b 100644 --- a/source/slang/slang-check-shader.cpp +++ b/source/slang/slang-check-shader.cpp @@ -1297,7 +1297,7 @@ namespace Slang sink); } - RefPtr<Scope> ComponentType::_createScopeForLegacyLookup() + Scope* ComponentType::_createScopeForLegacyLookup(ASTBuilder* astBuilder) { // The shape of this logic is dictated by the legacy // behavior for name-based lookup/parsing of types @@ -1308,7 +1308,8 @@ namespace Slang // definitions (that scope is necessary because // it defines keywords like `true` and `false`). // - RefPtr<Scope> scope = new Scope(); + + Scope* scope = astBuilder->create<Scope>(); scope->parent = getLinkage()->getSessionImpl()->slangLanguageScope; // // Next, the scope needs to include all of the @@ -1317,7 +1318,7 @@ namespace Slang // for( auto module : getModuleDependencies() ) { - RefPtr<Scope> moduleScope = new Scope(); + Scope* moduleScope = astBuilder->create<Scope>(); moduleScope->containerDecl = module->getModuleDecl(); moduleScope->nextSibling = scope->nextSibling; @@ -1339,8 +1340,12 @@ namespace Slang { auto unspecialiedProgram = endToEndReq->getUnspecializedGlobalComponentType(); - - RefPtr<Scope> scope = unspecialiedProgram->_createScopeForLegacyLookup(); + // TODO(JS): + // + // We create the scopes on the linkages ASTBuilder. We might want to create a temporary ASTBuilder, + // and let that memory get freed, but is like this because it's not clear if the scopes in ASTNode members + // will dangle if we do. + Scope* scope = unspecialiedProgram->_createScopeForLegacyLookup(endToEndReq->getLinkage()->getASTBuilder()); // We are going to do some semantic checking, so we need to // set up a `SemanticsVistitor` that we can use. |
