From 5df582dd3229789364ae3fa75575fd978ca3282d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 4 Dec 2019 12:38:38 -0500 Subject: Feature/string hash review (#1142) * * Added ConstArrayView * Made StringSlicePool have styles * Remove point about strings not having terminating 0 (they do), and restriction around "" * spCalcStringHash -> spComputeStringHash * Small code improvements. Closer to coding conventions. * Fix small bug with Empty adding c string. * Fix typo in assert. * Fix ArrayView compiling issue on gcc/clang. * Remove tabs. * Improve comments around StringSlicePool. Simplify getting the added slices. --- source/slang/slang-ir-serialize.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir-serialize.cpp') diff --git a/source/slang/slang-ir-serialize.cpp b/source/slang/slang-ir-serialize.cpp index a6ed35cc6..5d78f76f8 100644 --- a/source/slang/slang-ir-serialize.cpp +++ b/source/slang/slang-ir-serialize.cpp @@ -85,9 +85,12 @@ void IRSerialWriter::_addDebugSourceLocRun(SourceLoc sourceLoc, uint32_t startIn adjustedLineInfo.m_lineInfo = lineInfo; adjustedLineInfo.m_pathStringIndex = Ser::kNullStringIndex; - if (StringSlicePool::hasContents(entry.m_pathHandle)) + const auto& pool = sourceView->getSourceManager()->getStringSlicePool(); + SLANG_ASSERT(pool.getStyle() == StringSlicePool::Style::Default); + + if (!pool.isDefaultHandle(entry.m_pathHandle)) { - UnownedStringSlice slice = sourceView->getSourceManager()->getStringSlicePool().getSlice(entry.m_pathHandle); + UnownedStringSlice slice = pool.getSlice(entry.m_pathHandle); SLANG_ASSERT(slice.size() > 0); adjustedLineInfo.m_pathStringIndex = Ser::StringIndex(m_debugStringSlicePool.add(slice)); } -- cgit v1.2.3