summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-03-02 19:14:18 -0500
committerGitHub <noreply@github.com>2020-03-02 19:14:18 -0500
commitcbba1f2ba451f31e910d59fb9efbadc5e370c095 (patch)
treecf34d86713e2f915a42ce4ece11b7da82b9d4454
parentdbd8e8dc0847338a2a93d35385f48b5ce5671dd6 (diff)
Renamed UnownedStringSlice::size to getLength to make match String. (#1254)
-rw-r--r--source/core/slang-gcc-compiler-util.cpp2
-rw-r--r--source/core/slang-hex-dump-util.cpp4
-rw-r--r--source/core/slang-io.cpp10
-rw-r--r--source/core/slang-nvrtc-compiler.cpp2
-rw-r--r--source/core/slang-offset-container.cpp4
-rw-r--r--source/core/slang-render-api-util.cpp2
-rw-r--r--source/core/slang-string-slice-pool.cpp2
-rw-r--r--source/core/slang-string-util.cpp2
-rw-r--r--source/core/slang-string.cpp8
-rw-r--r--source/core/slang-string.h6
-rw-r--r--source/core/slang-type-text-util.cpp4
-rw-r--r--source/core/slang-visual-studio-compiler-util.cpp2
-rw-r--r--source/core/slang-writer.cpp2
-rw-r--r--source/slang/slang-compiler.cpp2
-rw-r--r--source/slang/slang-diagnostics.cpp2
-rw-r--r--source/slang/slang-emit-c-like.cpp2
-rw-r--r--source/slang/slang-emit-cpp.cpp14
-rw-r--r--source/slang/slang-emit-cuda.cpp4
-rw-r--r--source/slang/slang-emit-glsl.cpp2
-rw-r--r--source/slang/slang-emit-hlsl.cpp2
-rw-r--r--source/slang/slang-hlsl-intrinsic-set.cpp4
-rw-r--r--source/slang/slang-ir-legalize-types.cpp4
-rw-r--r--source/slang/slang-ir-serialize-types.cpp4
-rw-r--r--source/slang/slang-ir-serialize.cpp4
-rw-r--r--source/slang/slang-ir.cpp6
-rw-r--r--source/slang/slang-lower-to-ir.cpp2
-rw-r--r--source/slang/slang-mangle.cpp2
-rw-r--r--source/slang/slang-parameter-binding.cpp14
-rw-r--r--source/slang/slang-reflection.cpp4
-rw-r--r--source/slang/slang-source-loc.cpp2
-rw-r--r--source/slang/slang-state-serialize.cpp2
-rw-r--r--tools/gfx/d3d/d3d-util.cpp2
-rw-r--r--tools/render-test/options.cpp2
-rw-r--r--tools/slang-generate/main.cpp2
-rw-r--r--tools/slang-test/slang-test-main.cpp6
35 files changed, 69 insertions, 69 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp
index 833ae884e..08e45b5c1 100644
--- a/source/core/slang-gcc-compiler-util.cpp
+++ b/source/core/slang-gcc-compiler-util.cpp
@@ -20,7 +20,7 @@ namespace Slang
{
if (line.startsWith(prefix))
{
- const UnownedStringSlice remainingSlice = UnownedStringSlice(line.begin() + prefix.size(), line.end()).trim();
+ const UnownedStringSlice remainingSlice = UnownedStringSlice(line.begin() + prefix.getLength(), line.end()).trim();
const Index versionEndIndex = remainingSlice.indexOf(' ');
if (versionEndIndex < 0)
{
diff --git a/source/core/slang-hex-dump-util.cpp b/source/core/slang-hex-dump-util.cpp
index b0bd6f923..69c6d3f21 100644
--- a/source/core/slang-hex-dump-util.cpp
+++ b/source/core/slang-hex-dump-util.cpp
@@ -23,7 +23,7 @@ static const char s_hex[] = "0123456789abcdef";
/* static */SlangResult HexDumpUtil::dumpWithMarkers(const uint8_t* data, size_t dataCount, int maxBytesPerLine, ISlangWriter* writer)
{
WriterHelper helper(writer);
- SLANG_RETURN_ON_FAIL(helper.write(s_start.begin(), s_start.size()));
+ SLANG_RETURN_ON_FAIL(helper.write(s_start.begin(), s_start.getLength()));
SLANG_RETURN_ON_FAIL(helper.print(" %zu", dataCount));
const int hash = GetHashCode((const char*)data, dataCount);
@@ -31,7 +31,7 @@ static const char s_hex[] = "0123456789abcdef";
SLANG_RETURN_ON_FAIL(dump(data, dataCount, maxBytesPerLine, writer));
- SLANG_RETURN_ON_FAIL(helper.write(s_end.begin(), s_end.size()));
+ SLANG_RETURN_ON_FAIL(helper.write(s_end.begin(), s_end.getLength()));
SLANG_RETURN_ON_FAIL(helper.put("\n"));
return SLANG_OK;
}
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp
index 6cff8e1c9..e02bbb89f 100644
--- a/source/core/slang-io.cpp
+++ b/source/core/slang-io.cpp
@@ -235,7 +235,7 @@ namespace Slang
ioBuilder.append(path);
return;
}
- if (path.size() > 0)
+ if (path.getLength() > 0)
{
// If ioBuilder doesn't end in a delimiter, add one
if (!isDelimiter(ioBuilder[ioBuilder.getLength() - 1]))
@@ -278,7 +278,7 @@ namespace Slang
/* static */ bool Path::isDriveSpecification(const UnownedStringSlice& element)
{
- switch (element.size())
+ switch (element.getLength())
{
case 0:
{
@@ -306,14 +306,14 @@ namespace Slang
/* static */bool Path::isAbsolute(const UnownedStringSlice& path)
{
- if (path.size() > 0 && isDelimiter(path[0]))
+ if (path.getLength() > 0 && isDelimiter(path[0]))
{
return true;
}
#if SLANG_WINDOWS_FAMILY
// Check for the \\ network drive style
- if (path.size() >= 2 && path[0] == '\\' && path[1] == '\\')
+ if (path.getLength() >= 2 && path[0] == '\\' && path[1] == '\\')
{
return true;
}
@@ -348,7 +348,7 @@ namespace Slang
}
// Okay if the end is empty. And we aren't with a spec like // or c:/ , then drop the final slash
- if (splitOut.getCount() > 1 && splitOut.getLast().size() == 0)
+ if (splitOut.getCount() > 1 && splitOut.getLast().getLength() == 0)
{
if (splitOut.getCount() == 2 && isDriveSpecification(splitOut[0]))
{
diff --git a/source/core/slang-nvrtc-compiler.cpp b/source/core/slang-nvrtc-compiler.cpp
index 27d269125..2f9944786 100644
--- a/source/core/slang-nvrtc-compiler.cpp
+++ b/source/core/slang-nvrtc-compiler.cpp
@@ -181,7 +181,7 @@ static bool _isDriveLetter(char c)
static bool _hasDriveLetter(const UnownedStringSlice& line)
{
- return line.size() > 2 && line[1] == ':' && _isDriveLetter(line[0]);
+ return line.getLength() > 2 && line[1] == ':' && _isDriveLetter(line[0]);
}
static SlangResult _parseNVRTCLine(const UnownedStringSlice& line, DownstreamDiagnostic& outDiagnostic)
diff --git a/source/core/slang-offset-container.cpp b/source/core/slang-offset-container.cpp
index 5fed2a452..75852c990 100644
--- a/source/core/slang-offset-container.cpp
+++ b/source/core/slang-offset-container.cpp
@@ -79,7 +79,7 @@ size_t OffsetString::calcEncodedSize(size_t size, uint8_t encode[kMaxSizeEncodeS
/* static */size_t OffsetString::calcAllocationSize(const UnownedStringSlice& slice)
{
- return calcAllocationSize(slice.size());
+ return calcAllocationSize(slice.getLength());
}
UnownedStringSlice OffsetString::getSlice() const
@@ -166,7 +166,7 @@ void* OffsetContainer::allocateAndZero(size_t size, size_t alignment)
Offset32Ptr<OffsetString> OffsetContainer::newString(const UnownedStringSlice& slice)
{
- size_t stringSize = slice.size();
+ size_t stringSize = slice.getLength();
uint8_t head[OffsetString::kMaxSizeEncodeSize];
size_t headSize = OffsetString::calcEncodedSize(stringSize, head);
diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp
index 960537a0b..edf8c13ca 100644
--- a/source/core/slang-render-api-util.cpp
+++ b/source/core/slang-render-api-util.cpp
@@ -122,7 +122,7 @@ enum class Token
static Token nextToken(Slang::UnownedStringSlice& textInOut, Slang::UnownedStringSlice& lexemeOut)
{
using namespace Slang;
- if (textInOut.size() <= 0)
+ if (textInOut.getLength() <= 0)
{
return Token::eEnd;
}
diff --git a/source/core/slang-string-slice-pool.cpp b/source/core/slang-string-slice-pool.cpp
index 7ea15e0d6..be7bec785 100644
--- a/source/core/slang-string-slice-pool.cpp
+++ b/source/core/slang-string-slice-pool.cpp
@@ -50,7 +50,7 @@ StringSlicePool::Handle StringSlicePool::add(const Slice& slice)
}
// Create a scoped copy
- UnownedStringSlice scopePath(m_arena.allocateString(slice.begin(), slice.size()), slice.size());
+ UnownedStringSlice scopePath(m_arena.allocateString(slice.begin(), slice.getLength()), slice.getLength());
const auto index = m_slices.getCount();
diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp
index cd79ffce7..32f017f46 100644
--- a/source/core/slang-string-util.cpp
+++ b/source/core/slang-string-util.cpp
@@ -208,7 +208,7 @@ ComPtr<ISlangBlob> StringUtil::createStringBlob(const String& string)
return slice;
}
- const Index numChars = slice.size();
+ const Index numChars = slice.getLength();
const char* srcChars = slice.begin();
StringBuilder builder;
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp
index 22049f82d..df711218c 100644
--- a/source/core/slang-string.cpp
+++ b/source/core/slang-string.cpp
@@ -74,8 +74,8 @@ namespace Slang
bool UnownedStringSlice::startsWith(UnownedStringSlice const& other) const
{
- UInt thisSize = size();
- UInt otherSize = other.size();
+ UInt thisSize = getLength();
+ UInt otherSize = other.getLength();
if (otherSize > thisSize)
return false;
@@ -91,8 +91,8 @@ namespace Slang
bool UnownedStringSlice::endsWith(UnownedStringSlice const& other) const
{
- UInt thisSize = size();
- UInt otherSize = other.size();
+ UInt thisSize = getLength();
+ UInt otherSize = other.getLength();
if (otherSize > thisSize)
return false;
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index 357eb726e..3fb612af3 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -93,7 +93,7 @@ namespace Slang
return m_end;
}
- Index size() const
+ Index getLength() const
{
return Index(m_end - m_begin);
}
@@ -134,8 +134,8 @@ namespace Slang
// Note that memcmp is undefined when passed in null ptrs, so if we want to handle
// we need to cover that case.
// Can only be nullptr if size is 0.
- auto thisSize = size();
- auto otherSize = other.size();
+ auto thisSize = getLength();
+ auto otherSize = other.getLength();
if (thisSize != otherSize)
{
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp
index 376efe0a9..8db294cdb 100644
--- a/source/core/slang-type-text-util.cpp
+++ b/source/core/slang-type-text-util.cpp
@@ -193,7 +193,7 @@ static const CompileTargetInfo s_compileTargetInfos[] =
/* static */SlangCompileTarget TypeTextUtil::findCompileTargetFromExtension(const UnownedStringSlice& slice)
{
- if (slice.size())
+ if (slice.getLength())
{
for (const auto& info : s_compileTargetInfos)
{
@@ -208,7 +208,7 @@ static const CompileTargetInfo s_compileTargetInfos[] =
/* static */ SlangCompileTarget TypeTextUtil::findCompileTargetFromName(const UnownedStringSlice& slice)
{
- if (slice.size())
+ if (slice.getLength())
{
for (const auto& info : s_compileTargetInfos)
{
diff --git a/source/core/slang-visual-studio-compiler-util.cpp b/source/core/slang-visual-studio-compiler-util.cpp
index 8dcc97654..af05c9c95 100644
--- a/source/core/slang-visual-studio-compiler-util.cpp
+++ b/source/core/slang-visual-studio-compiler-util.cpp
@@ -291,7 +291,7 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, Downst
outDiagnostic.stage = Diagnostic::Stage::Link;
outDiagnostic.type = Diagnostic::Type::Info;
- outDiagnostic.text = UnownedStringSlice(line.begin() + linkPrefix.size(), line.end());
+ outDiagnostic.text = UnownedStringSlice(line.begin() + linkPrefix.getLength(), line.end());
return SLANG_OK;
}
diff --git a/source/core/slang-writer.cpp b/source/core/slang-writer.cpp
index 0688bea6c..0f8286553 100644
--- a/source/core/slang-writer.cpp
+++ b/source/core/slang-writer.cpp
@@ -59,7 +59,7 @@ SlangResult WriterHelper::put(const char* text)
SlangResult WriterHelper::put(const UnownedStringSlice& text)
{
- return m_writer->write(text.begin(), text.size());
+ return m_writer->write(text.begin(), text.getLength());
}
/* !!!!!!!!!!!!!!!!!!!!!!!!! BaseWriter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 9797b1f1f..4880cc49d 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -695,7 +695,7 @@ namespace Slang
PlatformUtil::appendResult(res, builder);
}
- if (diagnostic.size() > 0)
+ if (diagnostic.getLength() > 0)
{
builder.Append(diagnostic);
if (!diagnostic.endsWith("\n"))
diff --git a/source/slang/slang-diagnostics.cpp b/source/slang/slang-diagnostics.cpp
index be799c3bd..99cae490e 100644
--- a/source/slang/slang-diagnostics.cpp
+++ b/source/slang/slang-diagnostics.cpp
@@ -328,7 +328,7 @@ void DiagnosticSink::diagnoseRaw(
if(writer)
{
// If so, pass the error string along to them
- writer->write(message.begin(), message.size());
+ writer->write(message.begin(), message.getLength());
}
else
{
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 538ef369a..779e7eb25 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -373,7 +373,7 @@ bool CLikeSourceEmitter::isTargetIntrinsicModifierBetter(IRTargetIntrinsicDecora
// good) as `existing`.
//
SLANG_UNUSED(existing);
- return candidate->getTargetName().size() != 0;
+ return candidate->getTargetName().getLength() != 0;
}
void CLikeSourceEmitter::emitStringLiteral(String const& value)
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index 945c070d1..4c2e6032d 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -433,7 +433,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
UnownedStringSlice postFix = _getCTypeVecPostFix(elemType->op);
out << postFix;
- if (postFix.size() > 1)
+ if (postFix.getLength() > 1)
{
out << "_";
}
@@ -458,7 +458,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
out << "Mat";
const UnownedStringSlice postFix = _getCTypeVecPostFix(_getCType(elementType->op));
out << postFix;
- if (postFix.size() > 1)
+ if (postFix.getLength() > 1)
{
out << "_";
}
@@ -514,7 +514,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
// If _getResourceTypePrefix returns something, we assume can output any specialization after it in order.
{
UnownedStringSlice prefix = _getResourceTypePrefix(type->op);
- if (prefix.size() > 0)
+ if (prefix.getLength() > 0)
{
auto oldWriter = m_writer;
SourceManager* sourceManager = oldWriter->getSourceManager();
@@ -653,7 +653,7 @@ static IRBasicType* _getElementType(IRType* type)
static bool _isOperator(const UnownedStringSlice& funcName)
{
- if (funcName.size() > 0)
+ if (funcName.getLength() > 0)
{
const char c = funcName[0];
return !((c >= 'a' && c <='z') || (c >= 'A' && c <= 'Z') || c == '_');
@@ -665,7 +665,7 @@ void CPPSourceEmitter::_emitAryDefinition(const HLSLIntrinsic* specOp)
{
auto info = HLSLIntrinsic::getInfo(specOp->op);
auto funcName = info.funcName;
- SLANG_ASSERT(funcName.size() > 0);
+ SLANG_ASSERT(funcName.getLength() > 0);
const bool isOperator = _isOperator(funcName);
@@ -1700,7 +1700,7 @@ SlangResult CPPSourceEmitter::calcFuncName(const HLSLIntrinsic* specOp, StringBu
}
const auto& info = HLSLIntrinsic::getInfo(specOp->op);
- if (info.funcName.size())
+ if (info.funcName.getLength())
{
if (!_isOperator(info.funcName))
{
@@ -2518,7 +2518,7 @@ void CPPSourceEmitter::_emitInitAxisValues(const Int sizeAlongAxis[kThreadGroupA
builder.Clear();
const char elem[2] = { s_elemNames[i], 0 };
builder << mulName << "." << elem << " * " << sizeAlongAxis[i];
- if (addName.size() > 0)
+ if (addName.getLength() > 0)
{
builder << " + " << addName << "." << elem;
}
diff --git a/source/slang/slang-emit-cuda.cpp b/source/slang/slang-emit-cuda.cpp
index 262a67784..3531d55db 100644
--- a/source/slang/slang-emit-cuda.cpp
+++ b/source/slang/slang-emit-cuda.cpp
@@ -161,7 +161,7 @@ SlangResult CUDASourceEmitter::calcScalarFuncName(HLSLIntrinsic::Op op, IRBasicT
default: break;
}
- if (funcName.size())
+ if (funcName.getLength())
{
outBuilder << funcName;
if (type->op == kIROp_FloatType)
@@ -219,7 +219,7 @@ SlangResult CUDASourceEmitter::calcTypeName(IRType* type, CodeGenTarget target,
const IROp elemType = vecType->getElementType()->op;
UnownedStringSlice prefix = getVectorPrefix(elemType);
- if (prefix.size() <= 0)
+ if (prefix.getLength() <= 0)
{
return SLANG_FAIL;
}
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index cd11e2ac4..ae7a4130f 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1609,7 +1609,7 @@ void GLSLSourceEmitter::emitInterpolationModifiersImpl(IRInst* varInst, IRType*
auto decoration = (IRInterpolationModeDecoration*)dd;
const UnownedStringSlice slice = _getInterpolationModifierText(decoration->getMode());
- if (slice.size())
+ if (slice.getLength())
{
m_writer->emit(slice);
m_writer->emitChar(' ');
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 1d4b6a317..a0e6e872d 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -773,7 +773,7 @@ void HLSLSourceEmitter::emitInterpolationModifiersImpl(IRInst* varInst, IRType*
auto decoration = (IRInterpolationModeDecoration*)dd;
UnownedStringSlice modeText = _getInterpolationModifierText(decoration->getMode());
- if (modeText.size() > 0)
+ if (modeText.getLength() > 0)
{
m_writer->emit(modeText);
m_writer->emitChar(' ');
diff --git a/source/slang/slang-hlsl-intrinsic-set.cpp b/source/slang/slang-hlsl-intrinsic-set.cpp
index 7500e799a..936181d83 100644
--- a/source/slang/slang-hlsl-intrinsic-set.cpp
+++ b/source/slang/slang-hlsl-intrinsic-set.cpp
@@ -401,7 +401,7 @@ HLSLIntrinsicOpLookup::HLSLIntrinsicOpLookup():
const auto& info = HLSLIntrinsic::getInfo(Op(i));
UnownedStringSlice slice = info.funcName;
- if (slice.size() > 0 && slice[0] >= 'a' && slice[0] <= 'z')
+ if (slice.getLength() > 0 && slice[0] >= 'a' && slice[0] <= 'z')
{
auto handle = m_slicePool.add(slice);
Index index = Index(handle);
@@ -478,7 +478,7 @@ HLSLIntrinsic::Op HLSLIntrinsicOpLookup::getOpFromTargetDecoration(IRInst* inIns
// original HLSL name, which has a target of ""
//
// It's not 100% clear this covers all the cases, but for now lets go with that
- if (decor->getTargetName().size() == 0)
+ if (decor->getTargetName().getLength() == 0)
{
Op op = getOpByName(decor->getDefinition());
if (op != Op::Invalid)
diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp
index f9c78a021..3a1471f98 100644
--- a/source/slang/slang-ir-legalize-types.cpp
+++ b/source/slang/slang-ir-legalize-types.cpp
@@ -1652,7 +1652,7 @@ static LegalVal declareSimpleVar(
builder->addLayoutDecoration(irVar, varLayout);
}
- if( nameHint.size() )
+ if( nameHint.getLength() )
{
context->builder->addNameHintDecoration(irVar, nameHint);
}
@@ -2308,7 +2308,7 @@ static LegalVal declareVars(
UnownedStringSlice fieldNameHint;
String joinedNameHintStorage;
- if( nameHint.size() )
+ if( nameHint.getLength() )
{
if( auto fieldNameHintDecoration = ee.key->findDecoration<IRNameHintDecoration>() )
{
diff --git a/source/slang/slang-ir-serialize-types.cpp b/source/slang/slang-ir-serialize-types.cpp
index 10e2776b2..a9d9baae0 100644
--- a/source/slang/slang-ir-serialize-types.cpp
+++ b/source/slang/slang-ir-serialize-types.cpp
@@ -176,7 +176,7 @@ StringRepresentation* StringRepresentationCache::getStringRepresentation(Handle
}
const UnownedStringSlice slice = getStringSlice(handle);
- const UInt size = slice.size();
+ const UInt size = slice.getLength();
StringRepresentation* stringRep = StringRepresentation::createWithCapacityAndLength(size, size);
memcpy(stringRep->getData(), slice.begin(), size);
@@ -208,7 +208,7 @@ char* StringRepresentationCache::getCStr(Handle handle)
stringTable.clear();
for (const auto& slice : slices)
{
- const int len = int(slice.size());
+ const int len = int(slice.getLength());
// We need to write into the the string array
char prefixBytes[6];
diff --git a/source/slang/slang-ir-serialize.cpp b/source/slang/slang-ir-serialize.cpp
index 5d78f76f8..4588816f7 100644
--- a/source/slang/slang-ir-serialize.cpp
+++ b/source/slang/slang-ir-serialize.cpp
@@ -91,7 +91,7 @@ void IRSerialWriter::_addDebugSourceLocRun(SourceLoc sourceLoc, uint32_t startIn
if (!pool.isDefaultHandle(entry.m_pathHandle))
{
UnownedStringSlice slice = pool.getSlice(entry.m_pathHandle);
- SLANG_ASSERT(slice.size() > 0);
+ SLANG_ASSERT(slice.getLength() > 0);
adjustedLineInfo.m_pathStringIndex = Ser::StringIndex(m_debugStringSlicePool.add(slice));
}
@@ -1161,7 +1161,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
const UnownedStringSlice slice = m_stringRepresentationCache.getStringSlice(StringHandle(srcInst.m_payload.m_stringIndices[0]));
- const size_t sliceSize = slice.size();
+ const size_t sliceSize = slice.getLength();
const size_t instSize = prefixSize + SLANG_OFFSET_OF(IRConstant::StringValue, chars) + sliceSize;
irConst = static_cast<IRConstant*>(createEmptyInstWithSize(module, op, instSize));
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 62bdb171a..6e1b6fe83 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -1773,7 +1773,7 @@ namespace Slang
case kIROp_StringLit:
{
const UnownedStringSlice slice = getStringSlice();
- return combineHash(code, Slang::GetHashCode(slice.begin(), slice.size()));
+ return combineHash(code, Slang::GetHashCode(slice.begin(), slice.getLength()));
}
default:
{
@@ -1837,7 +1837,7 @@ namespace Slang
{
const UnownedStringSlice slice = keyInst.getStringSlice();
- const size_t sliceSize = slice.size();
+ const size_t sliceSize = slice.getLength();
const size_t instSize = prefixSize + offsetof(IRConstant::StringValue, chars) + sliceSize;
irValue = static_cast<IRConstant*>(createInstWithSizeImpl(builder, keyInst.op, keyInst.getFullType(), instSize));
@@ -1910,7 +1910,7 @@ namespace Slang
IRConstant::StringSliceValue& dstSlice = keyInst.value.transitoryStringVal;
dstSlice.chars = const_cast<char*>(inSlice.begin());
- dstSlice.numChars = uint32_t(inSlice.size());
+ dstSlice.numChars = uint32_t(inSlice.getLength());
return static_cast<IRStringLit*>(findOrEmitConstant(this, keyInst));
}
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 3cd3f73e3..04fab31ee 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -5847,7 +5847,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
//
if(targetMod->targetToken.type == TokenType::Unknown)
return;
- else if(targetMod->targetToken.Content.size() == 0)
+ else if(targetMod->targetToken.Content.getLength() == 0)
return;
}
}
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index 5d9320f3d..dfb55404e 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -481,7 +481,7 @@ namespace Slang
String getHashedName(const UnownedStringSlice& mangledName)
{
- uint64_t hash = GetHashCode64(mangledName.begin(), mangledName.size());
+ uint64_t hash = GetHashCode64(mangledName.begin(), mangledName.getLength());
StringBuilder builder;
builder << "_Sh";
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp
index 0268e1850..786433836 100644
--- a/source/slang/slang-parameter-binding.cpp
+++ b/source/slang/slang-parameter-binding.cpp
@@ -453,7 +453,7 @@ static void splitNameAndIndex(
LayoutResourceKind findRegisterClassFromName(UnownedStringSlice const& registerClassName)
{
- switch( registerClassName.size() )
+ switch( registerClassName.getLength() )
{
case 1:
switch (*registerClassName.begin())
@@ -491,7 +491,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo(
info.kind = LayoutResourceKind::None;
UnownedStringSlice registerName = semantic->registerName.Content;
- if (registerName.size() == 0)
+ if (registerName.getLength() == 0)
return info;
// The register name is expected to be in the form:
@@ -517,7 +517,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo(
// For a `register` semantic, the register index is not optional (unlike
// how it works for varying input/output semantics).
- if( registerIndexDigits.size() == 0 )
+ if( registerIndexDigits.getLength() == 0 )
{
getSink(context)->diagnose(semantic->registerName, Diagnostics::expectedARegisterIndex, registerClassName);
}
@@ -534,7 +534,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo(
if( auto registerSemantic = as<HLSLRegisterSemantic>(semantic) )
{
auto const& spaceName = registerSemantic->spaceName.Content;
- if(spaceName.size() != 0)
+ if(spaceName.getLength() != 0)
{
UnownedStringSlice spaceSpelling;
UnownedStringSlice spaceDigits;
@@ -548,7 +548,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo(
{
getSink(context)->diagnose(registerSemantic->spaceName, Diagnostics::expectedSpace, spaceSpelling);
}
- else if( spaceDigits.size() == 0 )
+ else if( spaceDigits.getLength() == 0 )
{
getSink(context)->diagnose(registerSemantic->spaceName, Diagnostics::expectedSpaceIndex);
}
@@ -564,7 +564,7 @@ LayoutSemanticInfo ExtractLayoutSemanticInfo(
}
// TODO: handle component mask part of things...
- if( semantic->componentMask.Content.size() != 0 )
+ if( semantic->componentMask.Content.getLength() != 0 )
{
getSink(context)->diagnose(semantic->componentMask, Diagnostics::componentMaskNotSupported);
}
@@ -1340,7 +1340,7 @@ SimpleSemanticInfo decomposeSimpleSemantic(
// look for a trailing sequence of decimal digits
// at the end of the composed name
- UInt length = composedName.size();
+ UInt length = composedName.getLength();
UInt indexLoc = length;
while( indexLoc > 0 )
{
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 037bc2d97..fe709222b 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -183,7 +183,7 @@ SLANG_API const char* spReflectionUserAttribute_GetArgumentValueString(SlangRefl
if (auto cexpr = as<StringLiteralExpr>(userAttr->args[index]))
{
if (bufLen)
- *bufLen = cexpr->token.Content.size();
+ *bufLen = cexpr->token.Content.getLength();
return cexpr->token.Content.begin();
}
return nullptr;
@@ -1564,7 +1564,7 @@ SLANG_API const char* spReflection_getHashedString(
auto slices = programLayout->hashedStringLiteralPool.getAdded();
auto slice = slices[Index(index)];
- *outCount = slice.size();
+ *outCount = slice.getLength();
return slice.begin();
}
diff --git a/source/slang/slang-source-loc.cpp b/source/slang/slang-source-loc.cpp
index 72f921369..ef45c42b0 100644
--- a/source/slang/slang-source-loc.cpp
+++ b/source/slang/slang-source-loc.cpp
@@ -359,7 +359,7 @@ SourceManager::~SourceManager()
UnownedStringSlice SourceManager::allocateStringSlice(const UnownedStringSlice& slice)
{
- const UInt numChars = slice.size();
+ const UInt numChars = slice.getLength();
char* dst = (char*)m_memoryArena.allocate(numChars);
::memcpy(dst, slice.begin(), numChars);
diff --git a/source/slang/slang-state-serialize.cpp b/source/slang/slang-state-serialize.cpp
index e98c309f8..9122b80fd 100644
--- a/source/slang/slang-state-serialize.cpp
+++ b/source/slang/slang-state-serialize.cpp
@@ -1400,7 +1400,7 @@ static SlangResult _calcCommandLine(OffsetBase& base, StateSerializeUtil::Reques
{
UnownedStringSlice contents = base.asRaw(file->contents)->getSlice();
- SLANG_RETURN_ON_FAIL(fileSystem->saveFile(base.asRaw(file->uniqueName)->getCstr(), contents.begin(), contents.size()));
+ SLANG_RETURN_ON_FAIL(fileSystem->saveFile(base.asRaw(file->uniqueName)->getCstr(), contents.begin(), contents.getLength()));
OffsetString* originalName = nullptr;
if (file->canonicalPath)
diff --git a/tools/gfx/d3d/d3d-util.cpp b/tools/gfx/d3d/d3d-util.cpp
index 3f25ff46c..c746655c7 100644
--- a/tools/gfx/d3d/d3d-util.cpp
+++ b/tools/gfx/d3d/d3d-util.cpp
@@ -368,7 +368,7 @@ bool D3DUtil::isTypeless(DXGI_FORMAT format)
static bool _isMatch(IDXGIAdapter* adapter, const Slang::UnownedStringSlice& lowerAdapaterName)
{
- if (lowerAdapaterName.size() == 0)
+ if (lowerAdapaterName.getLength() == 0)
{
return true;
}
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index bd6d2b364..8331de07e 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -245,7 +245,7 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
{
// Lookup
Slang::UnownedStringSlice argSlice(arg);
- if (argSlice.size() && argSlice[0] == '-')
+ if (argSlice.getLength() && argSlice[0] == '-')
{
// Look up the rendering API if set
UnownedStringSlice argName = UnownedStringSlice(argSlice.begin() + 1, argSlice.end());
diff --git a/tools/slang-generate/main.cpp b/tools/slang-generate/main.cpp
index be06836e7..979127f8d 100644
--- a/tools/slang-generate/main.cpp
+++ b/tools/slang-generate/main.cpp
@@ -558,7 +558,7 @@ void emitSimpleText(
while (StringUtil::extractLine(content, line))
{
// Write the line
- fwrite(line.begin(), 1, line.size(), stream);
+ fwrite(line.begin(), 1, line.getLength(), stream);
// Specially handle the 'final line', excluding an empty line after \n.
// We can detect, as if input ends with 'cr/lf' combination, content.begin == span.end(), else if content.begin() == nullptr.
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 9f9ad527a..01655a4fe 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -568,7 +568,7 @@ static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, Te
for (const auto& arg: args)
{
Slang::UnownedStringSlice argSlice = arg.value.getUnownedSlice();
- if (argSlice.size() && argSlice[0] == '-')
+ if (argSlice.getLength() && argSlice[0] == '-')
{
// Look up the rendering API if set
UnownedStringSlice argName = UnownedStringSlice(argSlice.begin() + 1, argSlice.end());
@@ -1918,7 +1918,7 @@ static SlangResult _extractProfileTime(const UnownedStringSlice& text, double& t
{
if (line.startsWith(lineStart))
{
- UnownedStringSlice remaining(line.begin() + lineStart.size(), line.end());
+ UnownedStringSlice remaining(line.begin() + lineStart.getLength(), line.end());
remaining.trim();
timeOut = StringToDouble(String(remaining));
@@ -1970,7 +1970,7 @@ TestResult runPerformanceProfile(TestContext* context, TestInput& input)
static double _textToDouble(const UnownedStringSlice& slice)
{
- Index size = Index(slice.size());
+ Index size = Index(slice.getLength());
// We have to zero terminate to be able to use atof
const Index maxSize = 80;
char buffer[maxSize + 1];