From 85f858c6d1b91fd2ed89844aae7535a48e51a4c8 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 23 Oct 2019 10:25:11 -0400 Subject: Documentation around Relative types (#1089) * * Added comments/documentation to better describe Relative/Safe types and usage * Renamed allocate methods to newObject/newArray on RelativeContainer. * Fix error introduced from automatic merge. --- source/slang/slang-state-serialize.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'source/slang') diff --git a/source/slang/slang-state-serialize.cpp b/source/slang/slang-state-serialize.cpp index 110ea52b2..cbcce6c3a 100644 --- a/source/slang/slang-state-serialize.cpp +++ b/source/slang/slang-state-serialize.cpp @@ -42,7 +42,7 @@ struct StoreContext // If file was not found create it // Create the file - file = m_container->allocate(); + file = m_container->newObject(); if (content) { @@ -86,7 +86,7 @@ struct StoreContext file->foundPath = foundPath; // Create the source file - sourceFileState = m_container->allocate(); + sourceFileState = m_container->newObject(); sourceFileState->file = file; sourceFileState->foundPath = foundPath; @@ -138,7 +138,7 @@ struct StoreContext } // Save the rest of the state - pathInfo = m_container->allocate(); + pathInfo = m_container->newObject(); PathInfoState& dst = *pathInfo; pathInfo->file = fileState; @@ -182,7 +182,7 @@ struct StoreContext { typedef StateSerializeUtil::StringPair StringPair; - Safe32Array dstDefines = m_container->allocateArray(srcDefines.Count()); + Safe32Array dstDefines = m_container->newArray(srcDefines.Count()); Index index = 0; for (const auto& srcDefine : srcDefines) @@ -203,7 +203,7 @@ struct StoreContext const Safe32Array> fromList(const List& src) { - Safe32Array> dst = m_container->allocateArray>(src.getCount()); + Safe32Array> dst = m_container->newArray>(src.getCount()); for (Index j = 0; j < src.getCount(); ++j) { dst[j] = fromString(src[j]); @@ -247,7 +247,7 @@ static bool _isStorable(const PathInfo::Type type) auto linkage = request->getLinkage(); - Safe32Ptr requestState = inOutContainer.allocate(); + Safe32Ptr requestState = inOutContainer.newObject(); { RequestState* dst = requestState; @@ -275,7 +275,7 @@ static bool _isStorable(const PathInfo::Type type) SLANG_ASSERT(srcEntryPoints.getCount() == srcEndToEndEntryPoints.getCount()); - Safe32Array dstEntryPoints = inOutContainer.allocateArray(srcEntryPoints.getCount()); + Safe32Array dstEntryPoints = inOutContainer.newArray(srcEntryPoints.getCount()); for (Index i = 0; i < srcEntryPoints.getCount(); ++i) { @@ -314,7 +314,7 @@ static bool _isStorable(const PathInfo::Type type) // Add all the target requests { - Safe32Array dstTargets = inOutContainer.allocateArray(linkage->targets.getCount()); + Safe32Array dstTargets = inOutContainer.newArray(linkage->targets.getCount()); for (Index i = 0; i < linkage->targets.getCount(); ++i) { @@ -339,8 +339,7 @@ static bool _isStorable(const PathInfo::Type type) const auto& entryPointOutputPaths = infos->entryPointOutputPaths; - Safe32Array dstOutputStates; - dstOutputStates = inOutContainer.allocateArray(entryPointOutputPaths.Count()); + Safe32Array dstOutputStates = inOutContainer.newArray(entryPointOutputPaths.Count()); Index index = 0; for (const auto& pair : entryPointOutputPaths) @@ -367,7 +366,7 @@ static bool _isStorable(const PathInfo::Type type) // Add the search paths { const auto& srcPaths = linkage->searchDirectories.searchDirectories; - Safe32Array > dstPaths = inOutContainer.allocateArray >(srcPaths.getCount()); + Safe32Array > dstPaths = inOutContainer.newArray >(srcPaths.getCount()); // We don't handle parents here SLANG_ASSERT(linkage->searchDirectories.parent == nullptr); @@ -383,7 +382,7 @@ static bool _isStorable(const PathInfo::Type type) { const auto& srcTranslationUnits = request->getFrontEndReq()->translationUnits; - Safe32Array dstTranslationUnits = inOutContainer.allocateArray(srcTranslationUnits.getCount()); + Safe32Array dstTranslationUnits = inOutContainer.newArray(srcTranslationUnits.getCount()); for (Index i = 0; i < srcTranslationUnits.getCount(); ++i) { @@ -396,7 +395,7 @@ static bool _isStorable(const PathInfo::Type type) Safe32Array> dstSourceFiles; { const auto& srcFiles = srcTranslationUnit->getSourceFiles(); - dstSourceFiles = inOutContainer.allocateArray >(srcFiles.getCount()); + dstSourceFiles = inOutContainer.newArray >(srcFiles.getCount()); for (Index j = 0; j < srcFiles.getCount(); ++j) { @@ -427,7 +426,7 @@ static bool _isStorable(const PathInfo::Type type) { const auto& srcFiles = cacheFileSystem->getPathMap(); - Safe32Array pathMap = inOutContainer.allocateArray(srcFiles.Count()); + Safe32Array pathMap = inOutContainer.newArray(srcFiles.Count()); Index index = 0; for (const auto& pair : srcFiles) @@ -450,7 +449,7 @@ static bool _isStorable(const PathInfo::Type type) { Dictionary uniqueNameMap; - auto files = inOutContainer.allocateArray>(context.m_files.getCount()); + auto files = inOutContainer.newArray>(context.m_files.getCount()); for (Index i = 0; i < context.m_files.getCount(); ++i) { Safe32Ptr file = context.m_files[i]; @@ -517,7 +516,7 @@ static bool _isStorable(const PathInfo::Type type) // Save all the SourceFile state { const auto& srcSourceFiles = context.m_sourceFileMap; - auto dstSourceFiles = inOutContainer.allocateArray>(srcSourceFiles.Count()); + auto dstSourceFiles = inOutContainer.newArray>(srcSourceFiles.Count()); Index index = 0; for (const auto& pair : srcSourceFiles) -- cgit v1.2.3