From c985f5f2f95dc95998fdfb8400baa0a04760ada2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 5 Nov 2020 13:43:00 -0500 Subject: Standard library save/loadable (#1592) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix handling of access modifiers inside type definition. * Fix access problem for AST node. Make dumping produce a single function with switch, to potentially make available without Dump specific access. * WIP on serialization design doc. * Remove project references to previously generated files. * More docs on serialization design. * Improve serialization documentation. Remove unused function from IRSerialReader. * Small fixes around naming. Remove long comment from slang-serialize.h - as covered in serialization.md * Remove long comment in slang-serialize.h as covered in serialization.md * More information about doing replacements on read for AST and problems surrounding. * Typo fix. * Spelling fixes. * Value serialize. * Value types with inheritence. * Use value reflection serial conversion for more AST types * Use automatic serialization on more of AST. * Get the types via decltype, simplifies what the extractor has to do. * Update the serialization.md for the value serialization. * Small doc improvements. * Update project. * Remove ImportExternalDecl type Added addImportSymbol and ImportSymbol type Fixed bug in container which meant it wouldn't read back AST module * Because of change of how imports and handled, store objects as SerialPointers. * First pass symbol lookup from mangled names. * Cache current module looked up from mangled name. * Fix SourceLoc bug. Improve comments. * Added diagnostic on mangled symbol not being found * Fix typo. * WIP serializing stdlib. * WIP serializing stdlib in. * Fix problem serializing arrays that hold data that is already serialized. * Remove clash of names in MagicTypeModifier. * Make conversion from char to String explicit. Fix reference count issue with SerialReader. * Add code to save/load stdlib. * Use return code to avoid warning - SerialContainerUtil::write(module, options, &stream)) * Make all String numeric ctors explicit. Added isChar to UnownedStringSlice. Added operator== for UnownedStringSlice to String to avoid need to convert to String and allocate. * Add error check to readAllText. * tabs -> spaces on String.h * tab -> spaces String.cpp * Remove msg for StringBuilder, just build inplace for exceptions. * Check SerialClasses - for name clashes. Renamed Modifier::name as Modifier::keywordName * Handling of extensions when deserializing AST - updating the moduleDecl->mapTypeToCandidateExtensions Co-authored-by: Tim Foley --- source/slang/slang-parser.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-parser.cpp') diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index e02ccf245..4d93c35a8 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -730,7 +730,7 @@ namespace Slang Token nameToken = parseAttributeName(parser); UncheckedAttribute* modifier = parser->astBuilder->create(); - modifier->name = nameToken.getName(); + modifier->keywordName = nameToken.getName(); modifier->loc = nameToken.getLoc(); modifier->scope = parser->currentScope; @@ -903,7 +903,7 @@ namespace Slang Modifier* parsedModifier = nullptr; if (tryParseUsingSyntaxDecl(parser, &parsedModifier)) { - parsedModifier->name = nameToken.getName(); + parsedModifier->keywordName = nameToken.getName(); if (!parsedModifier->loc.isValid()) { parsedModifier->loc = nameToken.loc; @@ -5504,7 +5504,7 @@ namespace Slang numThreadsAttrib->args.setCount(3); // Just mark the loc and name from the first in the list - numThreadsAttrib->name = getName(parser, "numthreads"); + numThreadsAttrib->keywordName = getName(parser, "numthreads"); numThreadsAttrib->loc = nameAndLoc.loc; numThreadsAttrib->scope = parser->currentScope; } @@ -5566,7 +5566,7 @@ namespace Slang SLANG_ASSERT(modifier); #undef CASE - modifier->name = nameAndLoc.name; + modifier->keywordName = nameAndLoc.name; modifier->loc = nameAndLoc.loc; // Special handling for GLSLLayoutModifier @@ -5610,7 +5610,7 @@ namespace Slang { MagicTypeModifier* modifier = parser->astBuilder->create(); parser->ReadToken(TokenType::LParent); - modifier->name = parser->ReadToken(TokenType::Identifier).getContent(); + modifier->magicName = parser->ReadToken(TokenType::Identifier).getContent(); if (AdvanceIf(parser, TokenType::Comma)) { modifier->tag = uint32_t(StringToInt(parser->ReadToken(TokenType::IntegerLiteral).getContent())); -- cgit v1.2.3