summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-04-29 17:03:46 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-04-29 14:03:46 -0700
commit4880789e3003441732cca4471091563f36531635 (patch)
tree8e0d3ed58a561373b35729d24787afe6b39732e3 /source/slang
parentded340beb4b5197b559626acc39920abb2d39e77 (diff)
String/List closer to conventions, and use Index type (#959)
* List made members m_ Tweaked types to closer match conventions. * Use asserts for checking conditions on List. Other small improvements. * List<T>.Count() -> getSize() * List<T> Add -> add First -> getFirst Last -> getLast RemoveLast -> removeLast ReleaseBuffer -> detachBuffer GetArrayView -> getArrayView * List<T>:: AddRange -> addRange Capacity -> getCapacity Insert -> insert InsertRange -> insertRange AddRange -> addRange RemoveRange -> removeRange RemoveAt -> removeAt Remove -> remove Reverse -> reverse FastRemove -> fastRemove FastRemoveAt -> fastRemoveAt Clear -> clear * List<T> FreeBuffer -> _deallocateBuffer Free -> clearAndDeallocate SwapWith -> swapWith * List<T> SetSize -> setSize Reserve -> reserve GrowToSize growToSize * UnsafeShrinkToSize -> unsafeShrinkToSize Compress -> compress FindLast -> findLastIndex FindLast -> findLastIndex Simplify Contains * List<T> Removed m_allocator (wasn't used) Swap -> swapElements Sort -> sort Contains -> contains ForEach -> forEach QuickSort -> quickSort InsertionSort -> insertionSort BinarySearch -> binarySearch Max -> calcMax Min -> calcMin * Initializer::Initialize -> initialize List<T>:: Allocate -> _allocate Init -> _init IndexOf -> indexOf * * Put #include <assert.h> in common.h, and remove unneeded inclusions * Small refactor of ArrayView - remove stride as not used * getSize -> getCount setSize -> setCount unsafeShrinkToSize->unsafeShrinkToCount growToSize -> growToCount m_size -> m_count * Some tidy up around Allocator. * Use Index type on List. * Refactor of IntSet. First tentative look at using Index. * Made Index an Int Did preliminary fixes. Made String use Index. * Partial refactor of String. * String::Buffer -> getBuffer ToWString -> toWString * Small improvements to String. String:: Buffer() -> getBuffer() Equals() -> equals * Try to use Index where appropriate. * Fix warnings on windows x86 builds.
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/check.cpp329
-rw-r--r--source/slang/compiler.cpp92
-rw-r--r--source/slang/compiler.h26
-rw-r--r--source/slang/diagnostics.cpp21
-rw-r--r--source/slang/diagnostics.h9
-rw-r--r--source/slang/dxc-support.cpp14
-rw-r--r--source/slang/emit.cpp42
-rw-r--r--source/slang/ir-bind-existentials.cpp8
-rw-r--r--source/slang/ir-clone.cpp12
-rw-r--r--source/slang/ir-constexpr.cpp6
-rw-r--r--source/slang/ir-dce.cpp8
-rw-r--r--source/slang/ir-dominators.cpp12
-rw-r--r--source/slang/ir-entry-point-uniforms.cpp2
-rw-r--r--source/slang/ir-glsl-legalize.cpp38
-rw-r--r--source/slang/ir-insts.h10
-rw-r--r--source/slang/ir-legalize-types.cpp82
-rw-r--r--source/slang/ir-link.cpp6
-rw-r--r--source/slang/ir-restructure.cpp6
-rw-r--r--source/slang/ir-sccp.cpp34
-rw-r--r--source/slang/ir-serialize.cpp260
-rw-r--r--source/slang/ir-serialize.h4
-rw-r--r--source/slang/ir-specialize-resources.cpp34
-rw-r--r--source/slang/ir-specialize.cpp38
-rw-r--r--source/slang/ir-ssa.cpp38
-rw-r--r--source/slang/ir-union.cpp12
-rw-r--r--source/slang/ir.cpp14
-rw-r--r--source/slang/legalize-types.cpp18
-rw-r--r--source/slang/lexer.cpp10
-rw-r--r--source/slang/lookup.cpp10
-rw-r--r--source/slang/lower-to-ir.cpp154
-rw-r--r--source/slang/mangle.cpp4
-rw-r--r--source/slang/options.cpp60
-rw-r--r--source/slang/parameter-binding.cpp58
-rw-r--r--source/slang/parser.cpp52
-rw-r--r--source/slang/preprocessor.cpp24
-rw-r--r--source/slang/reflection.cpp36
-rw-r--r--source/slang/slang-file-system.cpp12
-rw-r--r--source/slang/slang-stdlib.cpp6
-rw-r--r--source/slang/slang.cpp132
-rw-r--r--source/slang/source-loc.cpp60
-rw-r--r--source/slang/source-loc.h12
-rw-r--r--source/slang/syntax.cpp68
-rw-r--r--source/slang/syntax.h48
-rw-r--r--source/slang/type-defs.h2
-rw-r--r--source/slang/type-layout.cpp14
-rw-r--r--source/slang/type-layout.h8
46 files changed, 982 insertions, 963 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index e327834c0..6a40f436a 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -230,10 +230,10 @@ namespace Slang
// that we can encode in our space of keys.
args[0].aggVal = 0;
args[1].aggVal = 0;
- if (opExpr->Arguments.Count() > 2)
+ if (opExpr->Arguments.getCount() > 2)
return false;
- for (UInt i = 0; i < opExpr->Arguments.Count(); i++)
+ for (Index i = 0; i < opExpr->Arguments.getCount(); i++)
{
if (!args[i].fromType(opExpr->Arguments[i]->type.Ptr()))
return false;
@@ -1023,7 +1023,7 @@ namespace Slang
for (auto argExpr : args)
{
- subst->args.Add(ExtractGenericArgVal(argExpr));
+ subst->args.add(ExtractGenericArgVal(argExpr));
}
DeclRef<Decl> innerDeclRef;
@@ -1219,7 +1219,7 @@ namespace Slang
// TODO: this is one place where syntax should get cloned!
if (outProperType)
- args.Add(typeParam->initType.exp);
+ args.add(typeParam->initType.exp);
}
else if (auto valParam = as<GenericValueParamDecl>(member))
{
@@ -1235,7 +1235,7 @@ namespace Slang
// TODO: this is one place where syntax should get cloned!
if (outProperType)
- args.Add(valParam->initExpr);
+ args.add(valParam->initExpr);
}
else
{
@@ -1487,7 +1487,7 @@ namespace Slang
// First, we will check if we have run out of arguments
// on the initializer list.
//
- UInt initArgCount = fromInitializerListExpr->args.Count();
+ UInt initArgCount = fromInitializerListExpr->args.getCount();
if(ioInitArgIndex >= initArgCount)
{
// If we are at the end of the initializer list,
@@ -1567,7 +1567,7 @@ namespace Slang
UInt &ioArgIndex)
{
auto toType = inToType;
- UInt argCount = fromInitializerListExpr->args.Count();
+ UInt argCount = fromInitializerListExpr->args.getCount();
// In the case where we need to build a result expression,
// we will collect the new arguments here
@@ -1637,7 +1637,7 @@ namespace Slang
if( coercedArg )
{
- coercedArgs.Add(coercedArg);
+ coercedArgs.add(coercedArg);
}
}
}
@@ -1685,7 +1685,7 @@ namespace Slang
if( coercedArg )
{
- coercedArgs.Add(coercedArg);
+ coercedArgs.add(coercedArg);
}
}
}
@@ -1713,7 +1713,7 @@ namespace Slang
if( coercedArg )
{
- coercedArgs.Add(coercedArg);
+ coercedArgs.add(coercedArg);
}
}
@@ -1775,7 +1775,7 @@ namespace Slang
if( coercedArg )
{
- coercedArgs.Add(coercedArg);
+ coercedArgs.add(coercedArg);
}
}
}
@@ -1803,7 +1803,7 @@ namespace Slang
if( coercedArg )
{
- coercedArgs.Add(coercedArg);
+ coercedArgs.add(coercedArg);
}
}
}
@@ -1862,7 +1862,7 @@ namespace Slang
RefPtr<Expr>* outToExpr,
RefPtr<InitializerListExpr> fromInitializerListExpr)
{
- UInt argCount = fromInitializerListExpr->args.Count();
+ UInt argCount = fromInitializerListExpr->args.getCount();
UInt argIndex = 0;
// TODO: we should handle the special case of `{0}` as an initializer
@@ -2062,7 +2062,7 @@ namespace Slang
// to the context and processed, we need to see whether
// there was one best overload or not.
//
- if(overloadContext.bestCandidates.Count() != 0)
+ if(overloadContext.bestCandidates.getCount() != 0)
{
// In this case there were multiple equally-good candidates to call.
//
@@ -2159,7 +2159,7 @@ namespace Slang
//
auto castExpr = createImplicitCastExpr();
castExpr->loc = fromExpr->loc;
- castExpr->Arguments.Add(fromExpr);
+ castExpr->Arguments.add(fromExpr);
//
// Next we need to set our cast expression as the "original"
// expression and then complete the overload process.
@@ -2181,8 +2181,8 @@ namespace Slang
// because we don't allow nested implicit conversions,
// but I'd rather play it safe.
//
- castExpr->Arguments.Clear();
- castExpr->Arguments.Add(fromExpr);
+ castExpr->Arguments.clear();
+ castExpr->Arguments.add(fromExpr);
}
return true;
@@ -2275,7 +2275,7 @@ namespace Slang
castExpr->loc = fromExpr->loc;
castExpr->FunctionExpr = typeExpr;
castExpr->type = QualType(toType);
- castExpr->Arguments.Add(fromExpr);
+ castExpr->Arguments.add(fromExpr);
return castExpr;
}
@@ -2663,11 +2663,11 @@ namespace Slang
param->nameAndLoc = member->nameAndLoc;
param->type = varMember->type;
param->loc = member->loc;
- attribDecl->Members.Add(param);
+ attribDecl->Members.add(param);
}
}
// add the attribute class definition to the syntax tree, so it can be found
- structAttribDef->ParentDecl->Members.Add(attribDecl.Ptr());
+ structAttribDef->ParentDecl->Members.add(attribDecl.Ptr());
structAttribDef->ParentDecl->memberDictionaryIsValid = false;
// do necessary checks on this newly constructed node
checkDecl(attribDecl.Ptr());
@@ -2676,7 +2676,7 @@ namespace Slang
bool hasIntArgs(Attribute* attr, int numArgs)
{
- if (int(attr->args.Count()) != numArgs)
+ if (int(attr->args.getCount()) != numArgs)
{
return false;
}
@@ -2692,7 +2692,7 @@ namespace Slang
bool hasStringArgs(Attribute* attr, int numArgs)
{
- if (int(attr->args.Count()) != numArgs)
+ if (int(attr->args.getCount()) != numArgs)
{
return false;
}
@@ -2730,7 +2730,7 @@ namespace Slang
{
if(auto numThreadsAttr = as<NumThreadsAttribute>(attr))
{
- SLANG_ASSERT(attr->args.Count() == 3);
+ SLANG_ASSERT(attr->args.getCount() == 3);
auto xVal = checkConstantIntVal(attr->args[0]);
auto yVal = checkConstantIntVal(attr->args[1]);
auto zVal = checkConstantIntVal(attr->args[2]);
@@ -2748,7 +2748,7 @@ namespace Slang
// This must be vk::binding or gl::binding (as specified in core.meta.slang under vk_binding/gl_binding)
// Must have 2 int parameters. Ideally this would all be checked from the specification
// in core.meta.slang, but that's not completely implemented. So for now we check here.
- if (attr->args.Count() != 2)
+ if (attr->args.getCount() != 2)
{
return false;
}
@@ -2768,7 +2768,7 @@ namespace Slang
}
else if (auto maxVertexCountAttr = as<MaxVertexCountAttribute>(attr))
{
- SLANG_ASSERT(attr->args.Count() == 1);
+ SLANG_ASSERT(attr->args.getCount() == 1);
auto val = checkConstantIntVal(attr->args[0]);
if(!val) return false;
@@ -2777,7 +2777,7 @@ namespace Slang
}
else if(auto instanceAttr = as<InstanceAttribute>(attr))
{
- SLANG_ASSERT(attr->args.Count() == 1);
+ SLANG_ASSERT(attr->args.getCount() == 1);
auto val = checkConstantIntVal(attr->args[0]);
if(!val) return false;
@@ -2786,7 +2786,7 @@ namespace Slang
}
else if(auto entryPointAttr = as<EntryPointAttribute>(attr))
{
- SLANG_ASSERT(attr->args.Count() == 1);
+ SLANG_ASSERT(attr->args.getCount() == 1);
String stageName;
if(!checkLiteralStringVal(attr->args[0], &stageName))
@@ -2825,22 +2825,22 @@ namespace Slang
else if (as<PushConstantAttribute>(attr))
{
// Has no args
- SLANG_ASSERT(attr->args.Count() == 0);
+ SLANG_ASSERT(attr->args.getCount() == 0);
}
else if (as<ShaderRecordAttribute>(attr))
{
// Has no args
- SLANG_ASSERT(attr->args.Count() == 0);
+ SLANG_ASSERT(attr->args.getCount() == 0);
}
else if (as<EarlyDepthStencilAttribute>(attr))
{
// Has no args
- SLANG_ASSERT(attr->args.Count() == 0);
+ SLANG_ASSERT(attr->args.getCount() == 0);
}
else if (auto attrUsageAttr = as<AttributeUsageAttribute>(attr))
{
uint32_t targetClassId = (uint32_t)UserDefinedAttributeTargets::None;
- if (attr->args.Count() == 1)
+ if (attr->args.getCount() == 1)
{
RefPtr<IntVal> outIntVal;
if (auto cInt = checkConstantEnumVal(attr->args[0]))
@@ -2864,16 +2864,16 @@ namespace Slang
// Check has an argument. We need this because default behavior is to give an error
// if an attribute has arguments, but not handled explicitly (and the default param will come through
// as 1 arg if nothing is specified)
- SLANG_ASSERT(attr->args.Count() == 1);
+ SLANG_ASSERT(attr->args.getCount() == 1);
}
else if (auto userDefAttr = as<UserDefinedAttribute>(attr))
{
// check arguments against attribute parameters defined in attribClassDecl
- uint32_t paramIndex = 0;
+ Index paramIndex = 0;
auto params = attribClassDecl->getMembersOfType<ParamDecl>();
for (auto paramDecl : params)
{
- if (paramIndex < attr->args.Count())
+ if (paramIndex < attr->args.getCount())
{
auto & arg = attr->args[paramIndex];
bool typeChecked = false;
@@ -2896,18 +2896,18 @@ namespace Slang
}
paramIndex++;
}
- if (params.Count() < attr->args.Count())
+ if (params.getCount() < attr->args.getCount())
{
- getSink()->diagnose(attr, Diagnostics::tooManyArguments, attr->args.Count(), params.Count());
+ getSink()->diagnose(attr, Diagnostics::tooManyArguments, attr->args.getCount(), params.getCount());
}
- else if (params.Count() > attr->args.Count())
+ else if (params.getCount() > attr->args.getCount())
{
- getSink()->diagnose(attr, Diagnostics::notEnoughArguments, attr->args.Count(), params.Count());
+ getSink()->diagnose(attr, Diagnostics::notEnoughArguments, attr->args.getCount(), params.getCount());
}
}
else if (auto formatAttr = as<FormatAttribute>(attr))
{
- SLANG_ASSERT(attr->args.Count() == 1);
+ SLANG_ASSERT(attr->args.getCount() == 1);
String formatName;
if(!checkLiteralStringVal(attr->args[0], &formatName))
@@ -2916,7 +2916,7 @@ namespace Slang
}
ImageFormat format = ImageFormat::unknown;
- if(!findImageFormatByName(formatName.Buffer(), &format))
+ if(!findImageFormatByName(formatName.getBuffer(), &format))
{
getSink()->diagnose(attr->args[0], Diagnostics::unknownImageFormatName, formatName);
}
@@ -2925,7 +2925,7 @@ namespace Slang
}
else
{
- if(attr->args.Count() == 0)
+ if(attr->args.getCount() == 0)
{
// If the attribute took no arguments, then we will
// assume it is valid as written.
@@ -2984,7 +2984,7 @@ namespace Slang
// us to look at the attribute declaration itself.
//
// Start by doing argument/parameter matching
- UInt argCount = attr->args.Count();
+ UInt argCount = attr->args.getCount();
UInt paramCounter = 0;
bool mismatch = false;
for(auto paramDecl : attrDecl->getMembersOfType<ParamDecl>())
@@ -3008,7 +3008,7 @@ namespace Slang
// default arguments as needed.
// For now just copy the expression over.
- attr->args.Add(paramDecl->initExpr);
+ attr->args.add(paramDecl->initExpr);
}
else
{
@@ -3317,9 +3317,9 @@ namespace Slang
DeclRef<GenericDecl> requirementGenDecl,
RefPtr<WitnessTable> witnessTable)
{
- if (genDecl.getDecl()->Members.Count() != requirementGenDecl.getDecl()->Members.Count())
+ if (genDecl.getDecl()->Members.getCount() != requirementGenDecl.getDecl()->Members.getCount())
return false;
- for (UInt i = 0; i < genDecl.getDecl()->Members.Count(); i++)
+ for (Index i = 0; i < genDecl.getDecl()->Members.getCount(); i++)
{
auto genMbr = genDecl.getDecl()->Members[i];
auto requiredGenMbr = genDecl.getDecl()->Members[i];
@@ -4049,7 +4049,7 @@ namespace Slang
enumConformanceDecl->ParentDecl = decl;
enumConformanceDecl->loc = decl->loc;
enumConformanceDecl->base.type = getSession()->getEnumTypeType();
- decl->Members.Add(enumConformanceDecl);
+ decl->Members.add(enumConformanceDecl);
// The `__EnumType` interface has one required member, the `__Tag` type.
// We need to satisfy this requirement automatically, rather than require
@@ -4329,11 +4329,11 @@ namespace Slang
continue;
if (auto typeParamDecl = as<GenericTypeParamDecl>(dd))
- outParams.Add(typeParamDecl);
+ outParams.add(typeParamDecl);
else if (auto valueParamDecl = as<GenericValueParamDecl>(dd))
- outParams.Add(valueParamDecl);
+ outParams.add(valueParamDecl);
else if (auto constraintDecl = as<GenericTypeConstraintDecl>(dd))
- outConstraints.Add(constraintDecl);
+ outConstraints.add(constraintDecl);
}
}
@@ -4358,12 +4358,12 @@ namespace Slang
// For there to be any hope of a match, the
// two need to have the same number of parameters.
- UInt paramCount = fstParams.Count();
- if (paramCount != sndParams.Count())
+ Index paramCount = fstParams.getCount();
+ if (paramCount != sndParams.getCount())
return false;
// Now we'll walk through the parameters.
- for (UInt pp = 0; pp < paramCount; ++pp)
+ for (Index pp = 0; pp < paramCount; ++pp)
{
Decl* fstParam = fstParams[pp];
Decl* sndParam = sndParams[pp];
@@ -4416,11 +4416,11 @@ namespace Slang
//
// For now I'm going to assume/require that all declarations must
// declare the signature in a way that matches exactly.
- UInt constraintCount = fstConstraints.Count();
- if(constraintCount != sndConstraints.Count())
+ Index constraintCount = fstConstraints.getCount();
+ if(constraintCount != sndConstraints.getCount())
return false;
- for (UInt cc = 0; cc < constraintCount; ++cc)
+ for (Index cc = 0; cc < constraintCount; ++cc)
{
//auto fstConstraint = fstConstraints[cc];
//auto sndConstraint = sndConstraints[cc];
@@ -4448,12 +4448,12 @@ namespace Slang
// If the functions have different numbers of parameters, then
// their signatures trivially don't match.
- auto fstParamCount = fstParams.Count();
- auto sndParamCount = sndParams.Count();
+ auto fstParamCount = fstParams.getCount();
+ auto sndParamCount = sndParams.getCount();
if (fstParamCount != sndParamCount)
return false;
- for (UInt ii = 0; ii < fstParamCount; ++ii)
+ for (Index ii = 0; ii < fstParamCount; ++ii)
{
auto fstParam = fstParams[ii];
auto sndParam = sndParams[ii];
@@ -4495,13 +4495,13 @@ namespace Slang
{
auto type = DeclRefType::Create(getSession(),
makeDeclRef(typeParam));
- subst->args.Add(type);
+ subst->args.add(type);
}
else if (auto valueParam = as<GenericValueParamDecl>(dd))
{
auto val = new GenericParamIntVal(
makeDeclRef(valueParam));
- subst->args.Add(val);
+ subst->args.add(val);
}
// TODO: need to handle constraints here?
}
@@ -4845,8 +4845,8 @@ namespace Slang
template<typename T>
T* FindOuterStmt()
{
- UInt outerStmtCount = outerStmts.Count();
- for (UInt ii = outerStmtCount; ii > 0; --ii)
+ const Index outerStmtCount = outerStmts.getCount();
+ for (Index ii = outerStmtCount; ii > 0; --ii)
{
auto outerStmt = outerStmts[ii-1];
auto found = as<T>(outerStmt);
@@ -4877,12 +4877,12 @@ namespace Slang
void PushOuterStmt(Stmt* stmt)
{
- outerStmts.Add(stmt);
+ outerStmts.add(stmt);
}
void PopOuterStmt(Stmt* /*stmt*/)
{
- outerStmts.RemoveAt(outerStmts.Count() - 1);
+ outerStmts.removeAt(outerStmts.getCount() - 1);
}
RefPtr<Expr> checkPredicateExpr(Expr* expr)
@@ -5220,7 +5220,7 @@ namespace Slang
// Let's not constant-fold operations with more than a certain number of arguments, for simplicity
static const int kMaxArgs = 8;
- if (invokeExpr->Arguments.Count() > kMaxArgs)
+ if (invokeExpr->Arguments.getCount() > kMaxArgs)
return nullptr;
// Before checking the operation name, let's look at the arguments
@@ -5483,8 +5483,8 @@ namespace Slang
auto substitutions = new GenericSubstitution();
substitutions->genericDecl = vectorGenericDecl.Ptr();
- substitutions->args.Add(elementType);
- substitutions->args.Add(elementCount);
+ substitutions->args.add(elementType);
+ substitutions->args.add(elementCount);
auto declRef = DeclRef<Decl>(vectorTypeDecl.Ptr(), substitutions);
@@ -5588,7 +5588,7 @@ namespace Slang
subscriptCallExpr->FunctionExpr = subscriptFuncExpr;
// TODO(tfoley): This path can support multiple arguments easily
- subscriptCallExpr->Arguments.Add(subscriptExpr->IndexExpression);
+ subscriptCallExpr->Arguments.add(subscriptExpr->IndexExpression);
return CheckInvokeExprWithCheckedOperands(subscriptCallExpr.Ptr());
}
@@ -5602,9 +5602,9 @@ namespace Slang
bool MatchArguments(FuncDecl * functionNode, List <RefPtr<Expr>> &args)
{
- if (functionNode->GetParameters().Count() != args.Count())
+ if (functionNode->GetParameters().getCount() != args.getCount())
return false;
- int i = 0;
+ Index i = 0;
for (auto param : functionNode->GetParameters())
{
if (!param->type.Equals(args[i]->type.Ptr()))
@@ -5832,7 +5832,7 @@ namespace Slang
getterDecl->loc = decl->loc;
getterDecl->ParentDecl = decl;
- decl->Members.Add(getterDecl);
+ decl->Members.add(getterDecl);
}
for(auto mm : decl->Members)
@@ -6221,7 +6221,7 @@ namespace Slang
if(outWitness)
{
- caseWitnesses.Add(caseWitness);
+ caseWitnesses.add(caseWitness);
}
}
@@ -6249,7 +6249,7 @@ namespace Slang
RefPtr<TaggedUnionSubtypeWitness> taggedUnionWitness = new TaggedUnionSubtypeWitness();
taggedUnionWitness->sub = taggedUnionType;
taggedUnionWitness->sup = DeclRefType::Create(getSession(), interfaceDeclRef);
- taggedUnionWitness->caseWitnesses.SwapWith(caseWitnesses);
+ taggedUnionWitness->caseWitnesses.swapWith(caseWitnesses);
*outWitness = taggedUnionWitness;
}
@@ -6556,7 +6556,7 @@ namespace Slang
// failure!
return SubstitutionSet();
}
- args.Add(type);
+ args.add(type);
}
else if (auto valParam = m.as<GenericValueParamDecl>())
{
@@ -6593,7 +6593,7 @@ namespace Slang
// failure!
return SubstitutionSet();
}
- args.Add(val);
+ args.add(val);
}
else
{
@@ -6638,7 +6638,7 @@ namespace Slang
if(subTypeWitness)
{
// We found a witness, so it will become an (implicit) argument.
- solvedSubst->args.Add(subTypeWitness);
+ solvedSubst->args.add(subTypeWitness);
}
else
{
@@ -6690,13 +6690,13 @@ namespace Slang
SourceLoc funcLoc;
// The original arguments to the call
- UInt argCount = 0;
+ Index argCount = 0;
RefPtr<Expr>* args = nullptr;
RefPtr<Type>* argTypes = nullptr;
- UInt getArgCount() { return argCount; }
- RefPtr<Expr>& getArg(UInt index) { return args[index]; }
- RefPtr<Type>& getArgType(UInt index)
+ Index getArgCount() { return argCount; }
+ RefPtr<Expr>& getArg(Index index) { return args[index]; }
+ RefPtr<Type>& getArgType(Index index)
{
if(argTypes)
return argTypes[index];
@@ -6875,7 +6875,7 @@ namespace Slang
candidate.subst = genSubst;
auto& checkedArgs = genSubst->args;
- uint32_t aa = 0;
+ Index aa = 0;
for (auto memberRef : getMembers(genericDeclRef))
{
if (auto typeParamRef = memberRef.as<GenericTypeParamDecl>())
@@ -6899,7 +6899,7 @@ namespace Slang
{
typeExp = CoerceToProperType(TypeExp(arg));
}
- checkedArgs.Add(typeExp.type);
+ checkedArgs.add(typeExp.type);
}
else if (auto valParamRef = memberRef.as<GenericValueParamDecl>())
{
@@ -6917,7 +6917,7 @@ namespace Slang
arg = coerce(GetType(valParamRef), arg);
auto val = ExtractGenericArgInteger(arg);
- checkedArgs.Add(val);
+ checkedArgs.add(val);
}
else
{
@@ -6933,7 +6933,7 @@ namespace Slang
OverloadResolveContext& context,
OverloadCandidate& candidate)
{
- UInt argCount = context.getArgCount();
+ Index argCount = context.getArgCount();
List<DeclRef<ParamDecl>> params;
switch (candidate.flavor)
@@ -6952,9 +6952,9 @@ namespace Slang
// Note(tfoley): We might have fewer arguments than parameters in the
// case where one or more parameters had defaults.
- SLANG_RELEASE_ASSERT(argCount <= params.Count());
+ SLANG_RELEASE_ASSERT(argCount <= params.getCount());
- for (UInt ii = 0; ii < argCount; ++ii)
+ for (Index ii = 0; ii < argCount; ++ii)
{
auto& arg = context.getArg(ii);
auto argType = context.getArgType(ii);
@@ -7072,7 +7072,7 @@ namespace Slang
auto subTypeWitness = tryGetSubtypeWitness(sub, sup);
if(subTypeWitness)
{
- subst->args.Add(subTypeWitness);
+ subst->args.add(subTypeWitness);
}
else
{
@@ -7206,8 +7206,8 @@ namespace Slang
callExpr = new InvokeExpr();
callExpr->loc = context.loc;
- for(UInt aa = 0; aa < context.argCount; ++aa)
- callExpr->Arguments.Add(context.getArg(aa));
+ for(Index aa = 0; aa < context.argCount; ++aa)
+ callExpr->Arguments.add(context.getArg(aa));
}
@@ -7290,13 +7290,13 @@ namespace Slang
bool keepThisCandidate = true; // should this candidate be kept?
- if (context.bestCandidates.Count() != 0)
+ if (context.bestCandidates.getCount() != 0)
{
// We have multiple candidates right now, so filter them.
bool anyFiltered = false;
// Note that we are querying the list length on every iteration,
// because we might remove things.
- for (UInt cc = 0; cc < context.bestCandidates.Count(); ++cc)
+ for (Index cc = 0; cc < context.bestCandidates.getCount(); ++cc)
{
int cmp = CompareOverloadCandidates(&candidate, &context.bestCandidates[cc]);
if (cmp < 0)
@@ -7304,7 +7304,7 @@ namespace Slang
// our new candidate is better!
// remove it from the list (by swapping in a later one)
- context.bestCandidates.FastRemoveAt(cc);
+ context.bestCandidates.fastRemoveAt(cc);
// and then reduce our index so that we re-visit the same index
--cc;
@@ -7344,16 +7344,16 @@ namespace Slang
return;
// Otherwise we want to keep the candidate
- if (context.bestCandidates.Count() > 0)
+ if (context.bestCandidates.getCount() > 0)
{
// There were already multiple candidates, and we are adding one more
- context.bestCandidates.Add(candidate);
+ context.bestCandidates.add(candidate);
}
else if (context.bestCandidate)
{
// There was a unique best candidate, but now we are ambiguous
- context.bestCandidates.Add(*context.bestCandidate);
- context.bestCandidates.Add(candidate);
+ context.bestCandidates.add(*context.bestCandidate);
+ context.bestCandidates.add(candidate);
context.bestCandidate = nullptr;
}
else
@@ -7581,10 +7581,10 @@ namespace Slang
return false;
// Their arguments must unify
- SLANG_RELEASE_ASSERT(fstGen->args.Count() == sndGen->args.Count());
- UInt argCount = fstGen->args.Count();
+ SLANG_RELEASE_ASSERT(fstGen->args.getCount() == sndGen->args.getCount());
+ Index argCount = fstGen->args.getCount();
bool okay = true;
- for (UInt aa = 0; aa < argCount; ++aa)
+ for (Index aa = 0; aa < argCount; ++aa)
{
if (!TryUnifyVals(constraints, fstGen->args[aa], sndGen->args[aa]))
{
@@ -7612,7 +7612,7 @@ namespace Slang
constraint.decl = typeParamDecl.Ptr();
constraint.val = type;
- constraints.constraints.Add(constraint);
+ constraints.constraints.add(constraint);
return true;
}
@@ -7635,7 +7635,7 @@ namespace Slang
constraint.decl = paramDecl.Ptr();
constraint.val = val;
- constraints.constraints.Add(constraint);
+ constraints.constraints.add(constraint);
return true;
}
@@ -7925,8 +7925,8 @@ namespace Slang
{
auto params = GetParameters(funcDeclRef).ToArray();
- UInt argCount = context.getArgCount();
- UInt paramCount = params.Count();
+ Index argCount = context.getArgCount();
+ Index paramCount = params.getCount();
// Bail out on mismatch.
// TODO(tfoley): need more nuance here
@@ -7935,7 +7935,7 @@ namespace Slang
return DeclRef<Decl>(nullptr, nullptr);
}
- for (UInt aa = 0; aa < argCount; ++aa)
+ for (Index aa = 0; aa < argCount; ++aa)
{
#if 0
if (!TryUnifyArgAndParamTypes(constraints, args[aa], params[aa]))
@@ -8418,8 +8418,8 @@ namespace Slang
context.originalExpr = expr;
context.funcLoc = funcExpr->loc;
- context.argCount = expr->Arguments.Count();
- context.args = expr->Arguments.Buffer();
+ context.argCount = expr->Arguments.getCount();
+ context.args = expr->Arguments.getBuffer();
context.loc = expr->loc;
if (auto funcMemberExpr = as<MemberExpr>(funcExpr))
@@ -8440,7 +8440,7 @@ namespace Slang
AddOverloadCandidates(funcExpr, context);
}
- if (context.bestCandidates.Count() > 0)
+ if (context.bestCandidates.getCount() > 0)
{
// Things were ambiguous.
@@ -8495,9 +8495,9 @@ namespace Slang
}
{
- UInt candidateCount = context.bestCandidates.Count();
- UInt maxCandidatesToPrint = 10; // don't show too many candidates at once...
- UInt candidateIndex = 0;
+ Index candidateCount = context.bestCandidates.getCount();
+ Index maxCandidatesToPrint = 10; // don't show too many candidates at once...
+ Index candidateIndex = 0;
for (auto candidate : context.bestCandidates)
{
String declString = getDeclSignatureString(candidate.item);
@@ -8634,15 +8634,15 @@ namespace Slang
OverloadResolveContext context;
context.originalExpr = genericAppExpr;
context.funcLoc = baseExpr->loc;
- context.argCount = args.Count();
- context.args = args.Buffer();
+ context.argCount = args.getCount();
+ context.args = args.getBuffer();
context.loc = genericAppExpr->loc;
context.baseExpr = GetBaseExpr(baseExpr);
AddGenericOverloadCandidates(baseExpr, context);
- if (context.bestCandidates.Count() > 0)
+ if (context.bestCandidates.getCount() > 0)
{
// Things were ambiguous.
if (context.bestCandidates[0].status != OverloadCandidate::Status::Applicable)
@@ -8666,7 +8666,7 @@ namespace Slang
for (auto candidate : context.bestCandidates)
{
auto candidateExpr = CompleteOverloadCandidate(context, candidate);
- overloadedExpr->candidiateExprs.Add(candidateExpr);
+ overloadedExpr->candidiateExprs.add(candidateExpr);
}
return overloadedExpr;
}
@@ -8708,7 +8708,7 @@ namespace Slang
for( auto& caseTypeExpr : expr->caseTypes )
{
caseTypeExpr = CheckProperType(caseTypeExpr);
- type->caseTypes.Add(caseTypeExpr.type);
+ type->caseTypes.add(caseTypeExpr.type);
}
return expr;
@@ -8735,8 +8735,8 @@ namespace Slang
// if this is still an invoke expression, test arguments passed to inout/out parameter are LValues
if(auto funcType = as<FuncType>(invoke->FunctionExpr->type))
{
- UInt paramCount = funcType->getParamCount();
- for (UInt pp = 0; pp < paramCount; ++pp)
+ Index paramCount = funcType->getParamCount();
+ for (Index pp = 0; pp < paramCount; ++pp)
{
auto paramType = funcType->getParamType(pp);
if (as<OutTypeBase>(paramType) || as<RefType>(paramType))
@@ -8748,7 +8748,7 @@ namespace Slang
// for an `inout` parameter to be converted in both
// directions.
//
- if( pp < expr->Arguments.Count() )
+ if( pp < expr->Arguments.getCount() )
{
auto argExpr = expr->Arguments[pp];
if( !argExpr->type.IsLeftValue )
@@ -8945,7 +8945,7 @@ namespace Slang
auto swizzleText = getText(memberRefExpr->name);
- for (UInt i = 0; i < swizzleText.Length(); i++)
+ for (Index i = 0; i < swizzleText.getLength(); i++)
{
auto ch = swizzleText[i];
int elementIndex = -1;
@@ -9121,7 +9121,7 @@ namespace Slang
if (isUsableAsStaticMember(item))
{
// If yes, then it will be part of the output.
- staticItems.Add(item);
+ staticItems.add(item);
}
else
{
@@ -9135,7 +9135,7 @@ namespace Slang
{
// If we had some static items, then that's okay,
// we just want to use our newly-filtered list.
- if (staticItems.Count())
+ if (staticItems.getCount())
{
lookupResult.items = staticItems;
}
@@ -9585,7 +9585,7 @@ namespace Slang
{
// Each leaf parameter of interface type adds one slot.
//
- ioSlots.paramTypes.Add(type);
+ ioSlots.paramTypes.add(type);
}
else if( auto structDeclRef = typeDeclRef.as<StructDecl>() )
{
@@ -9621,13 +9621,12 @@ namespace Slang
ExistentialTypeSlots& ioSlots,
DeclRef<VarDeclBase> paramDeclRef)
{
- UInt startSlot = ioSlots.paramTypes.Count();
+ Index startSlot = ioSlots.paramTypes.getCount();
_collectExistentialTypeParamsRec(ioSlots, paramDeclRef);
- UInt endSlot = ioSlots.paramTypes.Count();
- UInt slotCount = endSlot - startSlot;
-
- ioParamInfo.firstExistentialTypeSlot = startSlot;
- ioParamInfo.existentialTypeSlotCount = slotCount;
+ Index endSlot = ioSlots.paramTypes.getCount();
+
+ ioParamInfo.firstExistentialTypeSlot = UInt(startSlot);
+ ioParamInfo.existentialTypeSlotCount = UInt(endSlot - startSlot);;
}
/// Enumerate the existential-type parameters of an `EntryPoint`.
@@ -9652,7 +9651,7 @@ namespace Slang
m_existentialSlots,
paramDeclRef);
- m_shaderParams.Add(shaderParamInfo);
+ m_shaderParams.add(shaderParamInfo);
}
}
}
@@ -9714,7 +9713,7 @@ namespace Slang
if (attr)
{
- if (attr->args.Count() != 1)
+ if (attr->args.getCount() != 1)
{
sink->diagnose(attr, Diagnostics::badlyDefinedPatchConstantFunc, entryPointName);
return;
@@ -9764,7 +9763,7 @@ namespace Slang
{
const auto& semanticToken = semantic->name;
- String lowerName = String(semanticToken.Content).ToLower();
+ String lowerName = String(semanticToken.Content).toLower();
if(lowerName == "sv_dispatchthreadid")
{
@@ -10033,7 +10032,7 @@ static void collectFields(
if(fieldDeclRef.getDecl()->HasModifier<HLSLStaticModifier>())
continue;
- outFields.Add(fieldDeclRef);
+ outFields.add(fieldDeclRef);
}
}
@@ -10112,14 +10111,14 @@ static bool validateGenericSubstitutionsMatch(
- UInt argCount = left->args.Count();
- if( argCount != right->args.Count() )
+ Index argCount = left->args.getCount();
+ if( argCount != right->args.getCount() )
{
diagnoseTypeMismatch(sink, stack);
return false;
}
- for( UInt aa = 0; aa < argCount; ++aa )
+ for( Index aa = 0; aa < argCount; ++aa )
{
auto leftArg = left->args[aa];
auto rightArg = right->args[aa];
@@ -10256,8 +10255,8 @@ static bool validateTypesMatch(
collectFields(leftStructDeclRef, leftFields);
collectFields(rightStructDeclRef, rightFields);
- UInt leftFieldCount = leftFields.Count();
- UInt rightFieldCount = rightFields.Count();
+ Index leftFieldCount = leftFields.getCount();
+ Index rightFieldCount = rightFields.getCount();
if( leftFieldCount != rightFieldCount )
{
@@ -10265,7 +10264,7 @@ static bool validateTypesMatch(
return false;
}
- for( UInt ii = 0; ii < leftFieldCount; ++ii )
+ for( Index ii = 0; ii < leftFieldCount; ++ii )
{
auto leftField = leftFields[ii];
auto rightField = rightFields[ii];
@@ -10399,13 +10398,13 @@ static bool doesParameterMatch(
// consider the new variable to be a redclaration of
// the existing one.
- existingParam.additionalParamDeclRefs.Add(
+ existingParam.additionalParamDeclRefs.add(
makeDeclRef(globalVar.Ptr()));
continue;
}
}
- Int newParamIndex = Int(m_shaderParams.Count());
+ Int newParamIndex = Int(m_shaderParams.getCount());
mapNameToParamIndex.Add(paramName, newParamIndex);
GlobalShaderParamInfo shaderParamInfo;
@@ -10416,7 +10415,7 @@ static bool doesParameterMatch(
m_globalExistentialSlots,
makeDeclRef(globalVar.Ptr()));
- m_shaderParams.Add(shaderParamInfo);
+ m_shaderParams.add(shaderParamInfo);
}
}
}
@@ -10476,7 +10475,7 @@ static bool doesParameterMatch(
if( entryPoint )
{
program->addEntryPoint(entryPoint);
- entryPointReq->getTranslationUnit()->entryPoints.Add(entryPoint);
+ entryPointReq->getTranslationUnit()->entryPoints.add(entryPoint);
}
}
@@ -10501,8 +10500,8 @@ static bool doesParameterMatch(
// For now we'll start with an extremely basic approach that
// should work for typical HLSL code.
//
- UInt translationUnitCount = compileRequest->translationUnits.Count();
- for(UInt tt = 0; tt < translationUnitCount; ++tt)
+ Index translationUnitCount = compileRequest->translationUnits.getCount();
+ for(Index tt = 0; tt < translationUnitCount; ++tt)
{
auto translationUnit = compileRequest->translationUnits[tt];
for( auto globalDecl : translationUnit->getModuleDecl()->Members )
@@ -10542,7 +10541,7 @@ static bool doesParameterMatch(
validateEntryPoint(entryPoint, sink);
program->addEntryPoint(entryPoint);
- translationUnit->entryPoints.Add(entryPoint);
+ translationUnit->entryPoints.add(entryPoint);
}
}
}
@@ -10558,8 +10557,8 @@ static bool doesParameterMatch(
List<RefPtr<Expr>> const& args,
DiagnosticSink* sink)
{
- UInt slotCount = ioSlots.paramTypes.Count();
- UInt argCount = args.Count();
+ Index slotCount = ioSlots.paramTypes.getCount();
+ Index argCount = args.getCount();
if( slotCount != argCount )
{
@@ -10569,7 +10568,7 @@ static bool doesParameterMatch(
SemanticsVisitor visitor(linkage, sink);
- for( UInt ii = 0; ii < slotCount; ++ii )
+ for( Index ii = 0; ii < slotCount; ++ii )
{
auto slotType = ioSlots.paramTypes[ii];
auto argExpr = args[ii];
@@ -10597,7 +10596,7 @@ static bool doesParameterMatch(
ExistentialTypeSlots::Arg arg;
arg.type = argType;
arg.witness = witness;
- ioSlots.args.Add(arg);
+ ioSlots.args.add(arg);
}
}
@@ -10722,7 +10721,7 @@ static bool doesParameterMatch(
//
List<RefPtr<Scope>> scopesToTry;
for( auto module : unspecialiedProgram->getModuleDependencies() )
- scopesToTry.Add(module->getModuleDecl()->scope);
+ scopesToTry.add(module->getModuleDecl()->scope);
// We are going to do some semantic checking, so we need to
// set up a `SemanticsVistitor` that we can use.
@@ -10753,7 +10752,7 @@ static bool doesParameterMatch(
}
}
- outGenericArgs.Add(argExpr);
+ outGenericArgs.add(argExpr);
}
}
@@ -10802,7 +10801,7 @@ static bool doesParameterMatch(
for(auto module : unspecializedProgram->getModuleDependencies())
{
for(auto param : module->getModuleDecl()->getMembersOfType<GlobalGenericParamDecl>())
- globalGenericParams.Add(param);
+ globalGenericParams.add(param);
}
// Next, we will check whether the supplied arguments can
@@ -10811,11 +10810,11 @@ static bool doesParameterMatch(
// An easy early-out case will be if the number of
// arguments isn't correct.
//
- if (globalGenericParams.Count() != globalGenericArgs.Count())
+ if (globalGenericParams.getCount() != globalGenericArgs.getCount())
{
sink->diagnose(SourceLoc(), Diagnostics::mismatchGlobalGenericArguments,
- globalGenericParams.Count(),
- globalGenericArgs.Count());
+ globalGenericParams.getCount(),
+ globalGenericArgs.getCount());
return nullptr;
}
@@ -10847,12 +10846,12 @@ static bool doesParameterMatch(
//
// We will punt on this for now, and just check each constraint in isolation.
//
- UInt argCounter = 0;
+ Index argCounter = 0;
for(auto& globalGenericParam : globalGenericParams)
{
// Get the argument that matches this parameter.
- UInt argIndex = argCounter++;
- SLANG_ASSERT(argIndex < globalGenericArgs.Count());
+ Index argIndex = argCounter++;
+ SLANG_ASSERT(argIndex < globalGenericArgs.getCount());
auto globalGenericArg = checkProperType(linkage, TypeExp(globalGenericArgs[argIndex]), sink);
if (!globalGenericArg)
{
@@ -10919,7 +10918,7 @@ static bool doesParameterMatch(
GlobalGenericParamSubstitution::ConstraintArg constraintArg;
constraintArg.decl = constraint;
constraintArg.val = witness;
- subst->constraintArgs.Add(constraintArg);
+ subst->constraintArgs.add(constraintArg);
}
// Add the substitution for this parameter to the global substitution
@@ -11049,14 +11048,14 @@ static bool doesParameterMatch(
// ahead and consider all the entry points that were found
// by the front-end.
//
- UInt entryPointCount = endToEndReq->entryPoints.Count();
+ Index entryPointCount = endToEndReq->entryPoints.getCount();
if( entryPointCount == 0 )
{
entryPointCount = unspecializedProgram->getEntryPointCount();
- endToEndReq->entryPoints.SetSize(entryPointCount);
+ endToEndReq->entryPoints.setCount(entryPointCount);
}
- for( UInt ii = 0; ii < entryPointCount; ++ii )
+ for( Index ii = 0; ii < entryPointCount; ++ii )
{
auto unspecializedEntryPoint = unspecializedProgram->getEntryPoint(ii);
auto& entryPointInfo = endToEndReq->entryPoints[ii];
@@ -11228,11 +11227,11 @@ static bool doesParameterMatch(
{
if( auto genericTypeParamDecl = as<GenericTypeParamDecl>(mm) )
{
- genericSubst->args.Add(DeclRefType::Create(session, DeclRef<Decl>(genericTypeParamDecl, outerSubst)));
+ genericSubst->args.add(DeclRefType::Create(session, DeclRef<Decl>(genericTypeParamDecl, outerSubst)));
}
else if( auto genericValueParamDecl = as<GenericValueParamDecl>(mm) )
{
- genericSubst->args.Add(new GenericParamIntVal(DeclRef<GenericValueParamDecl>(genericValueParamDecl, outerSubst)));
+ genericSubst->args.add(new GenericParamIntVal(DeclRef<GenericValueParamDecl>(genericValueParamDecl, outerSubst)));
}
}
@@ -11245,7 +11244,7 @@ static bool doesParameterMatch(
witness->declRef = DeclRef<Decl>(genericTypeConstraintDecl, outerSubst);
witness->sub = genericTypeConstraintDecl->sub.type;
witness->sup = genericTypeConstraintDecl->sup.type;
- genericSubst->args.Add(witness);
+ genericSubst->args.add(witness);
}
}
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp
index 1222d91d2..83a579345 100644
--- a/source/slang/compiler.cpp
+++ b/source/slang/compiler.cpp
@@ -90,11 +90,11 @@ namespace Slang
if (appendTo == ResultFormat::Text)
{
- outputString.append(result.outputString.Buffer());
+ outputString.append(result.outputString.getBuffer());
}
else if (appendTo == ResultFormat::Binary)
{
- outputBinary.AddRange(result.outputBinary.Buffer(), result.outputBinary.Count());
+ outputBinary.addRange(result.outputBinary.getBuffer(), result.outputBinary.getCount());
}
}
@@ -113,7 +113,7 @@ namespace Slang
break;
case ResultFormat::Binary:
- blob = createRawBlob(outputBinary.Buffer(), outputBinary.Count());
+ blob = createRawBlob(outputBinary.getBuffer(), outputBinary.getCount());
break;
}
}
@@ -221,7 +221,7 @@ namespace Slang
{
if( auto taggedUnionType = as<TaggedUnionType>(arg) )
{
- m_taggedUnionTypes.Add(taggedUnionType);
+ m_taggedUnionTypes.add(taggedUnionType);
}
}
}
@@ -634,7 +634,7 @@ namespace Slang
const auto& sourceFiles = translationUnitRequest->getSourceFiles();
- const int numSourceFiles = int(sourceFiles.Count());
+ const Index numSourceFiles = sourceFiles.getCount();
switch (numSourceFiles)
{
@@ -675,7 +675,7 @@ namespace Slang
EndToEndCompileRequest* endToEndReq,
List<uint8_t>& byteCodeOut)
{
- byteCodeOut.Clear();
+ byteCodeOut.clear();
auto session = compileRequest->getSession();
auto sink = compileRequest->getSink();
@@ -687,7 +687,7 @@ namespace Slang
}
auto hlslCode = emitHLSLForEntryPoint(compileRequest, entryPoint, entryPointIndex, targetReq, endToEndReq);
- maybeDumpIntermediate(compileRequest, hlslCode.Buffer(), CodeGenTarget::HLSL);
+ maybeDumpIntermediate(compileRequest, hlslCode.getBuffer(), CodeGenTarget::HLSL);
auto profile = getEffectiveProfile(entryPoint, targetReq);
@@ -704,21 +704,21 @@ namespace Slang
for( auto& define : translationUnit->compileRequest->preprocessorDefinitions )
{
D3D_SHADER_MACRO dxMacro;
- dxMacro.Name = define.Key.Buffer();
- dxMacro.Definition = define.Value.Buffer();
- dxMacrosStorage.Add(dxMacro);
+ dxMacro.Name = define.Key.getBuffer();
+ dxMacro.Definition = define.Value.getBuffer();
+ dxMacrosStorage.add(dxMacro);
}
for( auto& define : translationUnit->preprocessorDefinitions )
{
D3D_SHADER_MACRO dxMacro;
- dxMacro.Name = define.Key.Buffer();
- dxMacro.Definition = define.Value.Buffer();
- dxMacrosStorage.Add(dxMacro);
+ dxMacro.Name = define.Key.getBuffer();
+ dxMacro.Definition = define.Value.getBuffer();
+ dxMacrosStorage.add(dxMacro);
}
D3D_SHADER_MACRO nullTerminator = { 0, 0 };
- dxMacrosStorage.Add(nullTerminator);
+ dxMacrosStorage.add(nullTerminator);
- dxMacros = dxMacrosStorage.Buffer();
+ dxMacros = dxMacrosStorage.getBuffer();
}
DWORD flags = 0;
@@ -774,12 +774,12 @@ namespace Slang
ComPtr<ID3DBlob> diagnosticsBlob;
HRESULT hr = compileFunc(
hlslCode.begin(),
- hlslCode.Length(),
- sourcePath.Buffer(),
+ hlslCode.getLength(),
+ sourcePath.getBuffer(),
dxMacros,
nullptr,
getText(entryPoint->getName()).begin(),
- GetHLSLProfileName(profile).Buffer(),
+ GetHLSLProfileName(profile).getBuffer(),
flags,
0, // unused: effect flags
codeBlob.writeRef(),
@@ -787,7 +787,7 @@ namespace Slang
if (codeBlob && SLANG_SUCCEEDED(hr))
{
- byteCodeOut.AddRange((uint8_t const*)codeBlob->GetBufferPointer(), (int)codeBlob->GetBufferSize());
+ byteCodeOut.addRange((uint8_t const*)codeBlob->GetBufferPointer(), (int)codeBlob->GetBufferSize());
}
if (FAILED(hr))
@@ -853,11 +853,11 @@ namespace Slang
targetReq,
endToEndReq,
dxbc));
- if (!dxbc.Count())
+ if (!dxbc.getCount())
{
return SLANG_FAIL;
}
- return dissassembleDXBC(compileRequest, dxbc.Buffer(), dxbc.Count(), assemOut);
+ return dissassembleDXBC(compileRequest, dxbc.getBuffer(), dxbc.getCount(), assemOut);
}
#endif
@@ -955,7 +955,7 @@ SlangResult dissassembleDXILUsingDXC(
EndToEndCompileRequest* endToEndReq,
List<uint8_t>& spirvOut)
{
- spirvOut.Clear();
+ spirvOut.clear();
String rawGLSL = emitGLSLForEntryPoint(
slangRequest,
@@ -963,18 +963,18 @@ SlangResult dissassembleDXILUsingDXC(
entryPointIndex,
targetReq,
endToEndReq);
- maybeDumpIntermediate(slangRequest, rawGLSL.Buffer(), CodeGenTarget::GLSL);
+ maybeDumpIntermediate(slangRequest, rawGLSL.getBuffer(), CodeGenTarget::GLSL);
auto outputFunc = [](void const* data, size_t size, void* userData)
{
- ((List<uint8_t>*)userData)->AddRange((uint8_t*)data, size);
+ ((List<uint8_t>*)userData)->addRange((uint8_t*)data, size);
};
const String sourcePath = calcSourcePathForEntryPoint(endToEndReq, entryPointIndex);
glslang_CompileRequest request;
request.action = GLSLANG_ACTION_COMPILE_GLSL_TO_SPIRV;
- request.sourcePath = sourcePath.Buffer();
+ request.sourcePath = sourcePath.getBuffer();
request.slangStage = (SlangStage)entryPoint->getStage();
request.inputBegin = rawGLSL.begin();
@@ -1004,10 +1004,10 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
spirv));
- if (spirv.Count() == 0)
+ if (spirv.getCount() == 0)
return SLANG_FAIL;
- return dissassembleSPIRV(slangRequest, spirv.begin(), spirv.Count(), assemblyOut);
+ return dissassembleSPIRV(slangRequest, spirv.begin(), spirv.getCount(), assemblyOut);
}
#endif
@@ -1033,7 +1033,7 @@ SlangResult dissassembleDXILUsingDXC(
entryPointIndex,
targetReq,
endToEndReq);
- maybeDumpIntermediate(compileRequest, code.Buffer(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), target);
result = CompileResult(code);
}
break;
@@ -1046,7 +1046,7 @@ SlangResult dissassembleDXILUsingDXC(
entryPointIndex,
targetReq,
endToEndReq);
- maybeDumpIntermediate(compileRequest, code.Buffer(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), target);
result = CompileResult(code);
}
break;
@@ -1063,7 +1063,7 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
code)))
{
- maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), code.getCount(), target);
result = CompileResult(code);
}
}
@@ -1080,7 +1080,7 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
code)))
{
- maybeDumpIntermediate(compileRequest, code.Buffer(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), target);
result = CompileResult(code);
}
}
@@ -1099,7 +1099,7 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
code)))
{
- maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), code.getCount(), target);
result = CompileResult(code);
}
}
@@ -1119,11 +1119,11 @@ SlangResult dissassembleDXILUsingDXC(
String assembly;
dissassembleDXILUsingDXC(
compileRequest,
- code.Buffer(),
- code.Count(),
+ code.getBuffer(),
+ code.getCount(),
assembly);
- maybeDumpIntermediate(compileRequest, assembly.Buffer(), target);
+ maybeDumpIntermediate(compileRequest, assembly.getBuffer(), target);
result = CompileResult(assembly);
}
@@ -1142,7 +1142,7 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
code)))
{
- maybeDumpIntermediate(compileRequest, code.Buffer(), code.Count(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), code.getCount(), target);
result = CompileResult(code);
}
}
@@ -1159,7 +1159,7 @@ SlangResult dissassembleDXILUsingDXC(
endToEndReq,
code)))
{
- maybeDumpIntermediate(compileRequest, code.Buffer(), target);
+ maybeDumpIntermediate(compileRequest, code.getBuffer(), target);
result = CompileResult(code);
}
}
@@ -1229,7 +1229,7 @@ SlangResult dissassembleDXILUsingDXC(
OutputFileKind kind)
{
FILE* file = fopen(
- path.Buffer(),
+ path.getBuffer(),
kind == OutputFileKind::Binary ? "wb" : "w");
if (!file)
{
@@ -1287,7 +1287,7 @@ SlangResult dissassembleDXILUsingDXC(
ISlangWriter* writer,
String const& text)
{
- writer->write(text.Buffer(), text.Length());
+ writer->write(text.getBuffer(), text.getLength());
}
static void writeEntryPointResultToStandardOutput(
@@ -1425,7 +1425,7 @@ SlangResult dissassembleDXILUsingDXC(
// Generate target code any entry points that
// have been requested for compilation.
auto entryPointCount = program->getEntryPointCount();
- for(UInt ii = 0; ii < entryPointCount; ++ii)
+ for(Index ii = 0; ii < entryPointCount; ++ii)
{
auto entryPoint = program->getEntryPoint(ii);
CompileResult entryPointResult = emitEntryPoint(
@@ -1472,8 +1472,8 @@ SlangResult dissassembleDXILUsingDXC(
auto program = compileRequest->getSpecializedProgram();
for (auto targetReq : linkage->targets)
{
- UInt entryPointCount = program->getEntryPointCount();
- for (UInt ee = 0; ee < entryPointCount; ++ee)
+ Index entryPointCount = program->getEntryPointCount();
+ for (Index ee = 0; ee < entryPointCount; ++ee)
{
writeEntryPointResult(
compileRequest,
@@ -1516,7 +1516,7 @@ SlangResult dissassembleDXILUsingDXC(
path.append(id);
path.append(ext);
- FILE* file = fopen(path.Buffer(), isBinary ? "wb" : "w");
+ FILE* file = fopen(path.getBuffer(), isBinary ? "wb" : "w");
if (!file) return;
fwrite(data, size, 1, file);
@@ -1578,7 +1578,7 @@ SlangResult dissassembleDXILUsingDXC(
{
String spirvAssembly;
dissassembleSPIRV(compileRequest, data, size, spirvAssembly);
- dumpIntermediateText(compileRequest, spirvAssembly.begin(), spirvAssembly.Length(), ".spv.asm");
+ dumpIntermediateText(compileRequest, spirvAssembly.begin(), spirvAssembly.getLength(), ".spv.asm");
}
break;
@@ -1592,7 +1592,7 @@ SlangResult dissassembleDXILUsingDXC(
{
String dxbcAssembly;
dissassembleDXBC(compileRequest, data, size, dxbcAssembly);
- dumpIntermediateText(compileRequest, dxbcAssembly.begin(), dxbcAssembly.Length(), ".dxbc.asm");
+ dumpIntermediateText(compileRequest, dxbcAssembly.begin(), dxbcAssembly.getLength(), ".dxbc.asm");
}
break;
#endif
@@ -1607,7 +1607,7 @@ SlangResult dissassembleDXILUsingDXC(
{
String dxilAssembly;
dissassembleDXILUsingDXC(compileRequest, data, size, dxilAssembly);
- dumpIntermediateText(compileRequest, dxilAssembly.begin(), dxilAssembly.Length(), ".dxil.asm");
+ dumpIntermediateText(compileRequest, dxilAssembly.begin(), dxilAssembly.getLength(), ".dxil.asm");
}
break;
#endif
diff --git a/source/slang/compiler.h b/source/slang/compiler.h
index 5199d2540..233fa3d05 100644
--- a/source/slang/compiler.h
+++ b/source/slang/compiler.h
@@ -321,22 +321,22 @@ namespace Slang
Profile profile);
/// Get the number of existential type parameters for the entry point.
- UInt getExistentialTypeParamCount() { return m_existentialSlots.paramTypes.Count(); }
+ Index getExistentialTypeParamCount() { return m_existentialSlots.paramTypes.getCount(); }
/// Get the existential type parameter at `index`.
- Type* getExistentialTypeParam(UInt index) { return m_existentialSlots.paramTypes[index]; }
+ Type* getExistentialTypeParam(Index index) { return m_existentialSlots.paramTypes[index]; }
/// Get the number of arguments supplied for existential type parameters.
///
/// Note that the number of arguments may not match the number of parameters.
/// In particular, an unspecialized entry point may have many parameters, but zero arguments.
- UInt getExistentialTypeArgCount() { return m_existentialSlots.args.Count(); }
+ Index getExistentialTypeArgCount() { return m_existentialSlots.args.getCount(); }
/// Get the existential type argument (type and witness table) at `index`.
- ExistentialTypeSlots::Arg getExistentialTypeArg(UInt index) { return m_existentialSlots.args[index]; }
+ ExistentialTypeSlots::Arg getExistentialTypeArg(Index index) { return m_existentialSlots.args[index]; }
/// Get an array of all existential type arguments.
- ExistentialTypeSlots::Arg const* getExistentialTypeArgs() { return m_existentialSlots.args.Buffer(); }
+ ExistentialTypeSlots::Arg const* getExistentialTypeArgs() { return m_existentialSlots.args.getBuffer(); }
/// Get an array of all entry-point shader parameters.
List<ShaderParamInfo> const& getShaderParams() { return m_shaderParams; }
@@ -827,7 +827,7 @@ namespace Slang
List<RefPtr<FrontEndEntryPointRequest>> m_entryPointReqs;
List<RefPtr<FrontEndEntryPointRequest>> const& getEntryPointReqs() { return m_entryPointReqs; }
- UInt getEntryPointReqCount() { return m_entryPointReqs.Count(); }
+ UInt getEntryPointReqCount() { return m_entryPointReqs.getCount(); }
FrontEndEntryPointRequest* getEntryPointReq(UInt index) { return m_entryPointReqs[index]; }
// Directories to search for `#include` files or `import`ed modules
@@ -913,10 +913,10 @@ namespace Slang
Linkage* getLinkage() { return m_linkage; }
/// Get the number of entry points added to the program
- UInt getEntryPointCount() { return m_entryPoints.Count(); }
+ Index getEntryPointCount() { return m_entryPoints.getCount(); }
/// Get the entry point at the given `index`.
- RefPtr<EntryPoint> getEntryPoint(UInt index) { return m_entryPoints[index]; }
+ RefPtr<EntryPoint> getEntryPoint(Index index) { return m_entryPoints[index]; }
/// Get the full ist of entry points on the program.
List<RefPtr<EntryPoint>> const& getEntryPoints() { return m_entryPoints; }
@@ -980,22 +980,22 @@ namespace Slang
RefPtr<IRModule> getOrCreateIRModule(DiagnosticSink* sink);
/// Get the number of existential type parameters for the program.
- UInt getExistentialTypeParamCount() { return m_globalExistentialSlots.paramTypes.Count(); }
+ Index getExistentialTypeParamCount() { return m_globalExistentialSlots.paramTypes.getCount(); }
/// Get the existential type parameter at `index`.
- Type* getExistentialTypeParam(UInt index) { return m_globalExistentialSlots.paramTypes[index]; }
+ Type* getExistentialTypeParam(Index index) { return m_globalExistentialSlots.paramTypes[index]; }
/// Get the number of arguments supplied for existential type parameters.
///
/// Note that the number of arguments may not match the number of parameters.
/// In particular, an unspecialized program may have many parameters, but zero arguments.
- UInt getExistentialTypeArgCount() { return m_globalExistentialSlots.args.Count(); }
+ Index getExistentialTypeArgCount() { return m_globalExistentialSlots.args.getCount(); }
/// Get the existential type argument (type and witness table) at `index`.
- ExistentialTypeSlots::Arg getExistentialTypeArg(UInt index) { return m_globalExistentialSlots.args[index]; }
+ ExistentialTypeSlots::Arg getExistentialTypeArg(Index index) { return m_globalExistentialSlots.args[index]; }
/// Get an array of all existential type arguments.
- ExistentialTypeSlots::Arg const* getExistentialTypeArgs() { return m_globalExistentialSlots.args.Buffer(); }
+ ExistentialTypeSlots::Arg const* getExistentialTypeArgs() { return m_globalExistentialSlots.args.getBuffer(); }
/// Get an array of all global shader parameters.
List<GlobalShaderParamInfo> const& getShaderParams() { return m_shaderParams; }
diff --git a/source/slang/diagnostics.cpp b/source/slang/diagnostics.cpp
index 4edea57a2..a947e7369 100644
--- a/source/slang/diagnostics.cpp
+++ b/source/slang/diagnostics.cpp
@@ -23,15 +23,24 @@ void printDiagnosticArg(StringBuilder& sb, char const* str)
sb << str;
}
-void printDiagnosticArg(StringBuilder& sb, int str)
+void printDiagnosticArg(StringBuilder& sb, int32_t val)
{
- sb << str;
+ sb << val;
+}
+
+void printDiagnosticArg(StringBuilder& sb, uint32_t val)
+{
+ sb << val;
+}
+
+void printDiagnosticArg(StringBuilder& sb, int64_t val)
+{
+ sb << val;
}
-void printDiagnosticArg(StringBuilder& sb, UInt val)
+void printDiagnosticArg(StringBuilder& sb, uint64_t val)
{
- // TODO: make this robust
- sb << (int) val;
+ sb << val;
}
void printDiagnosticArg(StringBuilder& sb, Slang::String const& str)
@@ -278,7 +287,7 @@ void DiagnosticSink::diagnoseImpl(SourceLoc const& pos, DiagnosticInfo const& in
StringBuilder messageBuilder;
formatDiagnostic(this, diagnostic, messageBuilder);
- writer->write(messageBuilder.Buffer(), messageBuilder.Length());
+ writer->write(messageBuilder.getBuffer(), messageBuilder.getLength());
}
else
{
diff --git a/source/slang/diagnostics.h b/source/slang/diagnostics.h
index 72c272fa0..7d76ffa85 100644
--- a/source/slang/diagnostics.h
+++ b/source/slang/diagnostics.h
@@ -80,8 +80,13 @@ namespace Slang
enum class ProfileVersion;
void printDiagnosticArg(StringBuilder& sb, char const* str);
- void printDiagnosticArg(StringBuilder& sb, int val);
- void printDiagnosticArg(StringBuilder& sb, UInt val);
+
+ void printDiagnosticArg(StringBuilder& sb, int32_t val);
+ void printDiagnosticArg(StringBuilder& sb, uint32_t val);
+
+ void printDiagnosticArg(StringBuilder& sb, int64_t val);
+ void printDiagnosticArg(StringBuilder& sb, uint64_t val);
+
void printDiagnosticArg(StringBuilder& sb, Slang::String const& str);
void printDiagnosticArg(StringBuilder& sb, Slang::UnownedStringSlice const& str);
void printDiagnosticArg(StringBuilder& sb, Name* name);
diff --git a/source/slang/dxc-support.cpp b/source/slang/dxc-support.cpp
index cab94e74b..b6eaf8aa9 100644
--- a/source/slang/dxc-support.cpp
+++ b/source/slang/dxc-support.cpp
@@ -99,15 +99,15 @@ namespace Slang
entryPointIndex,
targetReq,
endToEndReq);
- maybeDumpIntermediate(compileRequest, hlslCode.Buffer(), CodeGenTarget::HLSL);
+ maybeDumpIntermediate(compileRequest, hlslCode.getBuffer(), CodeGenTarget::HLSL);
// Wrap the
// Create blob from the string
ComPtr<IDxcBlobEncoding> dxcSourceBlob;
SLANG_RETURN_ON_FAIL(dxcLibrary->CreateBlobWithEncodingFromPinned(
- (LPBYTE)hlslCode.Buffer(),
- (UINT32)hlslCode.Length(),
+ (LPBYTE)hlslCode.getBuffer(),
+ (UINT32)hlslCode.getLength(),
0,
dxcSourceBlob.writeRef()));
@@ -181,11 +181,11 @@ namespace Slang
args[argCount++] = L"-no-warnings";
String entryPointName = getText(entryPoint->getName());
- OSString wideEntryPointName = entryPointName.ToWString();
+ OSString wideEntryPointName = entryPointName.toWString();
auto profile = getEffectiveProfile(entryPoint, targetReq);
String profileName = GetHLSLProfileName(profile);
- OSString wideProfileName = profileName.ToWString();
+ OSString wideProfileName = profileName.toWString();
// We will enable the flag to generate proper code for 16-bit types
// by default, as long as the user is requesting a sufficiently
@@ -207,7 +207,7 @@ namespace Slang
ComPtr<IDxcOperationResult> dxcResult;
SLANG_RETURN_ON_FAIL(dxcCompiler->Compile(dxcSourceBlob,
- sourcePath.ToWString().begin(),
+ sourcePath.toWString().begin(),
profile.GetStage() == Stage::Unknown ? L"" : wideEntryPointName.begin(),
wideProfileName.begin(),
args,
@@ -248,7 +248,7 @@ namespace Slang
ComPtr<IDxcBlob> dxcResultBlob;
SLANG_RETURN_ON_FAIL(dxcResult->GetResult(dxcResultBlob.writeRef()));
- outCode.AddRange(
+ outCode.addRange(
(uint8_t const*)dxcResultBlob->GetBufferPointer(),
(int) dxcResultBlob->GetBufferSize());
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 8bb2a244b..24d1ce56c 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -1490,7 +1490,7 @@ struct EmitVisitor
// If no target name was specified, then the modifier implicitly
// applies to all targets.
- if(targetName.Length() == 0)
+ if(targetName.getLength() == 0)
return true;
return isTargetIntrinsicModifierApplicable(targetName);
@@ -2105,7 +2105,7 @@ struct EmitVisitor
char const* dummyChar = "U";
// Special case a name that is the empty string, just in case.
- if(name.Length() == 0)
+ if(name.getLength() == 0)
return dummyChar;
// Otherwise, we are going to walk over the name byte by byte
@@ -2117,7 +2117,7 @@ struct EmitVisitor
// GLSL reserverse all names that start with `gl_`,
// so if we are in danger of collision, then make
// our name start with a dummy character instead.
- if(name.StartsWith("gl_"))
+ if(name.startsWith("gl_"))
{
sb.append(dummyChar);
}
@@ -2126,7 +2126,7 @@ struct EmitVisitor
// We will also detect user-defined names that
// might overlap with our convention for mangled names,
// to avoid an possible collision.
- if(name.StartsWith("_S"))
+ if(name.startsWith("_S"))
{
sb.Append(dummyChar);
}
@@ -2259,7 +2259,7 @@ struct EmitVisitor
sb.append(nameHint);
// Avoid introducing a double underscore
- if(!nameHint.EndsWith("_"))
+ if(!nameHint.endsWith("_"))
{
sb.append("_");
}
@@ -3037,7 +3037,7 @@ struct EmitVisitor
auto outerPrec = inOuterPrec;
IRUse* args = inst->getOperands();
- UInt argCount = inst->getOperandCount();
+ Index argCount = inst->getOperandCount();
// First operand was the function to be called
args++;
@@ -3053,7 +3053,7 @@ struct EmitVisitor
emit(name);
Emit("(");
- for (UInt aa = 0; aa < argCount; ++aa)
+ for (Index aa = 0; aa < argCount; ++aa)
{
if (aa != 0) Emit(", ");
emitIROperand(ctx, args[aa].get(), mode, kEOp_General);
@@ -3100,7 +3100,7 @@ struct EmitVisitor
case '5': case '6': case '7': case '8': case '9':
{
// Simple case: emit one of the direct arguments to the call
- UInt argIndex = d - '0';
+ Index argIndex = d - '0';
SLANG_RELEASE_ASSERT((0 <= argIndex) && (argIndex < argCount));
Emit("(");
emitIROperand(ctx, args[argIndex].get(), mode, kEOp_General);
@@ -3223,7 +3223,7 @@ struct EmitVisitor
// we can use it in the constructed expression.
SLANG_RELEASE_ASSERT(*cursor >= '0' && *cursor <= '9');
- UInt argIndex = (*cursor++) - '0';
+ Index argIndex = (*cursor++) - '0';
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto vectorArg = args[argIndex].get();
@@ -3246,7 +3246,7 @@ struct EmitVisitor
// (this is the inverse of `$z`).
//
SLANG_RELEASE_ASSERT(*cursor >= '0' && *cursor <= '9');
- UInt argIndex = (*cursor++) - '0';
+ Index argIndex = (*cursor++) - '0';
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto arg = args[argIndex].get();
@@ -3303,7 +3303,7 @@ struct EmitVisitor
// with the front-end picking the right overload
// based on the "address space" of the argument.
- UInt argIndex = 0;
+ Index argIndex = 0;
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto arg = args[argIndex].get();
@@ -3328,7 +3328,7 @@ struct EmitVisitor
// to the `imageAtomic*` function.
//
- UInt argIndex = 0;
+ Index argIndex = 0;
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto arg = args[argIndex].get();
@@ -3411,7 +3411,7 @@ struct EmitVisitor
// used as the argument ray payload at a
// trace call site.
- UInt argIndex = 0;
+ Index argIndex = 0;
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto arg = args[argIndex].get();
auto argLoad = as<IRLoad>(arg);
@@ -3428,7 +3428,7 @@ struct EmitVisitor
// used as the argument callable payload at a
// call site.
- UInt argIndex = 0;
+ Index argIndex = 0;
SLANG_RELEASE_ASSERT(argCount > argIndex);
auto arg = args[argIndex].get();
auto argLoad = as<IRLoad>(arg);
@@ -4105,8 +4105,8 @@ struct EmitVisitor
auto ii = (IRSwizzle*)inst;
emitIROperand(ctx, ii->getBase(), mode, leftSide(outerPrec, prec));
emit(".");
- UInt elementCount = ii->getElementCount();
- for (UInt ee = 0; ee < elementCount; ++ee)
+ const Index elementCount = Index(ii->getElementCount());
+ for (Index ee = 0; ee < elementCount; ++ee)
{
IRInst* irElementIndex = ii->getElementIndex(ee);
SLANG_RELEASE_ASSERT(irElementIndex->op == kIROp_IntLit);
@@ -4816,8 +4816,8 @@ struct EmitVisitor
{
assert(attrib);
- attrib->args.Count();
- if (attrib->args.Count() != 1)
+ attrib->args.getCount();
+ if (attrib->args.getCount() != 1)
{
SLANG_DIAGNOSE_UNEXPECTED(getSink(), entryPoint->loc, "Attribute expects single parameter");
return;
@@ -4843,8 +4843,8 @@ struct EmitVisitor
{
assert(attrib);
- attrib->args.Count();
- if (attrib->args.Count() != 1)
+ attrib->args.getCount();
+ if (attrib->args.getCount() != 1)
{
SLANG_DIAGNOSE_UNEXPECTED(getSink(), entryPoint->loc, "Attribute expects single parameter");
return;
@@ -6814,7 +6814,7 @@ struct EmitVisitor
}
ctx->mapInstToLevel[inst] = requiredLevel;
- ctx->actions->Add(action);
+ ctx->actions->add(action);
}
void computeIREmitActions(
diff --git a/source/slang/ir-bind-existentials.cpp b/source/slang/ir-bind-existentials.cpp
index f87a7d233..f0c02dd67 100644
--- a/source/slang/ir-bind-existentials.cpp
+++ b/source/slang/ir-bind-existentials.cpp
@@ -285,7 +285,7 @@ struct BindExistentialSlots
UInt slotOperandCount = slotCount*2;
List<IRInst*> slotOperands;
for(UInt ii = 0; ii < slotOperandCount; ++ii)
- slotOperands.Add(slotArgs[ii].get());
+ slotOperands.add(slotArgs[ii].get());
// We are going to create a proxy type that represents
// the results of plugging all the information
@@ -294,7 +294,7 @@ struct BindExistentialSlots
auto newType = builder.getBindExistentialsType(
fullType,
slotOperandCount,
- slotOperands.Buffer());
+ slotOperands.getBuffer());
// We will replace the type of the original parameter
// with the new proxy type.
@@ -315,7 +315,7 @@ struct BindExistentialSlots
//
List<IRUse*> usesToReplace;
for(auto use = inst->firstUse; use; use = use->nextUse )
- usesToReplace.Add(use);
+ usesToReplace.add(use);
// Now we can loop over our list of uses and replace each.
//
@@ -329,7 +329,7 @@ struct BindExistentialSlots
fullType,
inst,
slotOperandCount,
- slotOperands.Buffer());
+ slotOperands.getBuffer());
// Second we make the use site point at the new
// value instead.
diff --git a/source/slang/ir-clone.cpp b/source/slang/ir-clone.cpp
index bd5f9bcaa..d26b470d6 100644
--- a/source/slang/ir-clone.cpp
+++ b/source/slang/ir-clone.cpp
@@ -176,7 +176,7 @@ static void _cloneInstDecorationsAndChildren(
IRCloningOldNewPair pair;
pair.oldInst = oldChild;
pair.newInst = newChild;
- pairs.Add(pair);
+ pairs.add(pair);
}
}
@@ -271,9 +271,9 @@ void cloneDecoration(
bool IRSimpleSpecializationKey::operator==(IRSimpleSpecializationKey const& other) const
{
- auto valCount = vals.Count();
- if(valCount != other.vals.Count()) return false;
- for( UInt ii = 0; ii < valCount; ++ii )
+ auto valCount = vals.getCount();
+ if(valCount != other.vals.getCount()) return false;
+ for( Index ii = 0; ii < valCount; ++ii )
{
if(vals[ii] != other.vals[ii]) return false;
}
@@ -282,9 +282,9 @@ bool IRSimpleSpecializationKey::operator==(IRSimpleSpecializationKey const& othe
int IRSimpleSpecializationKey::GetHashCode() const
{
- auto valCount = vals.Count();
+ auto valCount = vals.getCount();
int hash = Slang::GetHashCode(valCount);
- for( UInt ii = 0; ii < valCount; ++ii )
+ for( Index ii = 0; ii < valCount; ++ii )
{
hash = combineHash(hash, Slang::GetHashCode(vals[ii]));
}
diff --git a/source/slang/ir-constexpr.cpp b/source/slang/ir-constexpr.cpp
index 163f3d98a..c56a15663 100644
--- a/source/slang/ir-constexpr.cpp
+++ b/source/slang/ir-constexpr.cpp
@@ -162,7 +162,7 @@ void maybeAddToWorkList(
{
if( !context->onWorkList.Contains(gv) )
{
- context->workList.Add(gv);
+ context->workList.add(gv);
context->onWorkList.Add(gv);
}
}
@@ -489,10 +489,10 @@ void propagateConstExpr(
// We will iterate applying propagation to one global value at a time
// until we run out.
- while( context.workList.Count() )
+ while( context.workList.getCount() )
{
auto gv = context.workList[0];
- context.workList.FastRemoveAt(0);
+ context.workList.fastRemoveAt(0);
context.onWorkList.Remove(gv);
switch( gv->op )
diff --git a/source/slang/ir-dce.cpp b/source/slang/ir-dce.cpp
index ba6d7adb9..f1a34bedf 100644
--- a/source/slang/ir-dce.cpp
+++ b/source/slang/ir-dce.cpp
@@ -74,7 +74,7 @@ struct DeadCodeEliminationContext
if(liveInsts.Contains(inst))
return;
liveInsts.Add(inst);
- workList.Add(inst);
+ workList.add(inst);
}
// Given the basic infrastructrure above, let's
@@ -95,10 +95,10 @@ struct DeadCodeEliminationContext
// processing entries off of our work list
// until it goes dry.
//
- while( workList.Count() )
+ while( workList.getCount() )
{
- auto inst = workList.Last();
- workList.RemoveLast();
+ auto inst = workList.getLast();
+ workList.removeLast();
// At this point we know that `inst` is live,
// and we want to start considering which other
diff --git a/source/slang/ir-dominators.cpp b/source/slang/ir-dominators.cpp
index ad1639db5..488e67724 100644
--- a/source/slang/ir-dominators.cpp
+++ b/source/slang/ir-dominators.cpp
@@ -245,7 +245,7 @@ struct PostorderComputationContext : public DepthFirstSearchContext
virtual void postVisit(IRBlock* block) SLANG_OVERRIDE
{
- order->Add(block);
+ order->add(block);
}
};
@@ -314,7 +314,7 @@ struct DominatorTreeComputationContext
// We will initialize our map from the block objects to their "name"
// (index in the traversal order), before moving on.
- BlockName blockCount = BlockName(postorder.Count());
+ BlockName blockCount = BlockName(postorder.getCount());
for(BlockName bb = 0; bb < blockCount; ++bb)
{
mapBlockToName[postorder[bb]] = bb;
@@ -322,7 +322,7 @@ struct DominatorTreeComputationContext
// Next we initialize the `doms` array that we will iteratively turn
// into an encoding of the dominator tree.
- doms.SetSize(blockCount);
+ doms.setCount(blockCount);
for(BlockName bb = 0; bb < blockCount; ++bb)
{
doms[bb] = kUndefined;
@@ -524,11 +524,11 @@ struct DominatorTreeComputationContext
// We will build some intermediate information on each
// block to help us fill out the tree.
- BlockName blockCount = BlockName(doms.Count());
+ BlockName blockCount = BlockName(doms.getCount());
List<BlockInfo> blockInfos;
for(BlockName bb = 0; bb < blockCount; ++bb)
{
- blockInfos.Add(BlockInfo());
+ blockInfos.add(BlockInfo());
}
// We will propagate layout information in two passes over the tree.
@@ -626,7 +626,7 @@ struct DominatorTreeComputationContext
//
RefPtr<IRDominatorTree> dominatorTree = new IRDominatorTree();
dominatorTree->code = code;
- dominatorTree->nodes.SetSize(blockCount);
+ dominatorTree->nodes.setCount(blockCount);
// We will iterate over all of the blocks, and fill in the corresponding
// dominator tree node for each.
diff --git a/source/slang/ir-entry-point-uniforms.cpp b/source/slang/ir-entry-point-uniforms.cpp
index 501af56cf..6ee05611d 100644
--- a/source/slang/ir-entry-point-uniforms.cpp
+++ b/source/slang/ir-entry-point-uniforms.cpp
@@ -373,7 +373,7 @@ struct MoveEntryPointUniformParametersToGlobalScope
// Note: an empty `struct` parameter would also show up the same way, but
// we should eliminate any such parameters later on during type legalization.
//
- if(layout->resourceInfos.Count() == 0)
+ if(layout->resourceInfos.getCount() == 0)
return true;
// if none of the above tests determined that the
diff --git a/source/slang/ir-glsl-legalize.cpp b/source/slang/ir-glsl-legalize.cpp
index 3811346a5..aa6eb187f 100644
--- a/source/slang/ir-glsl-legalize.cpp
+++ b/source/slang/ir-glsl-legalize.cpp
@@ -224,10 +224,10 @@ GLSLSystemValueInfo* getGLSLSystemValueInfo(
char const* outerArrayName = nullptr;
auto semanticNameSpelling = varLayout->systemValueSemantic;
- if(semanticNameSpelling.Length() == 0)
+ if(semanticNameSpelling.getLength() == 0)
return nullptr;
- auto semanticName = semanticNameSpelling.ToLower();
+ auto semanticName = semanticNameSpelling.toLower();
IRType* requiredType = nullptr;
@@ -698,7 +698,7 @@ ScalarizedVal createGLSLGlobalVaryingsImpl(
element.val = fieldVal;
element.key = field->getKey();
- tupleValImpl->elements.Add(element);
+ tupleValImpl->elements.add(element);
}
}
@@ -835,9 +835,9 @@ void assign(
// that is not a tuple. We will perform assignment
// element-by-element.
auto rightTupleVal = as<ScalarizedTupleValImpl>(right.impl);
- UInt elementCount = rightTupleVal->elements.Count();
+ Index elementCount = rightTupleVal->elements.getCount();
- for( UInt ee = 0; ee < elementCount; ++ee )
+ for( Index ee = 0; ee < elementCount; ++ee )
{
auto rightElement = rightTupleVal->elements[ee];
auto leftElementVal = extractField(
@@ -861,9 +861,9 @@ void assign(
// We have a tuple, so we are going to need to try and assign
// to each of its constituent fields.
auto leftTupleVal = as<ScalarizedTupleValImpl>(left.impl);
- UInt elementCount = leftTupleVal->elements.Count();
+ Index elementCount = leftTupleVal->elements.getCount();
- for( UInt ee = 0; ee < elementCount; ++ee )
+ for( Index ee = 0; ee < elementCount; ++ee )
{
auto rightElementVal = extractField(
builder,
@@ -923,15 +923,15 @@ ScalarizedVal getSubscriptVal(
RefPtr<ScalarizedTupleValImpl> resultTuple = new ScalarizedTupleValImpl();
resultTuple->type = elementType;
- UInt elementCount = inputTuple->elements.Count();
- UInt elementCounter = 0;
+ Index elementCount = inputTuple->elements.getCount();
+ Index elementCounter = 0;
auto structType = as<IRStructType>(elementType);
for(auto field : structType->getFields())
{
auto tupleElementType = field->getFieldType();
- UInt elementIndex = elementCounter++;
+ Index elementIndex = elementCounter++;
SLANG_RELEASE_ASSERT(elementIndex < elementCount);
auto inputElement = inputTuple->elements[elementIndex];
@@ -944,7 +944,7 @@ ScalarizedVal getSubscriptVal(
inputElement.val,
indexVal);
- resultTuple->elements.Add(resultElement);
+ resultTuple->elements.add(resultElement);
}
SLANG_RELEASE_ASSERT(elementCounter == elementCount);
@@ -983,7 +983,7 @@ IRInst* materializeTupleValue(
auto tupleVal = val.impl.as<ScalarizedTupleValImpl>();
SLANG_ASSERT(tupleVal);
- UInt elementCount = tupleVal->elements.Count();
+ Index elementCount = tupleVal->elements.getCount();
auto type = tupleVal->type;
if( auto arrayType = as<IRArrayType>(type))
@@ -1009,13 +1009,13 @@ IRInst* materializeTupleValue(
builder,
arrayElementPseudoVal);
- arrayElementVals.Add(arrayElementVal);
+ arrayElementVals.add(arrayElementVal);
}
return builder->emitMakeArray(
arrayType,
- arrayElementVals.Count(),
- arrayElementVals.Buffer());
+ arrayElementVals.getCount(),
+ arrayElementVals.getBuffer());
}
else
{
@@ -1026,16 +1026,16 @@ IRInst* materializeTupleValue(
// TODO: this should be using a `makeStruct` instruction.
List<IRInst*> elementVals;
- for( UInt ee = 0; ee < elementCount; ++ee )
+ for( Index ee = 0; ee < elementCount; ++ee )
{
auto elementVal = materializeValue(builder, tupleVal->elements[ee].val);
- elementVals.Add(elementVal);
+ elementVals.add(elementVal);
}
return builder->emitConstructorInst(
tupleVal->type,
- elementVals.Count(),
- elementVals.Buffer());
+ elementVals.getCount(),
+ elementVals.getBuffer());
}
}
diff --git a/source/slang/ir-insts.h b/source/slang/ir-insts.h
index ab333f2be..5970e2b36 100644
--- a/source/slang/ir-insts.h
+++ b/source/slang/ir-insts.h
@@ -782,7 +782,7 @@ struct IRBuilder
List<IRType*> const& paramTypes,
IRType* resultType)
{
- return getFuncType(paramTypes.Count(), paramTypes.Buffer(), resultType);
+ return getFuncType(paramTypes.getCount(), paramTypes.getBuffer(), resultType);
}
IRConstantBufferType* getConstantBufferType(
@@ -802,7 +802,7 @@ struct IRBuilder
IRType* getTaggedUnionType(
List<IRType*> const& caseTypes)
{
- return getTaggedUnionType(caseTypes.Count(), caseTypes.Buffer());
+ return getTaggedUnionType(caseTypes.getCount(), caseTypes.getBuffer());
}
IRType* getBindExistentialsType(
@@ -854,7 +854,7 @@ struct IRBuilder
IRInst* func,
List<IRInst*> const& args)
{
- return emitCallInst(type, func, args.Count(), args.Buffer());
+ return emitCallInst(type, func, args.getCount(), args.getBuffer());
}
IRInst* createIntrinsicInst(
@@ -883,7 +883,7 @@ struct IRBuilder
IRType* type,
List<IRInst*> const& args)
{
- return emitMakeVector(type, args.Count(), args.Buffer());
+ return emitMakeVector(type, args.getCount(), args.getBuffer());
}
IRInst* emitMakeMatrix(
@@ -905,7 +905,7 @@ struct IRBuilder
IRType* type,
List<IRInst*> const& args)
{
- return emitMakeStruct(type, args.Count(), args.Buffer());
+ return emitMakeStruct(type, args.getCount(), args.getBuffer());
}
IRInst* emitMakeExistential(
diff --git a/source/slang/ir-legalize-types.cpp b/source/slang/ir-legalize-types.cpp
index 127593dd5..cfc495070 100644
--- a/source/slang/ir-legalize-types.cpp
+++ b/source/slang/ir-legalize-types.cpp
@@ -22,7 +22,7 @@ namespace Slang
LegalVal LegalVal::tuple(RefPtr<TuplePseudoVal> tupleVal)
{
- SLANG_ASSERT(tupleVal->elements.Count());
+ SLANG_ASSERT(tupleVal->elements.getCount());
LegalVal result;
result.flavor = LegalVal::Flavor::tuple;
@@ -202,7 +202,7 @@ static void getArgumentValues(
break;
case LegalVal::Flavor::simple:
- instArgs.Add(val.getSimple());
+ instArgs.add(val.getSimple());
break;
case LegalVal::Flavor::implicitDeref:
@@ -259,8 +259,8 @@ static LegalVal legalizeCall(
return LegalVal::simple(context->builder->emitCallInst(
retIRType,
callInst->getCallee(),
- instArgs.Count(),
- instArgs.Buffer()));
+ instArgs.getCount(),
+ instArgs.getBuffer()));
}
static LegalVal legalizeRetVal(IRTypeLegalizationContext* context,
@@ -322,7 +322,7 @@ static LegalVal legalizeLoad(
element.key = ee.key;
element.val = legalizeLoad(context, ee.val);
- tupleVal->elements.Add(element);
+ tupleVal->elements.add(element);
}
return LegalVal::tuple(tupleVal);
}
@@ -382,9 +382,9 @@ static LegalVal legalizeStore(
// the tuple.
auto destTuple = legalPtrVal.getTuple();
auto valTuple = legalVal.getTuple();
- SLANG_ASSERT(destTuple->elements.Count() == valTuple->elements.Count());
+ SLANG_ASSERT(destTuple->elements.getCount() == valTuple->elements.getCount());
- for (UInt i = 0; i < valTuple->elements.Count(); i++)
+ for (Index i = 0; i < valTuple->elements.getCount(); i++)
{
legalizeStore(context, destTuple->elements[i].val, valTuple->elements[i].val);
}
@@ -615,7 +615,7 @@ static LegalVal unwrapBufferValue(
context,
legalPtrOperand,
ee.field);
- obj->elements.Add(element);
+ obj->elements.add(element);
}
return LegalVal::tuple(obj);
@@ -667,7 +667,7 @@ static LegalType getPointedToType(
TuplePseudoType::Element resultElement;
resultElement.key = ee.key;
resultElement.type = getPointedToType(context, ee.type);
- resultTuple->elements.Add(resultElement);
+ resultTuple->elements.add(resultElement);
}
return LegalType::tuple(resultTuple);
}
@@ -889,10 +889,10 @@ static LegalVal legalizeGetElement(
auto tupleType = type.getTuple();
SLANG_ASSERT(tupleType);
- auto elemCount = ptrTupleInfo->elements.Count();
- SLANG_ASSERT(elemCount == tupleType->elements.Count());
+ auto elemCount = ptrTupleInfo->elements.getCount();
+ SLANG_ASSERT(elemCount == tupleType->elements.getCount());
- for(UInt ee = 0; ee < elemCount; ++ee)
+ for(Index ee = 0; ee < elemCount; ++ee)
{
auto ptrElem = ptrTupleInfo->elements[ee];
auto elemType = tupleType->elements[ee].type;
@@ -905,7 +905,7 @@ static LegalVal legalizeGetElement(
ptrElem.val,
indexOperand);
- resTupleInfo->elements.Add(resElem);
+ resTupleInfo->elements.add(resElem);
}
return LegalVal::tuple(resTupleInfo);
@@ -1000,10 +1000,10 @@ static LegalVal legalizeGetElementPtr(
auto tupleType = type.getTuple();
SLANG_ASSERT(tupleType);
- auto elemCount = ptrTupleInfo->elements.Count();
- SLANG_ASSERT(elemCount == tupleType->elements.Count());
+ auto elemCount = ptrTupleInfo->elements.getCount();
+ SLANG_ASSERT(elemCount == tupleType->elements.getCount());
- for(UInt ee = 0; ee < elemCount; ++ee)
+ for(Index ee = 0; ee < elemCount; ++ee)
{
auto ptrElem = ptrTupleInfo->elements[ee];
auto elemType = tupleType->elements[ee].type;
@@ -1016,7 +1016,7 @@ static LegalVal legalizeGetElementPtr(
ptrElem.val,
indexOperand);
- resTupleInfo->elements.Add(resElem);
+ resTupleInfo->elements.add(resElem);
}
return LegalVal::tuple(resTupleInfo);
@@ -1090,13 +1090,13 @@ static LegalVal legalizeMakeStruct(
// the `struct` type with them as fields
// would not be simple...
//
- args.Add(legalArgs[aa].getSimple());
+ args.add(legalArgs[aa].getSimple());
}
return LegalVal::simple(
builder->emitMakeStruct(
legalType.getSimple(),
argCount,
- args.Buffer()));
+ args.getBuffer()));
}
case LegalType::Flavor::pair:
@@ -1120,30 +1120,30 @@ static LegalVal legalizeMakeStruct(
{
// The argument is itself a pair
auto argPair = arg.getPair();
- ordinaryArgs.Add(argPair->ordinaryVal);
- specialArgs.Add(argPair->specialVal);
+ ordinaryArgs.add(argPair->ordinaryVal);
+ specialArgs.add(argPair->specialVal);
}
else if(ee.flags & Slang::PairInfo::kFlag_hasOrdinary)
{
- ordinaryArgs.Add(arg);
+ ordinaryArgs.add(arg);
}
else if(ee.flags & Slang::PairInfo::kFlag_hasSpecial)
{
- specialArgs.Add(arg);
+ specialArgs.add(arg);
}
}
LegalVal ordinaryVal = legalizeMakeStruct(
context,
ordinaryType,
- ordinaryArgs.Buffer(),
- ordinaryArgs.Count());
+ ordinaryArgs.getBuffer(),
+ ordinaryArgs.getCount());
LegalVal specialVal = legalizeMakeStruct(
context,
specialType,
- specialArgs.Buffer(),
- specialArgs.Count());
+ specialArgs.getBuffer(),
+ specialArgs.getCount());
return LegalVal::pair(ordinaryVal, specialVal, pairInfo);
}
@@ -1172,7 +1172,7 @@ static LegalVal legalizeMakeStruct(
resElem.key = elemKey;
resElem.val = argVal;
- resTupleInfo->elements.Add(resElem);
+ resTupleInfo->elements.add(resElem);
}
return LegalVal::tuple(resTupleInfo);
}
@@ -1316,7 +1316,7 @@ static LegalVal legalizeLocalVar(
// Remove the old local var.
irLocalVar->removeFromParent();
// add old local var to list
- context->replacedInstructions.Add(irLocalVar);
+ context->replacedInstructions.add(irLocalVar);
return newVal;
}
break;
@@ -1348,7 +1348,7 @@ static LegalVal legalizeParam(
auto newVal = declareVars(context, kIROp_Param, legalParamType, nullptr, LegalVarChain(), nameHint, originalParam, nullptr);
originalParam->removeFromParent();
- context->replacedInstructions.Add(originalParam);
+ context->replacedInstructions.add(originalParam);
return newVal;
}
}
@@ -1422,7 +1422,7 @@ static LegalVal legalizeInst(
{
auto oldArg = inst->getOperand(aa);
auto legalArg = legalizeOperand(context, oldArg);
- legalArgs.Add(legalArg);
+ legalArgs.add(legalArg);
if (legalArg.flavor != LegalVal::Flavor::simple)
anyComplex = true;
@@ -1466,14 +1466,14 @@ static LegalVal legalizeInst(
context,
inst,
legalType,
- legalArgs.Buffer());
+ legalArgs.getBuffer());
// After we are done, we will eliminate the
// original instruction by removing it from
// the IR.
//
inst->removeFromParent();
- context->replacedInstructions.Add(inst);
+ context->replacedInstructions.add(inst);
// The value to be used when referencing
// the original instruction will now be
@@ -1489,7 +1489,7 @@ static void addParamType(List<IRType*>& ioParamTypes, LegalType t)
break;
case LegalType::Flavor::simple:
- ioParamTypes.Add(t.getSimple());
+ ioParamTypes.add(t.getSimple());
break;
case LegalType::Flavor::implicitDeref:
@@ -1571,8 +1571,8 @@ static LegalVal legalizeFunc(
}
auto newFuncType = context->builder->getFuncType(
- newParamTypes.Count(),
- newParamTypes.Buffer(),
+ newParamTypes.getCount(),
+ newParamTypes.getBuffer(),
newResultType);
context->builder->setDataType(irFunc, newFuncType);
@@ -1799,7 +1799,7 @@ static void _addFieldsToWrappedBufferElementTypeLayout(
// information so that we can find the field layout
// based on the IR key for the struct field.
//
- newTypeLayout->fields.Add(newFieldLayout);
+ newTypeLayout->fields.add(newFieldLayout);
newTypeLayout->mapKeyToLayout.Add(simpleInfo->key, newFieldLayout);
}
break;
@@ -2310,7 +2310,7 @@ static LegalVal declareVars(
TuplePseudoVal::Element element;
element.key = ee.key;
element.val = fieldVal;
- tupleVal->elements.Add(element);
+ tupleVal->elements.add(element);
}
return LegalVal::tuple(tupleVal);
@@ -2380,7 +2380,7 @@ static LegalVal legalizeGlobalVar(
// Remove the old global from the module.
irGlobalVar->removeFromParent();
- context->replacedInstructions.Add(irGlobalVar);
+ context->replacedInstructions.add(irGlobalVar);
return newVal;
}
@@ -2424,7 +2424,7 @@ static LegalVal legalizeGlobalConstant(
// Remove the old global from the module.
irGlobalConstant->removeFromParent();
- context->replacedInstructions.Add(irGlobalConstant);
+ context->replacedInstructions.add(irGlobalConstant);
return newVal;
}
@@ -2473,7 +2473,7 @@ static LegalVal legalizeGlobalParam(
// Remove the old global from the module.
irGlobalParam->removeFromParent();
- context->replacedInstructions.Add(irGlobalParam);
+ context->replacedInstructions.add(irGlobalParam);
return newVal;
}
diff --git a/source/slang/ir-link.cpp b/source/slang/ir-link.cpp
index 60bafb9d1..d4f736a08 100644
--- a/source/slang/ir-link.cpp
+++ b/source/slang/ir-link.cpp
@@ -775,11 +775,11 @@ IRFunc* specializeIRForEntryPoint(
if( auto firstBlock = clonedFunc->getFirstBlock() )
{
auto paramsStructLayout = getScopeStructLayout(entryPointLayout);
- UInt paramLayoutCount = paramsStructLayout->fields.Count();
- UInt paramCounter = 0;
+ Index paramLayoutCount = paramsStructLayout->fields.getCount();
+ Index paramCounter = 0;
for( auto pp = firstBlock->getFirstParam(); pp; pp = pp->getNextParam() )
{
- UInt paramIndex = paramCounter++;
+ Index paramIndex = paramCounter++;
if( paramIndex < paramLayoutCount )
{
auto paramLayout = paramsStructLayout->fields[paramIndex];
diff --git a/source/slang/ir-restructure.cpp b/source/slang/ir-restructure.cpp
index d8d3fe7c9..47a0d1fee 100644
--- a/source/slang/ir-restructure.cpp
+++ b/source/slang/ir-restructure.cpp
@@ -514,14 +514,14 @@ namespace Slang
caseIndex++;
RefPtr<SwitchRegion::Case> currentCase = new SwitchRegion::Case();
- switchRegion->cases.Add(currentCase);
+ switchRegion->cases.add(currentCase);
// Add the case value for this case, and any
// others that share the same label
//
for(;;)
{
- currentCase->values.Add(caseVal);
+ currentCase->values.add(caseVal);
// Are there any more `case`s left?
//
@@ -586,7 +586,7 @@ namespace Slang
if(!defaultLabelHandled)
{
RefPtr<SwitchRegion::Case> defaultCase = new SwitchRegion::Case();
- switchRegion->cases.Add(defaultCase);
+ switchRegion->cases.add(defaultCase);
// Note: we use `null` instead of `breakLabel` as the end block
// here, to ensure that the `default` region will end with an
diff --git a/source/slang/ir-sccp.cpp b/source/slang/ir-sccp.cpp
index 66b370848..242ef0a37 100644
--- a/source/slang/ir-sccp.cpp
+++ b/source/slang/ir-sccp.cpp
@@ -357,7 +357,7 @@ struct SCCPContext
// executed. We do this by adding the target to our CFG work list.
//
auto target = unconditionalBranch->getTargetBlock();
- cfgWorkList.Add(target);
+ cfgWorkList.add(target);
// Besides transferring control to another block, the other
// thing our unconditional branch instructions do is provide
@@ -408,7 +408,7 @@ struct SCCPContext
setLatticeVal(param, newVal);
for( auto use = param->firstUse; use; use = use->nextUse )
{
- ssaWorkList.Add(use->getUser());
+ ssaWorkList.add(use->getUser());
}
}
}
@@ -448,7 +448,7 @@ struct SCCPContext
// bail out now.
//
auto target = boolConst->getValue() ? conditionalBranch->getTrueBlock() : conditionalBranch->getFalseBlock();
- cfgWorkList.Add(target);
+ cfgWorkList.add(target);
return;
}
}
@@ -459,8 +459,8 @@ struct SCCPContext
// taken, so that both of the target blocks are
// potentially executed.
//
- cfgWorkList.Add(conditionalBranch->getTrueBlock());
- cfgWorkList.Add(conditionalBranch->getFalseBlock());
+ cfgWorkList.add(conditionalBranch->getTrueBlock());
+ cfgWorkList.add(conditionalBranch->getFalseBlock());
}
else if( auto switchInst = as<IRSwitch>(inst) )
{
@@ -497,7 +497,7 @@ struct SCCPContext
// Whatever single block we decided will get executed,
// we need to make sure it gets processed and then bail.
//
- cfgWorkList.Add(target);
+ cfgWorkList.add(target);
return;
}
}
@@ -507,9 +507,9 @@ struct SCCPContext
//
for( UInt cc = 0; cc < caseCount; ++cc )
{
- cfgWorkList.Add(switchInst->getCaseLabel(cc));
+ cfgWorkList.add(switchInst->getCaseLabel(cc));
}
- cfgWorkList.Add(switchInst->getDefaultLabel());
+ cfgWorkList.add(switchInst->getDefaultLabel());
}
// There are other cases of terminator instructions not handled
@@ -563,7 +563,7 @@ struct SCCPContext
//
for( auto use = inst->firstUse; use; use = use->nextUse )
{
- ssaWorkList.Add(use->getUser());
+ ssaWorkList.add(use->getUser());
}
}
@@ -584,7 +584,7 @@ struct SCCPContext
// The entry block is always going to be executed when the
// function gets called, so we will process it right away.
//
- cfgWorkList.Add(firstBlock);
+ cfgWorkList.add(firstBlock);
// The parameters of the first block are our function parameters,
// and we want to operate on the assumption that they could have
@@ -597,7 +597,7 @@ struct SCCPContext
// Now we will iterate until both of our work lists go dry.
//
- while(cfgWorkList.Count() || ssaWorkList.Count())
+ while(cfgWorkList.getCount() || ssaWorkList.getCount())
{
// Note: there is a design choice to be had here
// around whether we do `if if` or `while while`
@@ -607,12 +607,12 @@ struct SCCPContext
// We will start by processing any blocks that we
// have determined are potentially reachable.
//
- while( cfgWorkList.Count() )
+ while( cfgWorkList.getCount() )
{
// We pop one block off of the work list.
//
auto block = cfgWorkList[0];
- cfgWorkList.FastRemoveAt(0);
+ cfgWorkList.fastRemoveAt(0);
// We only want to process blocks that haven't
// already been marked as executed, so that we
@@ -644,12 +644,12 @@ struct SCCPContext
// will start looking at individual instructions that
// need to be updated.
//
- while( ssaWorkList.Count() )
+ while( ssaWorkList.getCount() )
{
// We pop one instruction that needs an update.
//
auto inst = ssaWorkList[0];
- ssaWorkList.FastRemoveAt(0);
+ ssaWorkList.fastRemoveAt(0);
// Before updating the instruction, we will check if
// the parent block of the instructin is marked as
@@ -728,7 +728,7 @@ struct SCCPContext
inst->replaceUsesWith(constantVal);
if( !inst->mightHaveSideEffects() )
{
- instsToRemove.Add(inst);
+ instsToRemove.add(inst);
}
}
}
@@ -817,7 +817,7 @@ struct SCCPContext
{
if( !isMarkedAsExecuted(block) )
{
- unreachableBlocks.Add(block);
+ unreachableBlocks.add(block);
}
}
//
diff --git a/source/slang/ir-serialize.cpp b/source/slang/ir-serialize.cpp
index a50ed6bd5..33238a9a6 100644
--- a/source/slang/ir-serialize.cpp
+++ b/source/slang/ir-serialize.cpp
@@ -81,7 +81,7 @@ void StringRepresentationCache::init(const List<char>* stringTable, NamePool* na
m_scopeManager = scopeManager;
// Decode the table
- m_entries.SetSize(StringSlicePool::kNumDefaultHandles);
+ m_entries.setCount(StringSlicePool::kNumDefaultHandles);
SLANG_COMPILE_TIME_ASSERT(StringSlicePool::kNumDefaultHandles == 2);
{
@@ -112,13 +112,13 @@ void StringRepresentationCache::init(const List<char>* stringTable, NamePool* na
entry.m_numChars = len;
entry.m_object = nullptr;
- m_entries.Add(entry);
+ m_entries.add(entry);
cur = reader.m_pos + len;
}
}
- m_entries.Compress();
+ m_entries.compress();
}
Name* StringRepresentationCache::getName(Handle handle)
@@ -209,7 +209,7 @@ char* StringRepresentationCache::getCStr(Handle handle)
/* static */void SerialStringTableUtil::encodeStringTable(const UnownedStringSlice* slices, size_t numSlices, List<char>& stringTable)
{
- stringTable.Clear();
+ stringTable.clear();
for (size_t i = 0; i < numSlices; ++i)
{
const UnownedStringSlice slice = slices[i];
@@ -218,9 +218,9 @@ char* StringRepresentationCache::getCStr(Handle handle)
// We need to write into the the string array
char prefixBytes[6];
const int numPrefixBytes = EncodeUnicodePointToUTF8(prefixBytes, len);
- const int baseIndex = int(stringTable.Count());
+ const Index baseIndex = stringTable.getCount();
- stringTable.SetSize(baseIndex + numPrefixBytes + len);
+ stringTable.setCount(baseIndex + numPrefixBytes + len);
char* dst = stringTable.begin() + baseIndex;
@@ -239,14 +239,14 @@ char* StringRepresentationCache::getCStr(Handle handle)
{
CharReader reader(cur);
const int len = GetUnicodePointFromUTF8(reader);
- slicesOut.Add(UnownedStringSlice(reader.m_pos, len));
+ slicesOut.add(UnownedStringSlice(reader.m_pos, len));
cur = reader.m_pos + len;
}
}
/* static */void SerialStringTableUtil::decodeStringTable(const List<char>& stringTable, List<UnownedStringSlice>& slicesOut)
{
- slicesOut.SetSize(2);
+ slicesOut.setCount(2);
slicesOut[0] = UnownedStringSlice(nullptr, size_t(0));
slicesOut[1] = UnownedStringSlice("", size_t(0));
@@ -255,19 +255,19 @@ char* StringRepresentationCache::getCStr(Handle handle)
/* static */void SerialStringTableUtil::calcStringSlicePoolMap(const List<UnownedStringSlice>& slices, StringSlicePool& pool, List<StringSlicePool::Handle>& indexMapOut)
{
- SLANG_ASSERT(slices.Count() >= StringSlicePool::kNumDefaultHandles);
+ SLANG_ASSERT(slices.getCount() >= StringSlicePool::kNumDefaultHandles);
SLANG_ASSERT(slices[int(StringSlicePool::kNullHandle)] == "" && slices[int(StringSlicePool::kNullHandle)].begin() == nullptr);
SLANG_ASSERT(slices[int(StringSlicePool::kEmptyHandle)] == "");
- indexMapOut.SetSize(slices.Count());
+ indexMapOut.setCount(slices.getCount());
// Set up all of the defaults
for (int i = 0; i < StringSlicePool::kNumDefaultHandles; ++i)
{
indexMapOut[i] = StringSlicePool::Handle(i);
}
- const int numSlices = int(slices.Count());
- for (int i = StringSlicePool::kNumDefaultHandles; i < numSlices ; ++i)
+ const Index numSlices = slices.getCount();
+ for (Index i = StringSlicePool::kNumDefaultHandles; i < numSlices ; ++i)
{
indexMapOut[i] = pool.add(slices[i]);
}
@@ -278,7 +278,7 @@ char* StringRepresentationCache::getCStr(Handle handle)
template<typename T>
static size_t _calcArraySize(const List<T>& list)
{
- return list.Count() * sizeof(T);
+ return list.getCount() * sizeof(T);
}
size_t IRSerialData::calcSizeInBytes() const
@@ -306,32 +306,32 @@ IRSerialData::IRSerialData()
void IRSerialData::clear()
{
// First Instruction is null
- m_insts.SetSize(1);
+ m_insts.setCount(1);
memset(&m_insts[0], 0, sizeof(Inst));
- m_childRuns.Clear();
- m_externalOperands.Clear();
- m_rawSourceLocs.Clear();
+ m_childRuns.clear();
+ m_externalOperands.clear();
+ m_rawSourceLocs.clear();
- m_stringTable.Clear();
+ m_stringTable.clear();
// Debug data
- m_debugLineInfos.Clear();
- m_debugAdjustedLineInfos.Clear();
- m_debugSourceInfos.Clear();
- m_debugSourceLocRuns.Clear();
- m_debugStringTable.Clear();
+ m_debugLineInfos.clear();
+ m_debugAdjustedLineInfos.clear();
+ m_debugSourceInfos.clear();
+ m_debugSourceLocRuns.clear();
+ m_debugStringTable.clear();
}
template <typename T>
static bool _isEqual(const List<T>& aIn, const List<T>& bIn)
{
- if (aIn.Count() != bIn.Count())
+ if (aIn.getCount() != bIn.getCount())
{
return false;
}
- size_t size = size_t(aIn.Count());
+ size_t size = size_t(aIn.getCount());
const T* a = aIn.begin();
const T* b = bIn.begin();
@@ -376,8 +376,8 @@ void IRSerialWriter::_addInstruction(IRInst* inst)
SLANG_ASSERT(!m_instMap.ContainsKey(inst));
// Add to the map
- m_instMap.Add(inst, Ser::InstIndex(m_insts.Count()));
- m_insts.Add(inst);
+ m_instMap.Add(inst, Ser::InstIndex(m_insts.getCount()));
+ m_insts.add(inst);
}
#if 0
@@ -444,7 +444,7 @@ void IRSerialWriter::_addDebugSourceLocRun(SourceLoc sourceLoc, uint32_t startIn
int entryIndex = sourceView->findEntryIndex(sourceLoc);
if (entryIndex < 0)
{
- debugSourceFile->m_lineInfos.Add(lineInfo);
+ debugSourceFile->m_lineInfos.add(lineInfo);
}
else
{
@@ -463,7 +463,7 @@ void IRSerialWriter::_addDebugSourceLocRun(SourceLoc sourceLoc, uint32_t startIn
adjustedLineInfo.m_adjustedLineIndex = lineIndex + entry.m_lineAdjust;
- debugSourceFile->m_adjustedLineInfos.Add(adjustedLineInfo);
+ debugSourceFile->m_adjustedLineInfos.add(adjustedLineInfo);
}
debugSourceFile->setHasLineIndex(lineIndex);
@@ -475,7 +475,7 @@ void IRSerialWriter::_addDebugSourceLocRun(SourceLoc sourceLoc, uint32_t startIn
sourceLocRun.m_startInstIndex = IRSerialData::InstIndex(startInstIndex);
sourceLocRun.m_sourceLoc = uint32_t(debugSourceFile->m_baseSourceLoc + offset);
- m_serialData->m_debugSourceLocRuns.Add(sourceLocRun);
+ m_serialData->m_debugSourceLocRuns.add(sourceLocRun);
}
Result IRSerialWriter::_calcDebugInfo()
@@ -497,8 +497,8 @@ Result IRSerialWriter::_calcDebugInfo()
// Find all of the source locations and their associated instructions
List<InstLoc> instLocs;
- const int numInsts = int(m_insts.Count());
- for (int i = 1; i < numInsts; i++)
+ const Index numInsts = m_insts.getCount();
+ for (Index i = 1; i < numInsts; i++)
{
IRInst* srcInst = m_insts[i];
if (!srcInst->sourceLoc.isValid())
@@ -508,11 +508,11 @@ Result IRSerialWriter::_calcDebugInfo()
InstLoc instLoc;
instLoc.instIndex = uint32_t(i);
instLoc.sourceLoc = uint32_t(srcInst->sourceLoc.getRaw());
- instLocs.Add(instLoc);
+ instLocs.add(instLoc);
}
// Sort them
- instLocs.Sort();
+ instLocs.sort();
m_debugFreeSourceLoc = 1;
// Look for runs
@@ -549,25 +549,25 @@ Result IRSerialWriter::_calcDebugInfo()
IRSerialData::DebugSourceInfo sourceInfo;
- sourceInfo.m_numLines = uint32_t(debugSourceFile->m_sourceFile->getLineBreakOffsets().Count());
+ sourceInfo.m_numLines = uint32_t(debugSourceFile->m_sourceFile->getLineBreakOffsets().getCount());
sourceInfo.m_startSourceLoc = uint32_t(debugSourceFile->m_baseSourceLoc);
sourceInfo.m_endSourceLoc = uint32_t(debugSourceFile->m_baseSourceLoc + sourceFile->getContentSize());
sourceInfo.m_pathIndex = Ser::StringIndex(m_debugStringSlicePool.add(sourceFile->getPathInfo().foundPath));
- sourceInfo.m_lineInfosStartIndex = uint32_t(m_serialData->m_debugLineInfos.Count());
- sourceInfo.m_adjustedLineInfosStartIndex = uint32_t(m_serialData->m_debugAdjustedLineInfos.Count());
+ sourceInfo.m_lineInfosStartIndex = uint32_t(m_serialData->m_debugLineInfos.getCount());
+ sourceInfo.m_adjustedLineInfosStartIndex = uint32_t(m_serialData->m_debugAdjustedLineInfos.getCount());
- sourceInfo.m_numLineInfos = uint32_t(debugSourceFile->m_lineInfos.Count());
- sourceInfo.m_numAdjustedLineInfos = uint32_t(debugSourceFile->m_adjustedLineInfos.Count());
+ sourceInfo.m_numLineInfos = uint32_t(debugSourceFile->m_lineInfos.getCount());
+ sourceInfo.m_numAdjustedLineInfos = uint32_t(debugSourceFile->m_adjustedLineInfos.getCount());
// Add the line infos
- m_serialData->m_debugLineInfos.AddRange(debugSourceFile->m_lineInfos.begin(), debugSourceFile->m_lineInfos.Count());
- m_serialData->m_debugAdjustedLineInfos.AddRange(debugSourceFile->m_adjustedLineInfos.begin(), debugSourceFile->m_adjustedLineInfos.Count());
+ m_serialData->m_debugLineInfos.addRange(debugSourceFile->m_lineInfos.begin(), debugSourceFile->m_lineInfos.getCount());
+ m_serialData->m_debugAdjustedLineInfos.addRange(debugSourceFile->m_adjustedLineInfos.begin(), debugSourceFile->m_adjustedLineInfos.getCount());
// Add the source info
- m_serialData->m_debugSourceInfos.Add(sourceInfo);
+ m_serialData->m_debugSourceInfos.add(sourceInfo);
}
// Convert the string pool
@@ -586,33 +586,33 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt
serialData->clear();
// We reserve 0 for null
- m_insts.Clear();
- m_insts.Add(nullptr);
+ m_insts.clear();
+ m_insts.add(nullptr);
// Reset
m_instMap.Clear();
- m_decorations.Clear();
+ m_decorations.clear();
// Stack for parentInst
List<IRInst*> parentInstStack;
IRModuleInst* moduleInst = module->getModuleInst();
- parentInstStack.Add(moduleInst);
+ parentInstStack.add(moduleInst);
// Add to the map
_addInstruction(moduleInst);
// Traverse all of the instructions
- while (parentInstStack.Count())
+ while (parentInstStack.getCount())
{
// If it's in the stack it is assumed it is already in the inst map
- IRInst* parentInst = parentInstStack.Last();
- parentInstStack.RemoveLast();
+ IRInst* parentInst = parentInstStack.getLast();
+ parentInstStack.removeLast();
SLANG_ASSERT(m_instMap.ContainsKey(parentInst));
// Okay we go through each of the children in order. If they are IRInstParent derived, we add to stack to process later
// cos we want breadth first so the order of children is the same as their index order, meaning we don't need to store explicit indices
- const Ser::InstIndex startChildInstIndex = Ser::InstIndex(m_insts.Count());
+ const Ser::InstIndex startChildInstIndex = Ser::InstIndex(m_insts.getCount());
IRInstListBase childrenList = parentInst->getDecorationsAndChildren();
for (IRInst* child : childrenList)
@@ -622,18 +622,18 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt
_addInstruction(child);
- parentInstStack.Add(child);
+ parentInstStack.add(child);
}
// If it had any children, then store the information about it
- if (Ser::InstIndex(m_insts.Count()) != startChildInstIndex)
+ if (Ser::InstIndex(m_insts.getCount()) != startChildInstIndex)
{
Ser::InstRun run;
run.m_parentIndex = m_instMap[parentInst];
run.m_startInstIndex = startChildInstIndex;
- run.m_numChildren = Ser::SizeType(m_insts.Count() - int(startChildInstIndex));
+ run.m_numChildren = Ser::SizeType(m_insts.getCount() - int(startChildInstIndex));
- m_serialData->m_childRuns.Add(run);
+ m_serialData->m_childRuns.add(run);
}
}
@@ -650,15 +650,15 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt
#endif
// Set to the right size
- m_serialData->m_insts.SetSize(m_insts.Count());
+ m_serialData->m_insts.setCount(m_insts.getCount());
// Clear all instructions
- memset(m_serialData->m_insts.begin(), 0, sizeof(Ser::Inst) * m_serialData->m_insts.Count());
+ memset(m_serialData->m_insts.begin(), 0, sizeof(Ser::Inst) * m_serialData->m_insts.getCount());
// Need to set up the actual instructions
{
- const int numInsts = int(m_insts.Count());
+ const Index numInsts = m_insts.getCount();
- for (int i = 1; i < numInsts; ++i)
+ for (Index i = 1; i < numInsts; ++i)
{
IRInst* srcInst = m_insts[i];
Ser::Inst& dstInst = m_serialData->m_insts[i];
@@ -744,8 +744,8 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt
{
dstInst.m_payloadType = PayloadType::OperandExternal;
- int operandArrayBaseIndex = int(m_serialData->m_externalOperands.Count());
- m_serialData->m_externalOperands.SetSize(operandArrayBaseIndex + numOperands);
+ int operandArrayBaseIndex = int(m_serialData->m_externalOperands.getCount());
+ m_serialData->m_externalOperands.setCount(operandArrayBaseIndex + numOperands);
dstOperands = m_serialData->m_externalOperands.begin() + operandArrayBaseIndex;
@@ -770,13 +770,13 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt
// If the option to use RawSourceLocations is enabled, serialize out as is
if (options & OptionFlag::RawSourceLocation)
{
- const int numInsts = int(m_insts.Count());
- serialData->m_rawSourceLocs.SetSize(numInsts);
+ const Index numInsts = m_insts.getCount();
+ serialData->m_rawSourceLocs.setCount(numInsts);
Ser::RawSourceLoc* dstLocs = serialData->m_rawSourceLocs.begin();
// 0 is null, just mark as no location
dstLocs[0] = Ser::RawSourceLoc(0);
- for (int i = 1; i < numInsts; ++i)
+ for (Index i = 1; i < numInsts; ++i)
{
IRInst* srcInst = m_insts[i];
dstLocs[i] = Ser::RawSourceLoc(srcInst->sourceLoc.getRaw());
@@ -797,18 +797,18 @@ static size_t _calcChunkSize(IRSerialBinary::CompressionType compressionType, co
{
typedef IRSerialBinary Bin;
- if (array.Count())
+ if (array.getCount())
{
switch (compressionType)
{
case Bin::CompressionType::None:
{
- const size_t size = sizeof(Bin::ArrayHeader) + sizeof(T) * array.Count();
+ const size_t size = sizeof(Bin::ArrayHeader) + sizeof(T) * array.getCount();
return (size + 3) & ~size_t(3);
}
case Bin::CompressionType::VariableByteLite:
{
- const size_t payloadSize = ByteEncodeUtil::calcEncodeLiteSizeUInt32((const uint32_t*)array.begin(), (array.Count() * sizeof(T)) / sizeof(uint32_t));
+ const size_t payloadSize = ByteEncodeUtil::calcEncodeLiteSizeUInt32((const uint32_t*)array.begin(), (array.getCount() * sizeof(T)) / sizeof(uint32_t));
const size_t size = sizeof(Bin::CompressedArrayHeader) + payloadSize;
return (size + 3) & ~size_t(3);
}
@@ -860,7 +860,7 @@ static Result _writeArrayChunk(IRSerialBinary::CompressionType compressionType,
ByteEncodeUtil::encodeLiteUInt32((const uint32_t*)data, numCompressedEntries, compressedPayload);
- payloadSize = sizeof(Bin::CompressedArrayHeader) - sizeof(Bin::Chunk) + compressedPayload.Count();
+ payloadSize = sizeof(Bin::CompressedArrayHeader) - sizeof(Bin::Chunk) + compressedPayload.getCount();
Bin::CompressedArrayHeader header;
header.m_chunk.m_type = SLANG_MAKE_COMPRESSED_FOUR_CC(chunkId);
@@ -870,7 +870,7 @@ static Result _writeArrayChunk(IRSerialBinary::CompressionType compressionType,
stream->Write(&header, sizeof(header));
- stream->Write(compressedPayload.begin(), compressedPayload.Count());
+ stream->Write(compressedPayload.begin(), compressedPayload.getCount());
break;
}
default:
@@ -893,7 +893,7 @@ static Result _writeArrayChunk(IRSerialBinary::CompressionType compressionType,
template <typename T>
Result _writeArrayChunk(IRSerialBinary::CompressionType compressionType, uint32_t chunkId, const List<T>& array, Stream* stream)
{
- return _writeArrayChunk(compressionType, chunkId, array.begin(), size_t(array.Count()), sizeof(T), stream);
+ return _writeArrayChunk(compressionType, chunkId, array.begin(), size_t(array.getCount()), sizeof(T), stream);
}
Result _encodeInsts(IRSerialBinary::CompressionType compressionType, const List<IRSerialData::Inst>& instsIn, List<uint8_t>& encodeArrayOut)
@@ -905,9 +905,9 @@ Result _encodeInsts(IRSerialBinary::CompressionType compressionType, const List<
{
return SLANG_FAIL;
}
- encodeArrayOut.Clear();
+ encodeArrayOut.clear();
- const size_t numInsts = size_t(instsIn.Count());
+ const size_t numInsts = size_t(instsIn.getCount());
const IRSerialData::Inst* insts = instsIn.begin();
uint8_t* encodeOut = encodeArrayOut.begin();
@@ -927,11 +927,11 @@ Result _encodeInsts(IRSerialBinary::CompressionType compressionType, const List<
{
const size_t offset = size_t(encodeOut - encodeArrayOut.begin());
- const UInt oldCapacity = encodeArrayOut.Capacity();
+ const UInt oldCapacity = encodeArrayOut.getCapacity();
- encodeArrayOut.Reserve(oldCapacity + (oldCapacity >> 1) + maxInstSize);
- const UInt capacity = encodeArrayOut.Capacity();
- encodeArrayOut.SetSize(capacity);
+ encodeArrayOut.reserve(oldCapacity + (oldCapacity >> 1) + maxInstSize);
+ const UInt capacity = encodeArrayOut.getCapacity();
+ encodeArrayOut.setCount(capacity);
encodeOut = encodeArrayOut.begin() + offset;
encodeEnd = encodeArrayOut.end();
@@ -982,14 +982,14 @@ Result _encodeInsts(IRSerialBinary::CompressionType compressionType, const List<
}
// Fix the size
- encodeArrayOut.SetSize(UInt(encodeOut - encodeArrayOut.begin()));
+ encodeArrayOut.setCount(UInt(encodeOut - encodeArrayOut.begin()));
return SLANG_OK;
}
Result _writeInstArrayChunk(IRSerialBinary::CompressionType compressionType, uint32_t chunkId, const List<IRSerialData::Inst>& array, Stream* stream)
{
typedef IRSerialBinary Bin;
- if (array.Count() == 0)
+ if (array.getCount() == 0)
{
return SLANG_OK;
}
@@ -1005,16 +1005,16 @@ Result _writeInstArrayChunk(IRSerialBinary::CompressionType compressionType, uin
List<uint8_t> compressedPayload;
SLANG_RETURN_ON_FAIL(_encodeInsts(compressionType, array, compressedPayload));
- size_t payloadSize = sizeof(Bin::CompressedArrayHeader) - sizeof(Bin::Chunk) + compressedPayload.Count();
+ size_t payloadSize = sizeof(Bin::CompressedArrayHeader) - sizeof(Bin::Chunk) + compressedPayload.getCount();
Bin::CompressedArrayHeader header;
header.m_chunk.m_type = SLANG_MAKE_COMPRESSED_FOUR_CC(chunkId);
header.m_chunk.m_size = uint32_t(payloadSize);
- header.m_numEntries = uint32_t(array.Count());
+ header.m_numEntries = uint32_t(array.getCount());
header.m_numCompressedEntries = 0;
stream->Write(&header, sizeof(header));
- stream->Write(compressedPayload.begin(), compressedPayload.Count());
+ stream->Write(compressedPayload.begin(), compressedPayload.getCount());
// All chunks have sizes rounded to dword size
if (payloadSize & 3)
@@ -1046,7 +1046,7 @@ static size_t _calcInstChunkSize(IRSerialBinary::CompressionType compressionType
{
size_t size = sizeof(Bin::CompressedArrayHeader);
- size_t numInsts = size_t(instsIn.Count());
+ size_t numInsts = size_t(instsIn.getCount());
size += numInsts * 2; // op and payload
IRSerialData::Inst* insts = instsIn.begin();
@@ -1114,7 +1114,7 @@ static size_t _calcInstChunkSize(IRSerialBinary::CompressionType compressionType
_calcChunkSize(Bin::CompressionType::None, data.m_stringTable) +
_calcChunkSize(Bin::CompressionType::None, data.m_rawSourceLocs);
- if (data.m_debugSourceInfos.Count())
+ if (data.m_debugSourceInfos.getCount())
{
totalSize += _calcChunkSize(Bin::CompressionType::None, data.m_debugStringTable) +
_calcChunkSize(Bin::CompressionType::None, data.m_debugLineInfos) +
@@ -1146,7 +1146,7 @@ static size_t _calcInstChunkSize(IRSerialBinary::CompressionType compressionType
SLANG_RETURN_ON_FAIL(_writeArrayChunk(Bin::CompressionType::None, Bin::kUInt32SourceLocFourCc, data.m_rawSourceLocs, stream));
- if (data.m_debugSourceInfos.Count())
+ if (data.m_debugSourceInfos.getCount())
{
_writeArrayChunk(Bin::CompressionType::None, Bin::kDebugStringFourCc, data.m_debugStringTable, stream);
_writeArrayChunk(Bin::CompressionType::None, Bin::kDebugLineInfoFourCc, data.m_debugLineInfos, stream);
@@ -1184,7 +1184,7 @@ class ListResizerForType: public ListResizer
virtual void* setSize(size_t newSize) SLANG_OVERRIDE
{
- m_list.SetSize(UInt(newSize));
+ m_list.setCount(UInt(newSize));
return (void*)m_list.begin();
}
@@ -1215,7 +1215,7 @@ static Result _readArrayChunk(IRSerialBinary::CompressionType compressionType, c
size_t payloadSize = header.m_chunk.m_size - (sizeof(header) - sizeof(Bin::Chunk));
List<uint8_t> compressedPayload;
- compressedPayload.SetSize(payloadSize);
+ compressedPayload.setCount(payloadSize);
stream->Read(compressedPayload.begin(), payloadSize);
*numReadInOut += payloadSize;
@@ -1294,7 +1294,7 @@ static Result _decodeInsts(IRSerialBinary::CompressionType compressionType, cons
return SLANG_FAIL;
}
- const size_t numInsts = size_t(instsOut.Count());
+ const size_t numInsts = size_t(instsOut.getCount());
IRSerialData::Inst* insts = instsOut.begin();
const uint8_t* encodeCur = encodeIn.begin();
@@ -1381,12 +1381,12 @@ Result _readInstArrayChunk(const IRSerialBinary::SlangHeader& slangHeader, const
size_t payloadSize = header.m_chunk.m_size - (sizeof(header) - sizeof(Bin::Chunk));
List<uint8_t> compressedPayload;
- compressedPayload.SetSize(payloadSize);
+ compressedPayload.setCount(payloadSize);
stream->Read(compressedPayload.begin(), payloadSize);
*numReadInOut += payloadSize;
- arrayOut.SetSize(header.m_numEntries);
+ arrayOut.setCount(header.m_numEntries);
SLANG_RETURN_ON_FAIL(_decodeInsts(compressionType, compressedPayload, arrayOut));
break;
@@ -1561,7 +1561,7 @@ static SourceRange _toSourceRange(const IRSerialData::DebugSourceInfo& info)
static int _findIndex(const List<IRSerialData::DebugSourceInfo>& infos, SourceLoc sourceLoc)
{
- const int numInfos = int(infos.Count());
+ const int numInfos = int(infos.getCount());
for (int i = 0; i < numInfos; ++i)
{
if (_toSourceRange(infos[i]).contains(sourceLoc))
@@ -1598,11 +1598,11 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
List<IRInst*> insts;
- const int numInsts = int(data.m_insts.Count());
+ const Index numInsts = data.m_insts.getCount();
SLANG_ASSERT(numInsts > 0);
- insts.SetSize(numInsts);
+ insts.setCount(numInsts);
insts[0] = nullptr;
// 0 holds null
@@ -1622,7 +1622,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
insts[1] = moduleInst;
}
- for (int i = 2; i < numInsts; ++i)
+ for (Index i = 2; i < numInsts; ++i)
{
const Ser::Inst& srcInst = data.m_insts[i];
@@ -1714,7 +1714,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
// Patch up the operands
- for (int i = 1; i < numInsts; ++i)
+ for (Index i = 1; i < numInsts; ++i)
{
const Ser::Inst& srcInst = data.m_insts[i];
const IROp op((IROp)srcInst.m_op);
@@ -1746,8 +1746,8 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
// Patch up the children
{
- const int numChildRuns = int(data.m_childRuns.Count());
- for (int i = 0; i < numChildRuns; i++)
+ const Index numChildRuns = data.m_childRuns.getCount();
+ for (Index i = 0; i < numChildRuns; i++)
{
const auto& run = data.m_childRuns[i];
@@ -1763,10 +1763,10 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
// Re-add source locations, if they are defined
- if (int(m_serialData->m_rawSourceLocs.Count()) == numInsts)
+ if (m_serialData->m_rawSourceLocs.getCount() == numInsts)
{
const Ser::RawSourceLoc* srcLocs = m_serialData->m_rawSourceLocs.begin();
- for (int i = 1; i < numInsts; ++i)
+ for (Index i = 1; i < numInsts; ++i)
{
IRInst* dstInst = insts[i];
@@ -1774,7 +1774,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
}
- if (sourceManager && m_serialData->m_debugSourceInfos.Count())
+ if (sourceManager && m_serialData->m_debugSourceInfos.getCount())
{
List<UnownedStringSlice> debugStringSlices;
SerialStringTableUtil::decodeStringTable(m_serialData->m_debugStringTable, debugStringSlices);
@@ -1786,13 +1786,13 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
const List<IRSerialData::DebugSourceInfo>& sourceInfos = m_serialData->m_debugSourceInfos;
// Construct the source files
- int numSourceFiles = int(sourceInfos.Count());
+ Index numSourceFiles = sourceInfos.getCount();
// These hold the views (and SourceFile as there is only one SourceFile per view) in the same order as the sourceInfos
List<SourceView*> sourceViews;
- sourceViews.SetSize(numSourceFiles);
+ sourceViews.setCount(numSourceFiles);
- for (int i = 0; i < numSourceFiles; ++i)
+ for (Index i = 0; i < numSourceFiles; ++i)
{
const IRSerialData::DebugSourceInfo& srcSourceInfo = sourceInfos[i];
@@ -1807,8 +1807,8 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
List<IRSerialData::DebugLineInfo> lineInfos;
// Add the adjusted lines
{
- lineInfos.SetSize(srcSourceInfo.m_numAdjustedLineInfos);
- IRSerialData::DebugAdjustedLineInfo* srcAdjustedLineInfos = m_serialData->m_debugAdjustedLineInfos.Buffer() + srcSourceInfo.m_adjustedLineInfosStartIndex;
+ lineInfos.setCount(srcSourceInfo.m_numAdjustedLineInfos);
+ const IRSerialData::DebugAdjustedLineInfo* srcAdjustedLineInfos = m_serialData->m_debugAdjustedLineInfos.getBuffer() + srcSourceInfo.m_adjustedLineInfosStartIndex;
const int numAdjustedLines = int(srcSourceInfo.m_numAdjustedLineInfos);
for (int j = 0; j < numAdjustedLines; ++j)
{
@@ -1816,22 +1816,22 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
}
// Add regular lines
- lineInfos.AddRange(m_serialData->m_debugLineInfos.Buffer() + srcSourceInfo.m_lineInfosStartIndex, srcSourceInfo.m_numLineInfos);
+ lineInfos.addRange(m_serialData->m_debugLineInfos.getBuffer() + srcSourceInfo.m_lineInfosStartIndex, srcSourceInfo.m_numLineInfos);
// Put in sourceloc order
- lineInfos.Sort();
+ lineInfos.sort();
List<uint32_t> lineBreakOffsets;
// We can now set up the line breaks array
const int numLines = int(srcSourceInfo.m_numLines);
- lineBreakOffsets.SetSize(numLines);
+ lineBreakOffsets.setCount(numLines);
{
- const int numLineInfos = int(lineInfos.Count());
- int lineIndex = 0;
+ const Index numLineInfos = lineInfos.getCount();
+ Index lineIndex = 0;
// Every line up and including should hold the same offset
- for (int lineInfoIndex = 0; lineInfoIndex < numLineInfos; ++lineInfoIndex)
+ for (Index lineInfoIndex = 0; lineInfoIndex < numLineInfos; ++lineInfoIndex)
{
const auto& lineInfo = lineInfos[lineInfoIndex];
@@ -1857,7 +1857,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
}
- sourceFile->setLineBreakOffsets(lineBreakOffsets.Buffer(), lineBreakOffsets.Count());
+ sourceFile->setLineBreakOffsets(lineBreakOffsets.getBuffer(), lineBreakOffsets.getCount());
if (srcSourceInfo.m_numAdjustedLineInfos)
{
@@ -1865,12 +1865,12 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
int numEntries = int(srcSourceInfo.m_numAdjustedLineInfos);
- adjustedLineInfos.AddRange(m_serialData->m_debugAdjustedLineInfos.Buffer() + srcSourceInfo.m_adjustedLineInfosStartIndex, numEntries);
- adjustedLineInfos.Sort();
+ adjustedLineInfos.addRange(m_serialData->m_debugAdjustedLineInfos.getBuffer() + srcSourceInfo.m_adjustedLineInfosStartIndex, numEntries);
+ adjustedLineInfos.sort();
// Work out the views adjustments, and place in dstEntries
List<SourceView::Entry> dstEntries;
- dstEntries.SetSize(numEntries);
+ dstEntries.setCount(numEntries);
const uint32_t sourceLocOffset = uint32_t(sourceView->getRange().begin.getRaw());
@@ -1885,7 +1885,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
}
// Set the adjustments on the view
- sourceView->setEntries(dstEntries.Buffer(), dstEntries.Count());
+ sourceView->setEntries(dstEntries.getBuffer(), dstEntries.getCount());
}
sourceViews[i] = sourceView;
@@ -1895,14 +1895,14 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
{
List<IRSerialData::SourceLocRun> sourceRuns(m_serialData->m_debugSourceLocRuns);
// They are now in source location order
- sourceRuns.Sort();
+ sourceRuns.sort();
// Just guess initially 0 for the source file that contains the initial run
SourceRange range;
int fixSourceLoc = _calcFixSourceLoc(sourceInfos[0], sourceViews[0], range);
- const int numRuns = int(sourceRuns.Count());
- for (int i = 0; i < numRuns; ++i)
+ const Index numRuns = sourceRuns.getCount();
+ for (Index i = 0; i < numRuns; ++i)
{
const auto& run = sourceRuns[i];
const SourceLoc srcSourceLoc = SourceLoc::fromRaw(run.m_sourceLoc);
@@ -1922,8 +1922,8 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
// Work out the fixed source location
SourceLoc sourceLoc = SourceLoc::fromRaw(int(run.m_sourceLoc) + fixSourceLoc);
- SLANG_ASSERT(uint32_t(run.m_startInstIndex) + run.m_numInst <= insts.Count());
- IRInst** dstInsts = insts.Buffer() + int(run.m_startInstIndex);
+ SLANG_ASSERT(Index(uint32_t(run.m_startInstIndex) + run.m_numInst) <= insts.getCount());
+ IRInst** dstInsts = insts.getBuffer() + int(run.m_startInstIndex);
const int runSize = int(run.m_numInst);
for (int j = 0; j < runSize; ++j)
@@ -1942,30 +1942,30 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
/* static */void IRSerialUtil::calcInstructionList(IRModule* module, List<IRInst*>& instsOut)
{
// We reserve 0 for null
- instsOut.SetSize(1);
+ instsOut.setCount(1);
instsOut[0] = nullptr;
// Stack for parentInst
List<IRInst*> parentInstStack;
IRModuleInst* moduleInst = module->getModuleInst();
- parentInstStack.Add(moduleInst);
+ parentInstStack.add(moduleInst);
// Add to list
- instsOut.Add(moduleInst);
+ instsOut.add(moduleInst);
// Traverse all of the instructions
- while (parentInstStack.Count())
+ while (parentInstStack.getCount())
{
// If it's in the stack it is assumed it is already in the inst map
- IRInst* parentInst = parentInstStack.Last();
- parentInstStack.RemoveLast();
+ IRInst* parentInst = parentInstStack.getLast();
+ parentInstStack.removeLast();
IRInstListBase childrenList = parentInst->getDecorationsAndChildren();
for (IRInst* child : childrenList)
{
- instsOut.Add(child);
- parentInstStack.Add(child);
+ instsOut.add(child);
+ parentInstStack.add(child);
}
}
}
@@ -2015,7 +2015,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
List<IRInst*> readInsts;
calcInstructionList(irReadModule, readInsts);
- if (readInsts.Count() != originalInsts.Count())
+ if (readInsts.getCount() != originalInsts.getCount())
{
SLANG_ASSERT(!"Instruction counts don't match");
return SLANG_FAIL;
@@ -2025,7 +2025,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
{
SLANG_ASSERT(readInsts[0] == originalInsts[0]);
// All the source locs should be identical
- for (UInt i = 1; i < readInsts.Count(); ++i)
+ for (Index i = 1; i < readInsts.getCount(); ++i)
{
IRInst* origInst = originalInsts[i];
IRInst* readInst = readInsts[i];
@@ -2040,7 +2040,7 @@ static int _calcFixSourceLoc(const IRSerialData::DebugSourceInfo& info, SourceVi
else if (optionFlags & IRSerialWriter::OptionFlag::DebugInfo)
{
// They should be on the same line nos
- for (UInt i = 1; i < readInsts.Count(); ++i)
+ for (Index i = 1; i < readInsts.getCount(); ++i)
{
IRInst* origInst = originalInsts[i];
IRInst* readInst = readInsts[i];
diff --git a/source/slang/ir-serialize.h b/source/slang/ir-serialize.h
index c32013928..8be852e95 100644
--- a/source/slang/ir-serialize.h
+++ b/source/slang/ir-serialize.h
@@ -461,10 +461,10 @@ protected:
// Need to know how many lines there are
const List<uint32_t>& lineOffsets = sourceFile->getLineBreakOffsets();
- const auto numLineIndices = lineOffsets.Count();
+ const auto numLineIndices = lineOffsets.getCount();
// Set none as being used initially
- m_lineIndexUsed.SetSize(numLineIndices);
+ m_lineIndexUsed.setCount(numLineIndices);
::memset(m_lineIndexUsed.begin(), 0, numLineIndices * sizeof(uint8_t));
}
/// True if we have information on that line index
diff --git a/source/slang/ir-specialize-resources.cpp b/source/slang/ir-specialize-resources.cpp
index d25284927..96f328672 100644
--- a/source/slang/ir-specialize-resources.cpp
+++ b/source/slang/ir-specialize-resources.cpp
@@ -57,10 +57,10 @@ struct ResourceParameterSpecializationContext
// We will process the work list until it goes dry,
// treating it like a stack of work items.
//
- while( workList.Count() )
+ while( workList.getCount() )
{
- auto call = workList.Last();
- workList.RemoveLast();
+ auto call = workList.getLast();
+ workList.removeLast();
// At each call site we first check whether it
// is something we can (and should) specialize,
@@ -84,7 +84,7 @@ struct ResourceParameterSpecializationContext
//
if( auto call = as<IRCall>(inst) )
{
- workList.Add(call);
+ workList.add(call);
}
// Recursively walk through any children, to
@@ -395,8 +395,8 @@ struct ResourceParameterSpecializationContext
auto newCall = getBuilder()->emitCallInst(
oldCall->getFullType(),
newFunc,
- callInfo.newArgs.Count(),
- callInfo.newArgs.Buffer());
+ callInfo.newArgs.getCount(),
+ callInfo.newArgs.getBuffer());
newCall->insertBefore(oldCall);
oldCall->replaceUsesWith(newCall);
@@ -477,7 +477,7 @@ struct ResourceParameterSpecializationContext
// the original function, since different functions
// will always yield different specializations.
//
- callInfo.key.vals.Add(oldFunc);
+ callInfo.key.vals.add(oldFunc);
// The rest of the information is gathered by looking
// at parameter and argument pairs.
@@ -507,7 +507,7 @@ struct ResourceParameterSpecializationContext
// to add any information to distinguish the
// specialized callee based on this paramter.
//
- ioInfo.newArgs.Add(oldArg);
+ ioInfo.newArgs.add(oldArg);
}
else
{
@@ -537,7 +537,7 @@ struct ResourceParameterSpecializationContext
// callee reflects that we are specializing
// to the chosen parameter.
//
- ioInfo.key.vals.Add(oldGlobalParam);
+ ioInfo.key.vals.add(oldGlobalParam);
}
else if( oldArg->op == kIROp_getElement )
{
@@ -563,7 +563,7 @@ struct ResourceParameterSpecializationContext
// the arguments at the new call site, and
// don't add anything to the specialization key.
//
- ioInfo.newArgs.Add(oldIndex);
+ ioInfo.newArgs.add(oldIndex);
}
else
{
@@ -601,7 +601,7 @@ struct ResourceParameterSpecializationContext
// We will collect the replacement value to use
// for each of the original parameters in an array.
//
- funcInfo.replacementsForOldParameters.Add(newVal);
+ funcInfo.replacementsForOldParameters.add(newVal);
}
}
@@ -620,7 +620,7 @@ struct ResourceParameterSpecializationContext
// create it here.
//
auto newParam = getBuilder()->createParam(oldParam->getFullType());
- ioInfo.newParams.Add(newParam);
+ ioInfo.newParams.add(newParam);
// The new parameter will be used as the replacement
// for the old one in the specialized function.
@@ -683,7 +683,7 @@ struct ResourceParameterSpecializationContext
//
auto builder = getBuilder();
auto newIndex = builder->createParam(oldIndex->getFullType());
- ioInfo.newParams.Add(newIndex);
+ ioInfo.newParams.add(newIndex);
// Finally, we need to compute a value that
// can stand in for `oldArg` (which was
@@ -714,7 +714,7 @@ struct ResourceParameterSpecializationContext
// that should be inserted into the body of
// the specialized callee.
//
- ioInfo.newBodyInsts.Add(newVal);
+ ioInfo.newBodyInsts.add(newVal);
return newVal;
}
@@ -773,13 +773,13 @@ struct ResourceParameterSpecializationContext
List<IRType*> paramTypes;
for( auto param : funcInfo.newParams )
{
- paramTypes.Add(param->getFullType());
+ paramTypes.add(param->getFullType());
}
auto builder = getBuilder();
IRType* funcType = builder->getFuncType(
- paramTypes.Count(),
- paramTypes.Buffer(),
+ paramTypes.getCount(),
+ paramTypes.getBuffer(),
oldFunc->getResultType());
IRFunc* newFunc = builder->createFunc();
diff --git a/source/slang/ir-specialize.cpp b/source/slang/ir-specialize.cpp
index e491eaa31..57d14c11a 100644
--- a/source/slang/ir-specialize.cpp
+++ b/source/slang/ir-specialize.cpp
@@ -112,7 +112,7 @@ struct SpecializationContext
return;
}
- workList.Add(inst);
+ workList.add(inst);
}
// When a transformation makes a change to an instruction,
@@ -192,11 +192,11 @@ struct SpecializationContext
// the array `[g, a, b, c]`.
//
Key key;
- key.vals.Add(specializeInst->getBase());
+ key.vals.add(specializeInst->getBase());
UInt argCount = specializeInst->getArgCount();
for( UInt ii = 0; ii < argCount; ++ii )
{
- key.vals.Add(specializeInst->getArg(ii));
+ key.vals.add(specializeInst->getArg(ii));
}
{
@@ -568,10 +568,10 @@ struct SpecializationContext
// We will then iterate until our work list goes dry.
//
- while(workList.Count() != 0)
+ while(workList.getCount() != 0)
{
- IRInst* inst = workList.Last();
- workList.RemoveLast();
+ IRInst* inst = workList.getLast();
+ workList.removeLast();
// For each instruction we process, we want to perform
// a few steps.
@@ -677,7 +677,7 @@ struct SpecializationContext
// The specialized callee will always depend on the unspecialized
// function from which it is generated, so we add that to our key.
//
- key.vals.Add(calleeFunc);
+ key.vals.add(calleeFunc);
// Also, for any parameter that has an existential type, the
// specialized function will depend on the concrete type of the
@@ -700,7 +700,7 @@ struct SpecializationContext
//
auto val = makeExistential->getWrappedValue();
auto valType = val->getFullType();
- key.vals.Add(valType);
+ key.vals.add(valType);
// We are also including the witness table in the key.
// This isn't required with our current language model,
@@ -717,7 +717,7 @@ struct SpecializationContext
// table even if it is redundant.
//
auto witnessTable = makeExistential->getWitnessTable();
- key.vals.Add(witnessTable);
+ key.vals.add(witnessTable);
}
else
{
@@ -757,7 +757,7 @@ struct SpecializationContext
// If the parameter doesn't have an existential type, then we
// don't want to change up the argument we pass at all.
//
- newArgs.Add(arg);
+ newArgs.add(arg);
}
else
{
@@ -768,7 +768,7 @@ struct SpecializationContext
if( auto makeExistential = as<IRMakeExistential>(arg) )
{
auto val = makeExistential->getWrappedValue();
- newArgs.Add(val);
+ newArgs.add(val);
}
else
{
@@ -912,7 +912,7 @@ struct SpecializationContext
// and we'll use that instead of the original parameter.
//
auto newParam = builder->createParam(oldParam->getFullType());
- newParams.Add(newParam);
+ newParams.add(newParam);
replacementVal = newParam;
}
else
@@ -936,7 +936,7 @@ struct SpecializationContext
//
auto valType = val->getFullType();
auto newParam = builder->createParam(valType);
- newParams.Add(newParam);
+ newParams.add(newParam);
// Within the body of the function we cannot just use `val`
// directly, because the existing code expects an existential
@@ -948,7 +948,7 @@ struct SpecializationContext
// correct existential type, and stores the right witness table).
//
auto newMakeExistential = builder->emitMakeExistential(oldParam->getFullType(), newParam, witnessTable);
- newBodyInsts.Add(newMakeExistential);
+ newBodyInsts.add(newMakeExistential);
replacementVal = newMakeExistential;
}
else
@@ -972,11 +972,11 @@ struct SpecializationContext
List<IRType*> newParamTypes;
for( auto newParam : newParams )
{
- newParamTypes.Add(newParam->getFullType());
+ newParamTypes.add(newParam->getFullType());
}
IRType* newFuncType = builder->getFuncType(
- newParamTypes.Count(),
- newParamTypes.Buffer(),
+ newParamTypes.getCount(),
+ newParamTypes.getBuffer(),
oldFunc->getResultType());
IRFunc* newFunc = builder->createFunc();
newFunc->setFullType(newFuncType);
@@ -1190,7 +1190,7 @@ struct SpecializationContext
UInt slotOperandCount = wrapInst->getSlotOperandCount();
for( UInt ii = 0; ii < slotOperandCount; ++ii )
{
- slotOperands.Add(wrapInst->getSlotOperand(ii));
+ slotOperands.add(wrapInst->getSlotOperand(ii));
}
auto newLoadInst = builder.emitLoad(elementType, val);
@@ -1198,7 +1198,7 @@ struct SpecializationContext
resultType,
newLoadInst,
slotOperandCount,
- slotOperands.Buffer());
+ slotOperands.getBuffer());
addUsersToWorkList(inst);
diff --git a/source/slang/ir-ssa.cpp b/source/slang/ir-ssa.cpp
index 624454a43..64f9210e1 100644
--- a/source/slang/ir-ssa.cpp
+++ b/source/slang/ir-ssa.cpp
@@ -247,7 +247,7 @@ void identifyPromotableVars(
if (isPromotableVar(context, var))
{
- context->promotableVars.Add(var);
+ context->promotableVars.add(var);
}
}
}
@@ -262,7 +262,7 @@ IRVar* asPromotableVar(
return nullptr;
IRVar* var = (IRVar*)value;
- if (!context->promotableVars.Contains(var))
+ if (!context->promotableVars.contains(var))
return nullptr;
return var;
@@ -312,7 +312,7 @@ IRInst* applyAccessChain(
case kIROp_FieldAddress:
{
- SLANG_ASSERT(context->instsToRemove.Contains(accessChain));
+ SLANG_ASSERT(context->instsToRemove.contains(accessChain));
auto baseChain = accessChain->getOperand(0);
auto fieldKey = accessChain->getOperand(1);
@@ -326,7 +326,7 @@ IRInst* applyAccessChain(
case kIROp_getElementPtr:
{
- SLANG_ASSERT(context->instsToRemove.Contains(accessChain));
+ SLANG_ASSERT(context->instsToRemove.contains(accessChain));
auto baseChain = accessChain->getOperand(0);
auto index = accessChain->getOperand(1);
@@ -407,7 +407,7 @@ PhiInfo* addPhi(
phiInfo->phi = phi;
phiInfo->var = var;
- blockInfo->phis.Add(phiInfo);
+ blockInfo->phis.add(phiInfo);
return phiInfo;
}
@@ -474,7 +474,7 @@ IRInst* tryRemoveTrivialPhi(
auto maybeOtherPhi = (IRParam*) user;
if( auto otherPhiInfo = context->getPhiInfo(maybeOtherPhi) )
{
- otherPhis.Add(otherPhiInfo);
+ otherPhis.add(otherPhiInfo);
}
}
}
@@ -525,7 +525,7 @@ IRInst* addPhiOperands(
auto phiOperand = readVar(context, predInfo, var);
- operandValues.Add(phiOperand);
+ operandValues.add(phiOperand);
}
// The `IRUse` type needs to stay at a stable location
@@ -533,8 +533,8 @@ IRInst* addPhiOperands(
// list with its final size so that we can preserve the
// required invariant.
- UInt operandCount = operandValues.Count();
- phiInfo->operands.SetSize(operandCount);
+ UInt operandCount = operandValues.getCount();
+ phiInfo->operands.setCount(operandCount);
for(UInt ii = 0; ii < operandCount; ++ii)
{
phiInfo->operands[ii].init(phiInfo->phi, operandValues[ii]);
@@ -577,7 +577,7 @@ void maybeSealBlock(
// Note that we are doing the "inefficient" loop where we compute
// the count on each iteration to account for the possibility that
// new incomplete phis will get added while we are working.
- for (UInt ii = 0; ii < blockInfo->phis.Count(); ++ii)
+ for (Index ii = 0; ii < blockInfo->phis.getCount(); ++ii)
{
auto incompletePhi = blockInfo->phis[ii];
addPhiOperands(context, blockInfo, incompletePhi);
@@ -845,7 +845,7 @@ void processBlock(
auto ptrArg = ii->getOperand(0);
if (auto var = asPromotableVarAccessChain(context, ptrArg))
{
- context->instsToRemove.Add(ii);
+ context->instsToRemove.add(ii);
}
}
break;
@@ -929,7 +929,7 @@ static void breakCriticalEdges(
// Furthermore, the `IRUse` embedded in `succIter` represents
// that edge directly.
auto edgeUse = succIter.use;
- criticalEdges.Add(edgeUse);
+ criticalEdges.add(edgeUse);
}
}
@@ -984,7 +984,7 @@ void constructSSA(ConstructSSAContext* context)
// If none of the variables are promote-able,
// then we can exit without making any changes
- if (context->promotableVars.Count() == 0)
+ if (context->promotableVars.getCount() == 0)
return;
// We are going to walk the blocks in order,
@@ -1036,7 +1036,7 @@ void constructSSA(ConstructSSAContext* context)
phiInfo->operands[predIndex].clear();
- predInfo->successorArgs.Add(operandVal);
+ predInfo->successorArgs.add(operandVal);
}
}
}
@@ -1053,7 +1053,7 @@ void constructSSA(ConstructSSAContext* context)
// Don't do any work for blocks that don't need to pass along
// values to the sucessor block.
- auto addedArgCount = blockInfo->successorArgs.Count();
+ auto addedArgCount = blockInfo->successorArgs.getCount();
if (addedArgCount == 0)
continue;
@@ -1071,18 +1071,18 @@ void constructSSA(ConstructSSAContext* context)
List<IRInst*> newArgs;
for (UInt aa = 0; aa < oldArgCount; ++aa)
{
- newArgs.Add(oldTerminator->getOperand(aa));
+ newArgs.add(oldTerminator->getOperand(aa));
}
- for (UInt aa = 0; aa < addedArgCount; ++aa)
+ for (Index aa = 0; aa < addedArgCount; ++aa)
{
- newArgs.Add(blockInfo->successorArgs[aa]);
+ newArgs.add(blockInfo->successorArgs[aa]);
}
IRTerminatorInst* newTerminator = (IRTerminatorInst*)blockInfo->builder.emitIntrinsicInst(
oldTerminator->getFullType(),
oldTerminator->op,
newArgCount,
- newArgs.Buffer());
+ newArgs.getBuffer());
// Transfer decorations (a terminator should have no children) over to the new instruction.
//
diff --git a/source/slang/ir-union.cpp b/source/slang/ir-union.cpp
index 91e60c5bf..b4fbc4c96 100644
--- a/source/slang/ir-union.cpp
+++ b/source/slang/ir-union.cpp
@@ -230,7 +230,7 @@ struct DesugarUnionTypesContext
// list for later removal.
//
inst->replaceUsesWith(replacement);
- instsToRemove.Add(inst);
+ instsToRemove.add(inst);
}
break;
@@ -269,7 +269,7 @@ struct DesugarUnionTypesContext
// for fields, etc.).
//
auto taggedUnionTypeLayout = taggedUnionInfo->taggedUnionTypeLayout;
- SLANG_ASSERT(caseTagIndex < taggedUnionTypeLayout->caseTypeLayouts.Count());
+ SLANG_ASSERT(caseTagIndex < UInt(taggedUnionTypeLayout->caseTypeLayouts.getCount()));
auto caseTypeLayout = taggedUnionTypeLayout->caseTypeLayouts[caseTagIndex];
// At this point we know the type we are trying to extract, as well
@@ -321,7 +321,7 @@ struct DesugarUnionTypesContext
// this instruction, and schedule the original instruction for removal.
//
inst->replaceUsesWith(payloadVal);
- instsToRemove.Add(inst);
+ instsToRemove.add(inst);
}
break;
}
@@ -403,7 +403,7 @@ struct DesugarUnionTypesContext
fieldType,
fieldTypeLayout,
fieldOffset);
- fieldVals.Add(fieldVal);
+ fieldVals.add(fieldVal);
}
// The final value is then just a new struct constructed from
@@ -447,7 +447,7 @@ struct DesugarUnionTypesContext
elementType,
elementTypeLayout,
payloadOffset + ii*elementSize);
- elementVals.Add(elementVal);
+ elementVals.add(elementVal);
}
return builder->emitMakeVector(vecType, elementVals);
}
@@ -625,7 +625,7 @@ struct DesugarUnionTypesContext
//
auto info = createTaggedUnionInfo(type);
mapIRTypeToTaggedUnionInfo.Add(type, info.Ptr());
- taggedUnionInfos.Add(info);
+ taggedUnionInfos.add(info);
return info;
}
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 43ec09abb..150a5d544 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -275,12 +275,12 @@ namespace Slang
List<IRInst*> existentialArgs;
for( UInt ii = 0; ii < existentialArgCount; ++ii )
{
- existentialArgs.Add(bindExistentials->getExistentialArg(ii));
+ existentialArgs.add(bindExistentials->getExistentialArg(ii));
}
return builder->getBindExistentialsType(
baseElementType,
existentialArgCount,
- existentialArgs.Buffer());
+ existentialArgs.getBuffer());
}
}
@@ -1862,12 +1862,12 @@ namespace Slang
List<IRInst*> slotArgs;
for( UInt ii = 0; ii < slotArgCount; ++ii )
{
- slotArgs.Add(slotArgUses[ii].get());
+ slotArgs.add(slotArgUses[ii].get());
}
return getBindExistentialsType(
baseType,
slotArgCount,
- slotArgs.Buffer());
+ slotArgs.getBuffer());
}
@@ -3069,7 +3069,7 @@ namespace Slang
// Allow an empty nam
// Special case a name that is the empty string, just in case.
- if(name.Length() == 0)
+ if(name.getLength() == 0)
{
sb.append('_');
}
@@ -3766,7 +3766,7 @@ namespace Slang
dumpInst(&context, globalVal);
- writer->write(sb.Buffer(), sb.Length());
+ writer->write(sb.getBuffer(), sb.getLength());
writer->flush();
}
@@ -3780,7 +3780,7 @@ namespace Slang
void dumpIR(IRModule* module, ISlangWriter* writer, IRDumpMode mode)
{
String ir = getSlangIRAssembly(module, mode);
- writer->write(ir.Buffer(), ir.Length());
+ writer->write(ir.getBuffer(), ir.getLength());
writer->flush();
}
diff --git a/source/slang/legalize-types.cpp b/source/slang/legalize-types.cpp
index 995b797e4..64dafb938 100644
--- a/source/slang/legalize-types.cpp
+++ b/source/slang/legalize-types.cpp
@@ -22,7 +22,7 @@ LegalType LegalType::implicitDeref(
LegalType LegalType::tuple(
RefPtr<TuplePseudoType> tupleType)
{
- SLANG_ASSERT(tupleType->elements.Count());
+ SLANG_ASSERT(tupleType->elements.getCount());
LegalType result;
result.flavor = Flavor::tuple;
@@ -363,7 +363,7 @@ struct TupleTypeBuilder
SLANG_UNEXPECTED("unexpected ordinary field type");
}
}
- ordinaryElements.Add(ordinaryElement);
+ ordinaryElements.add(ordinaryElement);
if (specialType.flavor != LegalType::Flavor::none)
{
@@ -374,11 +374,11 @@ struct TupleTypeBuilder
TuplePseudoType::Element specialElement;
specialElement.key = fieldKey;
specialElement.type = specialType;
- specialElements.Add(specialElement);
+ specialElements.add(specialElement);
}
pairElement.type = LegalType::pair(ordinaryType, specialType, elementPairInfo);
- pairElements.Add(pairElement);
+ pairElements.add(pairElement);
}
// Add a field to the (pseudo-)type we are building
@@ -452,7 +452,7 @@ struct TupleTypeBuilder
// collide.
//
// (Also, the original type wasn't legal - that was the whole point...)
- context->replacedInstructions.Add(originalStructType);
+ context->replacedInstructions.add(originalStructType);
for(auto ee : ordinaryElements)
{
@@ -681,7 +681,7 @@ LegalType createLegalUniformBufferTypeForResources(
newElement.key = ee.key;
newElement.type = LegalType::implicitDeref(ee.type);
- bufferPseudoTupleType->elements.Add(newElement);
+ bufferPseudoTupleType->elements.add(newElement);
}
return LegalType::tuple(bufferPseudoTupleType);
@@ -808,7 +808,7 @@ LegalElementWrapping declareStructFields(
TupleLegalElementWrappingObj::Element element;
element.key = ee.key;
element.field = declareStructFields(context, structType, ee.type);
- obj->elements.Add(element);
+ obj->elements.add(element);
}
return LegalElementWrapping::makeTuple(obj);
}
@@ -952,7 +952,7 @@ static LegalType createLegalPtrType(
op,
ee.type);
- ptrPseudoTupleType->elements.Add(newElement);
+ ptrPseudoTupleType->elements.add(newElement);
}
return LegalType::tuple(ptrPseudoTupleType);
@@ -1072,7 +1072,7 @@ static LegalType wrapLegalType(
ordinaryWrapper,
specialWrapper);
- resultTupleType->elements.Add(element);
+ resultTupleType->elements.add(element);
}
return LegalType::tuple(resultTupleType);
diff --git a/source/slang/lexer.cpp b/source/slang/lexer.cpp
index b6745b15f..8cb9fa5ee 100644
--- a/source/slang/lexer.cpp
+++ b/source/slang/lexer.cpp
@@ -19,15 +19,15 @@ namespace Slang
Token* TokenList::begin() const
{
- SLANG_ASSERT(mTokens.Count());
+ SLANG_ASSERT(mTokens.getCount());
return &mTokens[0];
}
Token* TokenList::end() const
{
- SLANG_ASSERT(mTokens.Count());
- SLANG_ASSERT(mTokens[mTokens.Count()-1].type == TokenType::EndOfFile);
- return &mTokens[mTokens.Count() - 1];
+ SLANG_ASSERT(mTokens.getCount());
+ SLANG_ASSERT(mTokens[mTokens.getCount()-1].type == TokenType::EndOfFile);
+ return &mTokens[mTokens.getCount() - 1];
}
TokenSpan::TokenSpan()
@@ -1325,7 +1325,7 @@ namespace Slang
for(;;)
{
Token token = lexToken();
- tokenList.mTokens.Add(token);
+ tokenList.mTokens.add(token);
if(token.type == TokenType::EndOfFile)
return tokenList;
diff --git a/source/slang/lookup.cpp b/source/slang/lookup.cpp
index 2c822eb15..fe535d6e7 100644
--- a/source/slang/lookup.cpp
+++ b/source/slang/lookup.cpp
@@ -42,7 +42,7 @@ void buildMemberDictionary(ContainerDecl* decl)
return;
decl->memberDictionary.Clear();
- decl->transparentMembers.Clear();
+ decl->transparentMembers.clear();
// are we a generic?
GenericDecl* genericDecl = as<GenericDecl>(decl);
@@ -56,7 +56,7 @@ void buildMemberDictionary(ContainerDecl* decl)
{
TransparentMemberInfo info;
info.decl = m.Ptr();
- decl->transparentMembers.Add(info);
+ decl->transparentMembers.add(info);
}
// Ignore members with no name
@@ -121,13 +121,13 @@ void AddToLookupResult(
else if (!result.isOverloaded())
{
// We are about to make this overloaded
- result.items.Add(result.item);
- result.items.Add(item);
+ result.items.add(result.item);
+ result.items.add(item);
}
else
{
// The result was already overloaded, so we pile on
- result.items.Add(item);
+ result.items.add(item);
}
}
diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp
index 0864d4bfe..2e9915669 100644
--- a/source/slang/lower-to-ir.cpp
+++ b/source/slang/lower-to-ir.cpp
@@ -677,9 +677,9 @@ LoweredValInfo emitCallToDeclRef(
RefPtr<BoundSubscriptInfo> boundSubscript = new BoundSubscriptInfo();
boundSubscript->declRef = subscriptDeclRef;
boundSubscript->type = type;
- boundSubscript->args.AddRange(args, argCount);
+ boundSubscript->args.addRange(args, argCount);
- context->shared->extValues.Add(boundSubscript);
+ context->shared->extValues.add(boundSubscript);
return LoweredValInfo::boundSubscript(boundSubscript);
}
@@ -769,9 +769,9 @@ LoweredValInfo emitCallToDeclRef(
List<IRType*> argTypes;
for(UInt ii = 0; ii < argCount; ++ii)
{
- argTypes.Add(args[ii]->getDataType());
+ argTypes.add(args[ii]->getDataType());
}
- funcType = builder->getFuncType(argCount, argTypes.Buffer(), type);
+ funcType = builder->getFuncType(argCount, argTypes.getBuffer(), type);
}
LoweredValInfo funcVal = emitDeclRef(context, funcDeclRef, funcType);
return emitCallToVal(context, type, funcVal, argCount, args);
@@ -784,7 +784,7 @@ LoweredValInfo emitCallToDeclRef(
IRType* funcType,
List<IRInst*> const& args)
{
- return emitCallToDeclRef(context, type, funcDeclRef, funcType, args.Count(), args.Buffer());
+ return emitCallToDeclRef(context, type, funcDeclRef, funcType, args.getCount(), args.getBuffer());
}
IRInst* getFieldKey(
@@ -826,7 +826,7 @@ LoweredValInfo extractField(
boundMemberInfo->base = base;
boundMemberInfo->declRef = field;
- context->shared->extValues.Add(boundMemberInfo);
+ context->shared->extValues.add(boundMemberInfo);
return LoweredValInfo::boundMember(boundMemberInfo);
}
break;
@@ -1156,12 +1156,12 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
// We can turn each of those per-case witnesses into a witness
// table value:
//
- auto caseCount = val->caseWitnesses.Count();
+ auto caseCount = val->caseWitnesses.getCount();
List<IRInst*> caseWitnessTables;
for( auto caseWitness : val->caseWitnesses )
{
auto caseWitnessTable = lowerSimpleVal(context, caseWitness);
- caseWitnessTables.Add(caseWitnessTable);
+ caseWitnessTables.add(caseWitnessTable);
}
// Now we need to synthesize a witness table for the tagged union
@@ -1244,7 +1244,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
auto irThisParam = subBuilder->emitParam(irThisType);
List<IRType*> irParamTypes;
- irParamTypes.Add(irThisType);
+ irParamTypes.add(irThisType);
// Create the remaining parameters of the callable,
// using a decl-ref specialized to the tagged union
@@ -1262,8 +1262,8 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
auto irParamType = lowerType(context, GetType(paramDeclRef));
auto irParam = subBuilder->emitParam(irParamType);
- irParams.Add(irParam);
- irParamTypes.Add(irParamType);
+ irParams.add(irParam);
+ irParamTypes.add(irParamType);
}
auto irResultType = lowerType(context, GetResultType(callableDeclRef));
@@ -1286,7 +1286,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
IRBlock* defaultLabel = nullptr;
- for( UInt ii = 0; ii < caseCount; ++ii )
+ for( Index ii = 0; ii < caseCount; ++ii )
{
auto caseTag = subBuilder->getIntValue(irTagVal->getDataType(), ii);
@@ -1296,8 +1296,8 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
if(!defaultLabel)
defaultLabel = caseLabel;
- switchCaseOperands.Add(caseTag);
- switchCaseOperands.Add(caseLabel);
+ switchCaseOperands.add(caseTag);
+ switchCaseOperands.add(caseLabel);
subBuilder->setInsertInto(caseLabel);
@@ -1332,7 +1332,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
auto caseThisArg = subBuilder->emitExtractTaggedUnionPayload(
caseThisType,
irThisParam, caseTag);
- caseArgs.Add(caseThisArg);
+ caseArgs.add(caseThisArg);
// The remaining arguments to the call will just be forwarded from
// the parameters of the wrapper function.
@@ -1343,7 +1343,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
//
for( auto param : irParams )
{
- caseArgs.Add(param);
+ caseArgs.add(param);
}
auto caseCall = subBuilder->emitCallInst(caseResultType, caseFunc, caseArgs);
@@ -1375,8 +1375,8 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
irTagVal, // value to `switch` on
invalidLabel, // `break` label (block after the `switch` statement ends)
defaultLabel, // `default` label (where to go if no `case` matches)
- switchCaseOperands.Count(),
- switchCaseOperands.Buffer());
+ switchCaseOperands.getCount(),
+ switchCaseOperands.getBuffer());
}
else
{
@@ -1410,11 +1410,11 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
List<IRType*> paramTypes;
for (UInt pp = 0; pp < paramCount; ++pp)
{
- paramTypes.Add(lowerType(context, type->getParamType(pp)));
+ paramTypes.add(lowerType(context, type->getParamType(pp)));
}
return getBuilder()->getFuncType(
paramCount,
- paramTypes.Buffer(),
+ paramTypes.getBuffer(),
resultType);
}
@@ -1592,7 +1592,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower
for(auto caseType : type->caseTypes)
{
auto irCaseType = lowerType(context, caseType);
- irCaseTypes.Add(irCaseType);
+ irCaseTypes.add(irCaseType);
}
auto irType = getBuilder()->getTaggedUnionType(irCaseTypes);
@@ -1728,7 +1728,7 @@ static String getNameForNameHint(
// or with an empty name
if(!leafName)
return String();
- if(leafName->text.Length() == 0)
+ if(leafName->text.getLength() == 0)
return String();
@@ -1773,7 +1773,7 @@ static String getNameForNameHint(
}
auto parentName = getNameForNameHint(context, parentDecl);
- if(parentName.Length() == 0)
+ if(parentName.getLength() == 0)
{
return leafName->text;
}
@@ -1797,7 +1797,7 @@ static void addNameHint(
Decl* decl)
{
String name = getNameForNameHint(context, decl);
- if(name.Length() == 0)
+ if(name.getLength() == 0)
return;
context->irBuilder->addNameHintDecoration(inst, name.getUnownedSlice());
}
@@ -1846,7 +1846,7 @@ void addArgs(
case LoweredValInfo::Flavor::SwizzledLValue:
case LoweredValInfo::Flavor::BoundSubscript:
case LoweredValInfo::Flavor::BoundMember:
- args.Add(getSimpleVal(context, argInfo));
+ args.add(getSimpleVal(context, argInfo));
break;
default:
@@ -2070,10 +2070,10 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
List<IRInst*> args;
for(UInt ee = 0; ee < elementCount; ++ee)
{
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeVector(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeVector(irType, args.getCount(), args.getBuffer()));
}
else if (auto matrixType = as<MatrixExpressionType>(type))
{
@@ -2086,10 +2086,10 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
List<IRInst*> args;
for(UInt rr = 0; rr < rowCount; ++rr)
{
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeMatrix(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeMatrix(irType, args.getCount(), args.getBuffer()));
}
else if (auto arrayType = as<ArrayExpressionType>(type))
{
@@ -2100,11 +2100,11 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
List<IRInst*> args;
for(UInt ee = 0; ee < elementCount; ++ee)
{
- args.Add(irDefaultElement);
+ args.add(irDefaultElement);
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeArray(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeArray(irType, args.getCount(), args.getBuffer()));
}
else if (auto declRefType = as<DeclRefType>(type))
{
@@ -2118,11 +2118,11 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
continue;
auto irFieldVal = getSimpleVal(context, getDefaultVal(ff));
- args.Add(irFieldVal);
+ args.add(irFieldVal);
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeStruct(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeStruct(irType, args.getCount(), args.getBuffer()));
}
}
@@ -2149,7 +2149,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
IRType* irType = lowerType(context, type);
List<IRInst*> args;
- UInt argCount = expr->args.Count();
+ UInt argCount = expr->args.getCount();
// If the initializer list was empty, then the user was
// asking for default initialization, which should apply
@@ -2170,19 +2170,19 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
{
auto argExpr = expr->args[ee];
LoweredValInfo argVal = lowerRValueExpr(context, argExpr);
- args.Add(getSimpleVal(context, argVal));
+ args.add(getSimpleVal(context, argVal));
}
if(elementCount > argCount)
{
auto irDefaultValue = getSimpleVal(context, getDefaultVal(arrayType->baseType));
for(UInt ee = argCount; ee < elementCount; ++ee)
{
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeArray(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeArray(irType, args.getCount(), args.getBuffer()));
}
else if (auto vectorType = as<VectorExpressionType>(type))
{
@@ -2192,19 +2192,19 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
{
auto argExpr = expr->args[ee];
LoweredValInfo argVal = lowerRValueExpr(context, argExpr);
- args.Add(getSimpleVal(context, argVal));
+ args.add(getSimpleVal(context, argVal));
}
if(elementCount > argCount)
{
auto irDefaultValue = getSimpleVal(context, getDefaultVal(vectorType->elementType));
for(UInt ee = argCount; ee < elementCount; ++ee)
{
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeVector(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeVector(irType, args.getCount(), args.getBuffer()));
}
else if (auto matrixType = as<MatrixExpressionType>(type))
{
@@ -2214,7 +2214,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
{
auto argExpr = expr->args[rr];
LoweredValInfo argVal = lowerRValueExpr(context, argExpr);
- args.Add(getSimpleVal(context, argVal));
+ args.add(getSimpleVal(context, argVal));
}
if(rowCount > argCount)
{
@@ -2223,12 +2223,12 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
for(UInt rr = argCount; rr < rowCount; ++rr)
{
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeMatrix(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeMatrix(irType, args.getCount(), args.getBuffer()));
}
else if (auto declRefType = as<DeclRefType>(type))
{
@@ -2246,17 +2246,17 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
{
auto argExpr = expr->args[argIndex];
LoweredValInfo argVal = lowerRValueExpr(context, argExpr);
- args.Add(getSimpleVal(context, argVal));
+ args.add(getSimpleVal(context, argVal));
}
else
{
auto irDefaultValue = getSimpleVal(context, getDefaultVal(ff));
- args.Add(irDefaultValue);
+ args.add(irDefaultValue);
}
}
return LoweredValInfo::simple(
- getBuilder()->emitMakeStruct(irType, args.Count(), args.Buffer()));
+ getBuilder()->emitMakeStruct(irType, args.getCount(), args.getBuffer()));
}
}
@@ -2315,7 +2315,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
List<IRInst*>* ioArgs,
List<OutArgumentFixup>* ioFixups)
{
- UInt argCount = expr->Arguments.Count();
+ UInt argCount = expr->Arguments.getCount();
UInt argCounter = 0;
for (auto paramDeclRef : getMembersOfType<ParamDecl>(funcDeclRef))
{
@@ -2370,7 +2370,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
// pass in the actual pointer.
//
IRInst* argPtr = getAddress(context, loweredArg, argExpr->loc);
- (*ioArgs).Add(argPtr);
+ (*ioArgs).add(argPtr);
}
else if (paramDecl->HasModifier<OutModifier>()
|| paramDecl->HasModifier<InOutModifier>())
@@ -2414,7 +2414,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
// Now we can pass the address of the temporary variable
// to the callee as the actual argument for the `in out`
SLANG_ASSERT(tempVar.flavor == LoweredValInfo::Flavor::Ptr);
- (*ioArgs).Add(tempVar.val);
+ (*ioArgs).add(tempVar.val);
// Finally, after the call we will need
// to copy in the other direction: from our
@@ -2423,7 +2423,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo>
fixup.src = tempVar;
fixup.dst = loweredArg;
- (*ioFixups).Add(fixup);
+ (*ioFixups).add(fixup);
}
else
@@ -2823,7 +2823,7 @@ struct LValueExprLoweringVisitor : ExprLoweringVisitorBase<LValueExprLoweringVis
}
}
- context->shared->extValues.Add(swizzledLValue);
+ context->shared->extValues.add(swizzledLValue);
return LoweredValInfo::swizzledLValue(swizzledLValue);
}
};
@@ -3517,8 +3517,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor>
auto label = getLabelForCase(info);
// Add this `case` to the list for the enclosing `switch`.
- info->cases.Add(caseVal);
- info->cases.Add(label);
+ info->cases.add(caseVal);
+ info->cases.add(label);
}
else if(auto defaultStmt = as<DefaultStmt>(stmt))
{
@@ -3655,8 +3655,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor>
conditionVal,
breakLabel,
defaultLabel,
- info.cases.Count(),
- info.cases.Buffer());
+ info.cases.getCount(),
+ info.cases.getBuffer());
// Finally we insert the label that a `break` will jump to
// (and that control flow will fall through to otherwise).
@@ -3795,7 +3795,7 @@ LoweredValInfo tryGetAddress(
auto newBase = tryGetAddress(context, originalBase, TryGetAddressMode::Aggressive);
RefPtr<SwizzledLValueInfo> newSwizzleInfo = new SwizzledLValueInfo();
- context->shared->extValues.Add(newSwizzleInfo);
+ context->shared->extValues.add(newSwizzleInfo);
newSwizzleInfo->base = newBase;
newSwizzleInfo->type = originalSwizzleInfo->type;
@@ -4561,11 +4561,11 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
{
if (auto typeParamDecl = as<GenericTypeParamDecl>(member))
{
- genericArgs.Add(getSimpleVal(context, ensureDecl(context, typeParamDecl)));
+ genericArgs.add(getSimpleVal(context, ensureDecl(context, typeParamDecl)));
}
else if (auto valDecl = as<GenericValueParamDecl>(member))
{
- genericArgs.Add(getSimpleVal(context, ensureDecl(context, valDecl)));
+ genericArgs.add(getSimpleVal(context, ensureDecl(context, valDecl)));
}
}
// Then we emit constraint parameters, again in
@@ -4574,11 +4574,11 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
{
if (auto constraintDecl = as<GenericTypeConstraintDecl>(member))
{
- genericArgs.Add(getSimpleVal(context, ensureDecl(context, constraintDecl)));
+ genericArgs.add(getSimpleVal(context, ensureDecl(context, constraintDecl)));
}
}
- return builder->emitSpecializeInst(type, specialiedOuterVal, genericArgs.Count(), genericArgs.Buffer());
+ return builder->emitSpecializeInst(type, specialiedOuterVal, genericArgs.getCount(), genericArgs.getBuffer());
}
IRInst* defaultSpecializeOuterGenerics(
@@ -5239,7 +5239,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
info.direction = direction;
info.isThisParam = true;
- ioParameterLists->params.Add(info);
+ ioParameterLists->params.add(info);
}
void addThisParameter(
ParameterDirection direction,
@@ -5321,7 +5321,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
{
for( auto paramDecl : callableDecl->GetParameters() )
{
- ioParameterLists->params.Add(getParameterInfo(paramDecl));
+ ioParameterLists->params.add(getParameterInfo(paramDecl));
}
}
}
@@ -5588,7 +5588,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
irParamType = maybeGetConstExprType(irParamType, paramInfo.decl);
}
- paramTypes.Add(irParamType);
+ paramTypes.add(irParamType);
}
auto irResultType = lowerType(subContext, declForReturnType->ReturnType);
@@ -5601,7 +5601,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
// it as a parameter.
//
IRType* irParamType = irResultType;
- paramTypes.Add(irParamType);
+ paramTypes.add(irParamType);
// Instead, a setter always returns `void`
//
@@ -5616,8 +5616,8 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
}
auto irFuncType = subBuilder->getFuncType(
- paramTypes.Count(),
- paramTypes.Buffer(),
+ paramTypes.getCount(),
+ paramTypes.getBuffer(),
irResultType);
irFunc->setFullType(irFuncType);
@@ -6090,7 +6090,7 @@ LoweredValInfo emitDeclRef(
{
auto irArgVal = lowerSimpleVal(context, argVal);
SLANG_ASSERT(irArgVal);
- irArgs.Add(irArgVal);
+ irArgs.add(irArgVal);
}
// Once we have both the generic and its arguments,
@@ -6099,8 +6099,8 @@ LoweredValInfo emitDeclRef(
auto irSpecializedVal = context->irBuilder->emitSpecializeInst(
type,
irGenericVal,
- irArgs.Count(),
- irArgs.Buffer());
+ irArgs.getCount(),
+ irArgs.getBuffer());
return LoweredValInfo::simple(irSpecializedVal);
}
@@ -6226,18 +6226,18 @@ static void lowerProgramEntryPointToIR(
if( existentialTypeArgCount )
{
List<IRInst*> existentialSlotArgs;
- for( UInt ii = 0; ii < existentialTypeArgCount; ++ii )
+ for( Index ii = 0; ii < existentialTypeArgCount; ++ii )
{
auto arg = entryPoint->getExistentialTypeArg(ii);
auto irArgType = lowerType(context, arg.type);
auto irWitnessTable = lowerSimpleVal(context, arg.witness);
- existentialSlotArgs.Add(irArgType);
- existentialSlotArgs.Add(irWitnessTable);
+ existentialSlotArgs.add(irArgType);
+ existentialSlotArgs.add(irWitnessTable);
}
- builder->addBindExistentialSlotsDecoration(loweredEntryPointFunc, existentialSlotArgs.Count(), existentialSlotArgs.Buffer());
+ builder->addBindExistentialSlotsDecoration(loweredEntryPointFunc, existentialSlotArgs.getCount(), existentialSlotArgs.getBuffer());
}
@@ -6456,18 +6456,18 @@ RefPtr<IRModule> generateIRForProgram(
if( existentialTypeArgCount )
{
List<IRInst*> existentialSlotArgs;
- for( UInt ii = 0; ii < existentialTypeArgCount; ++ii )
+ for( Index ii = 0; ii < existentialTypeArgCount; ++ii )
{
auto arg = program->getExistentialTypeArg(ii);
auto irArgType = lowerType(context, arg.type);
auto irWitnessTable = lowerSimpleVal(context, arg.witness);
- existentialSlotArgs.Add(irArgType);
- existentialSlotArgs.Add(irWitnessTable);
+ existentialSlotArgs.add(irArgType);
+ existentialSlotArgs.add(irWitnessTable);
}
- builder->emitBindGlobalExistentialSlots(existentialSlotArgs.Count(), existentialSlotArgs.Buffer());
+ builder->emitBindGlobalExistentialSlots(existentialSlotArgs.getCount(), existentialSlotArgs.getBuffer());
}
diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp
index 61fa709b1..2ed9cfea6 100644
--- a/source/slang/mangle.cpp
+++ b/source/slang/mangle.cpp
@@ -46,7 +46,7 @@ namespace Slang
// We prefix the string with its byte length, so that
// decoding doesn't have to worry about finding a terminator.
- UInt length = str.Length();
+ Index length = str.getLength();
emit(context, length);
context->sb.append(str);
}
@@ -279,7 +279,7 @@ namespace Slang
{
// This is the case where we *do* have substitutions.
emitRaw(context, "G");
- UInt genericArgCount = subst->args.Count();
+ UInt genericArgCount = subst->args.getCount();
emit(context, genericArgCount);
for( auto aa : subst->args )
{
diff --git a/source/slang/options.cpp b/source/slang/options.cpp
index 6474f2afe..a5cdfef44 100644
--- a/source/slang/options.cpp
+++ b/source/slang/options.cpp
@@ -173,7 +173,7 @@ struct OptionsParser
SlangSourceLanguage language,
Stage impliedStage)
{
- auto translationUnitIndex = rawTranslationUnits.Count();
+ auto translationUnitIndex = rawTranslationUnits.getCount();
auto translationUnitID = spAddTranslationUnit(compileRequest, language, nullptr);
// As a sanity check: the API should be returning the same translation
@@ -181,14 +181,14 @@ struct OptionsParser
// be broken if we decide to support a mix of translation units specified
// via API, and ones specified via command-line arguments.
//
- SLANG_RELEASE_ASSERT(UInt(translationUnitID) == translationUnitIndex);
+ SLANG_RELEASE_ASSERT(Index(translationUnitID) == translationUnitIndex);
RawTranslationUnit rawTranslationUnit;
rawTranslationUnit.sourceLanguage = language;
rawTranslationUnit.translationUnitID = translationUnitID;
rawTranslationUnit.impliedStage = impliedStage;
- rawTranslationUnits.Add(rawTranslationUnit);
+ rawTranslationUnits.add(rawTranslationUnit);
return int(translationUnitIndex);
}
@@ -247,7 +247,7 @@ struct OptionsParser
for (int i = 0; i < SLANG_COUNT_OF(entries); ++i)
{
const Entry& entry = entries[i];
- if (path.EndsWith(entry.ext))
+ if (path.endsWith(entry.ext))
{
return entry.profileId;
}
@@ -283,7 +283,7 @@ struct OptionsParser
for (int i = 0; i < SLANG_COUNT_OF(entries); ++i)
{
const Entry& entry = entries[i];
- if (path.EndsWith(entry.ext))
+ if (path.endsWith(entry.ext))
{
outImpliedStage = Stage(entry.impliedStage);
return entry.sourceLanguage;
@@ -301,7 +301,7 @@ struct OptionsParser
// how we should handle it.
String path = String(inPath);
- if( path.EndsWith(".slang") )
+ if( path.endsWith(".slang") )
{
// Plain old slang code
addInputSlangPath(path);
@@ -329,7 +329,7 @@ struct OptionsParser
RawOutput rawOutput;
rawOutput.path = path;
rawOutput.impliedFormat = impliedFormat;
- rawOutputs.Add(rawOutput);
+ rawOutputs.add(rawOutput);
}
void addOutputPath(char const* inPath)
@@ -338,7 +338,7 @@ struct OptionsParser
if (!inPath) {}
#define CASE(EXT, TARGET) \
- else if(path.EndsWith(EXT)) do { addOutputPath(path, CodeGenTarget(SLANG_##TARGET)); } while(0)
+ else if(path.endsWith(EXT)) do { addOutputPath(path, CodeGenTarget(SLANG_##TARGET)); } while(0)
CASE(".hlsl", HLSL);
CASE(".fx", HLSL);
@@ -362,7 +362,7 @@ struct OptionsParser
#undef CASE
- else if (path.EndsWith(".slang-module"))
+ else if (path.endsWith(".slang-module"))
{
spSetOutputContainerFormat(compileRequest, SLANG_CONTAINER_FORMAT_SLANG_MODULE);
requestImpl->containerOutputPath = path;
@@ -377,7 +377,7 @@ struct OptionsParser
RawEntryPoint* getCurrentEntryPoint()
{
- auto rawEntryPointCount = rawEntryPoints.Count();
+ auto rawEntryPointCount = rawEntryPoints.getCount();
return rawEntryPointCount ? &rawEntryPoints[rawEntryPointCount-1] : &defaultEntryPoint;
}
@@ -396,7 +396,7 @@ struct OptionsParser
RawTarget* getCurrentTarget()
{
- auto rawTargetCount = rawTargets.Count();
+ auto rawTargetCount = rawTargets.getCount();
return rawTargetCount ? &rawTargets[rawTargetCount-1] : &defaultTarget;
}
@@ -510,7 +510,7 @@ struct OptionsParser
RawTarget rawTarget;
rawTarget.format = CodeGenTarget(format);
- rawTargets.Add(rawTarget);
+ rawTargets.add(rawTarget);
}
// A "profile" can specify both a general capability level for
// a target, and also (as a legacy/compatibility feature) a
@@ -566,7 +566,7 @@ struct OptionsParser
rawEntryPoint.name = name;
rawEntryPoint.translationUnitIndex = currentTranslationUnitIndex;
- rawEntryPoints.Add(rawEntryPoint);
+ rawEntryPoints.add(rawEntryPoint);
}
else if (argStr == "-pass-through")
{
@@ -808,15 +808,15 @@ struct OptionsParser
// of the translation unit, then we assume they wanted to compile a single
// entry point named `main`.
//
- if(rawEntryPoints.Count() == 0
- && rawTranslationUnits.Count() == 1
+ if(rawEntryPoints.getCount() == 0
+ && rawTranslationUnits.getCount() == 1
&& (defaultEntryPoint.stage != Stage::Unknown
|| rawTranslationUnits[0].impliedStage != Stage::Unknown))
{
RawEntryPoint entry;
entry.name = "main";
entry.translationUnitIndex = 0;
- rawEntryPoints.Add(entry);
+ rawEntryPoints.add(entry);
}
// If the user (manually or implicitly) specified only a single entry point,
@@ -825,7 +825,7 @@ struct OptionsParser
// to the "default" entry point, we should copy it over to the
// explicit one.
//
- if( rawEntryPoints.Count() == 1 )
+ if( rawEntryPoints.getCount() == 1 )
{
if(defaultEntryPoint.stage != Stage::Unknown)
{
@@ -848,7 +848,7 @@ struct OptionsParser
//
if( defaultEntryPoint.stage != Stage::Unknown )
{
- if( rawEntryPoints.Count() == 0 )
+ if( rawEntryPoints.getCount() == 0 )
{
sink->diagnose(SourceLoc(), Diagnostics::stageSpecificationIgnoredBecauseNoEntryPoints);
}
@@ -988,7 +988,7 @@ struct OptionsParser
// If there was no explicit `-target` specified, then we will look
// at the `-o` options to see what we can infer.
//
- if(rawTargets.Count() == 0)
+ if(rawTargets.getCount() == 0)
{
for(auto& rawOutput : rawOutputs)
{
@@ -1000,11 +1000,11 @@ struct OptionsParser
int targetIndex = 0;
if( !mapFormatToTargetIndex.TryGetValue(impliedFormat, targetIndex) )
{
- targetIndex = (int) rawTargets.Count();
+ targetIndex = (int) rawTargets.getCount();
RawTarget rawTarget;
rawTarget.format = impliedFormat;
- rawTargets.Add(rawTarget);
+ rawTargets.add(rawTarget);
mapFormatToTargetIndex[impliedFormat] = targetIndex;
}
@@ -1019,7 +1019,7 @@ struct OptionsParser
// is specified more than once (just because of the ambiguities
// it will create).
//
- int targetCount = (int) rawTargets.Count();
+ int targetCount = (int) rawTargets.getCount();
for(int targetIndex = 0; targetIndex < targetCount; ++targetIndex)
{
auto format = rawTargets[targetIndex].format;
@@ -1039,7 +1039,7 @@ struct OptionsParser
// because there were no output paths), but there was a profile specified,
// then we can try to infer a target from the profile.
//
- if( rawTargets.Count() == 0
+ if( rawTargets.getCount() == 0
&& defaultTarget.profileVersion != ProfileVersion::Unknown
&& !defaultTarget.conflictingProfilesSet)
{
@@ -1085,14 +1085,14 @@ struct OptionsParser
{
RawTarget rawTarget;
rawTarget.format = inferredFormat;
- rawTargets.Add(rawTarget);
+ rawTargets.add(rawTarget);
}
}
// Similar to the case for entry points, if there is a single target,
// then we allow some of its options to come from the "default"
// target state.
- if(rawTargets.Count() == 1)
+ if(rawTargets.getCount() == 1)
{
if(defaultTarget.profileVersion != ProfileVersion::Unknown)
{
@@ -1114,7 +1114,7 @@ struct OptionsParser
//
if( defaultTarget.profileVersion != ProfileVersion::Unknown )
{
- if( rawTargets.Count() == 0 )
+ if( rawTargets.getCount() == 0 )
{
// This should only happen if there were multiple `-profile` options,
// so we didn't try to infer a target, or if the `-profile` option
@@ -1130,7 +1130,7 @@ struct OptionsParser
if( defaultTarget.targetFlags )
{
- if( rawTargets.Count() == 0 )
+ if( rawTargets.getCount() == 0 )
{
sink->diagnose(SourceLoc(), Diagnostics::targetFlagsIgnoredBecauseNoTargets);
}
@@ -1142,7 +1142,7 @@ struct OptionsParser
if( defaultTarget.floatingPointMode != FloatingPointMode::Default )
{
- if( rawTargets.Count() == 0 )
+ if( rawTargets.getCount() == 0 )
{
sink->diagnose(SourceLoc(), Diagnostics::targetFlagsIgnoredBecauseNoTargets);
}
@@ -1204,7 +1204,7 @@ struct OptionsParser
// If there is only a single entry point, then that is automatically
// the entry point that should be associated with all outputs.
//
- if( rawEntryPoints.Count() == 1 )
+ if( rawEntryPoints.getCount() == 1 )
{
for( auto& rawOutput : rawOutputs )
{
@@ -1215,7 +1215,7 @@ struct OptionsParser
// Similarly, if there is only one target, then all outputs must
// implicitly appertain to that target.
//
- if( rawTargets.Count() == 1 )
+ if( rawTargets.getCount() == 1 )
{
for( auto& rawOutput : rawOutputs )
{
diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp
index 293a24338..bdb76a005 100644
--- a/source/slang/parameter-binding.cpp
+++ b/source/slang/parameter-binding.cpp
@@ -99,7 +99,7 @@ struct UsedRanges
// using indices, because we may actually modify
// the array as we go.
//
- Int rangeCount = ranges.Count();
+ Int rangeCount = ranges.getCount();
for(Int rr = 0; rr < rangeCount; ++rr)
{
auto existingRange = ranges[rr];
@@ -161,7 +161,7 @@ struct UsedRanges
prefix.begin = range.begin;
prefix.end = existingRange.begin;
prefix.parameter = range.parameter;
- ranges.Add(prefix);
+ ranges.add(prefix);
}
//
// Now we know that the interval `[range.begin, existingRange.begin)`
@@ -195,14 +195,14 @@ struct UsedRanges
//
if(range.begin < range.end)
{
- ranges.Add(range);
+ ranges.add(range);
}
// Any ranges that got added along the way might not
// be in the proper sorted order, so we'll need to
// sort the array to restore our global invariant.
//
- ranges.Sort();
+ ranges.sort();
// We end by returning an overlapping parameter that
// we found along the way, if any.
@@ -250,7 +250,7 @@ struct UsedRanges
{
UInt begin = 0;
- UInt rangeCount = ranges.Count();
+ UInt rangeCount = ranges.getCount();
for (UInt rr = 0; rr < rangeCount; ++rr)
{
// try to fit in before this range...
@@ -584,7 +584,7 @@ static bool findLayoutArg(
{
if( modifier )
{
- *outVal = (UInt) strtoull(String(modifier->valToken.Content).Buffer(), nullptr, 10);
+ *outVal = (UInt) strtoull(String(modifier->valToken.Content).getBuffer(), nullptr, 10);
return true;
}
}
@@ -671,8 +671,8 @@ static void collectGlobalGenericParameter(
{
RefPtr<GenericParamLayout> layout = new GenericParamLayout();
layout->decl = paramDecl;
- layout->index = (int)context->shared->programLayout->globalGenericParams.Count();
- context->shared->programLayout->globalGenericParams.Add(layout);
+ layout->index = (int)context->shared->programLayout->globalGenericParams.getCount();
+ context->shared->programLayout->globalGenericParams.add(layout);
context->shared->programLayout->globalGenericParamsMap[layout->decl->getName()->text] = layout.Ptr();
}
@@ -716,10 +716,10 @@ static void collectGlobalScopeParameter(
// TODO: `ParameterInfo` should probably become `LayoutParamInfo`.
//
ParameterInfo* parameterInfo = new ParameterInfo();
- context->shared->parameters.Add(parameterInfo);
+ context->shared->parameters.add(parameterInfo);
// Add the first variable declaration to the list of declarations for the parameter
- parameterInfo->varLayouts.Add(varLayout);
+ parameterInfo->varLayouts.add(varLayout);
// Add any additional variables to the list of declarations
for( auto additionalVarDeclRef : shaderParamInfo.additionalParamDeclRefs )
@@ -739,7 +739,7 @@ static void collectGlobalScopeParameter(
additionalVarLayout->typeLayout = typeLayout;
additionalVarLayout->varDecl = additionalVarDeclRef;
- parameterInfo->varLayouts.Add(additionalVarLayout);
+ parameterInfo->varLayouts.add(additionalVarLayout);
}
}
@@ -1002,7 +1002,7 @@ void generateParameterBindings(
RefPtr<ParameterInfo> parameterInfo)
{
// There must be at least one declaration for the parameter.
- SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.Count() != 0);
+ SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.getCount() != 0);
// Iterate over all declarations looking for explicit binding information.
for( auto& varLayout : parameterInfo->varLayouts )
@@ -1246,8 +1246,8 @@ static void completeBindingsForParameter(
// that earlier code has validated that the declarations
// "match".
- SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.Count() != 0);
- auto firstVarLayout = parameterInfo->varLayouts.First();
+ SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.getCount() != 0);
+ auto firstVarLayout = parameterInfo->varLayouts.getFirst();
completeBindingsForParameterImpl(
context,
@@ -1342,7 +1342,7 @@ SimpleSemanticInfo decomposeSimpleSemantic(
// The name is everything before the digits
String stringComposedName(composedName);
- info.name = stringComposedName.SubString(0, indexLoc);
+ info.name = stringComposedName.subString(0, indexLoc);
info.index = strtol(stringComposedName.begin() + indexLoc, nullptr, 10);
}
return info;
@@ -1362,11 +1362,11 @@ static RefPtr<TypeLayout> processSimpleEntryPointParameter(
auto semanticIndex = *state.ioSemanticIndex;
String semanticName = optSemanticName ? *optSemanticName : "";
- String sn = semanticName.ToLower();
+ String sn = semanticName.toLower();
RefPtr<TypeLayout> typeLayout;
- if (sn.StartsWith("sv_")
- || sn.StartsWith("nv_"))
+ if (sn.startsWith("sv_")
+ || sn.startsWith("nv_"))
{
// System-value semantic.
@@ -1626,7 +1626,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter(
// supposed to be case-insensitive and
// upper-case is the dominant convention.
String semanticName = *optSemanticName;
- String sn = semanticName.ToUpper();
+ String sn = semanticName.toUpper();
auto semanticIndex = *state.ioSemanticIndex;
@@ -1720,7 +1720,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter(
}
}
- structLayout->fields.Add(fieldVarLayout);
+ structLayout->fields.add(fieldVarLayout);
structLayout->mapVarToLayout.Add(field.getDecl(), fieldVarLayout);
}
@@ -1883,7 +1883,7 @@ struct ScopeLayoutBuilder
}
}
- m_structLayout->fields.Add(firstVarLayout);
+ m_structLayout->fields.add(firstVarLayout);
if( parameterInfo )
{
@@ -1934,8 +1934,8 @@ struct ScopeLayoutBuilder
void addParameter(
ParameterInfo* parameterInfo)
{
- SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.Count() != 0);
- auto firstVarLayout = parameterInfo->varLayouts.First();
+ SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.getCount() != 0);
+ auto firstVarLayout = parameterInfo->varLayouts.getFirst();
_addParameter(firstVarLayout, parameterInfo);
}
@@ -2024,7 +2024,7 @@ static void collectEntryPointParameters(
// The entry point layout must be added to the output
// program layout so that it can be accessed by reflection.
//
- context->shared->programLayout->entryPoints.Add(entryPointLayout);
+ context->shared->programLayout->entryPoints.add(entryPointLayout);
// For the duration of our parameter collection work we will
// establish this entry point as the current one in the context.
@@ -2041,7 +2041,7 @@ static void collectEntryPointParameters(
SLANG_ASSERT(taggedUnionType);
auto substType = taggedUnionType->Substitute(typeSubst).as<Type>();
auto typeLayout = createTypeLayout(context->layoutContext, substType);
- entryPointLayout->taggedUnionTypeLayouts.Add(typeLayout);
+ entryPointLayout->taggedUnionTypeLayouts.add(typeLayout);
}
// We are going to iterate over the entry-point parameters,
@@ -2337,8 +2337,8 @@ RefPtr<ProgramLayout> generateParameterBindings(
bool needDefaultConstantBuffer = false;
for( auto& parameterInfo : sharedContext.parameters )
{
- SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.Count() != 0);
- auto firstVarLayout = parameterInfo->varLayouts.First();
+ SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.getCount() != 0);
+ auto firstVarLayout = parameterInfo->varLayouts.getFirst();
// Does the field have any uniform data?
if( firstVarLayout->typeLayout->FindResourceInfo(LayoutResourceKind::Uniform) )
@@ -2366,8 +2366,8 @@ RefPtr<ProgramLayout> generateParameterBindings(
//
for (auto& parameterInfo : sharedContext.parameters)
{
- SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.Count() != 0);
- auto firstVarLayout = parameterInfo->varLayouts.First();
+ SLANG_RELEASE_ASSERT(parameterInfo->varLayouts.getCount() != 0);
+ auto firstVarLayout = parameterInfo->varLayouts.getFirst();
// For each parameter, we will look at each resource it consumes.
//
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index a6063a2a9..825aea324 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -735,7 +735,7 @@ namespace Slang
auto arg = parser->ParseArgExpr();
if (arg)
{
- modifier->args.Add(arg);
+ modifier->args.add(arg);
}
if (AdvanceIfMatch(parser, TokenType::RParent))
@@ -1075,7 +1075,7 @@ namespace Slang
if (container)
{
member->ParentDecl = container.Ptr();
- container->Members.Add(member);
+ container->Members.add(member);
container->memberDictionaryIsValid = false;
}
@@ -1597,13 +1597,13 @@ namespace Slang
{
group = new DeclGroup();
group->loc = startPosition;
- group->decls.Add(decl);
+ group->decls.add(decl);
decl = nullptr;
}
if( group )
{
- group->decls.Add(newDecl);
+ group->decls.add(newDecl);
}
else
{
@@ -1662,10 +1662,10 @@ namespace Slang
parser->ReadToken(TokenType::OpLess);
parser->genericDepth++;
// For now assume all generics have at least one argument
- genericApp->Arguments.Add(ParseGenericArg(parser));
+ genericApp->Arguments.add(ParseGenericArg(parser));
while (AdvanceIf(parser, TokenType::Comma))
{
- genericApp->Arguments.Add(ParseGenericArg(parser));
+ genericApp->Arguments.add(ParseGenericArg(parser));
}
parser->genericDepth--;
@@ -1778,7 +1778,7 @@ namespace Slang
while(!AdvanceIfMatch(parser, TokenType::RParent))
{
auto caseType = parser->ParseTypeExp();
- taggedUnionType->caseTypes.Add(caseType);
+ taggedUnionType->caseTypes.add(caseType);
if(AdvanceIf(parser, TokenType::RParent))
break;
@@ -2258,7 +2258,7 @@ namespace Slang
bufferDataTypeExpr->name = bufferDataTypeDecl->nameAndLoc.name;
bufferDataTypeExpr->scope = parser->currentScope.Ptr();
- // Construct a type exrpession to reference the type constructor
+ // Construct a type expression to reference the type constructor
auto bufferWrapperTypeExpr = new VarExpr();
bufferWrapperTypeExpr->loc = bufferWrapperTypeNamePos;
bufferWrapperTypeExpr->name = getName(parser, bufferWrapperTypeName);
@@ -2272,11 +2272,11 @@ namespace Slang
auto bufferVarTypeExpr = new GenericAppExpr();
bufferVarTypeExpr->loc = bufferVarDecl->loc;
bufferVarTypeExpr->FunctionExpr = bufferWrapperTypeExpr;
- bufferVarTypeExpr->Arguments.Add(bufferDataTypeExpr);
+ bufferVarTypeExpr->Arguments.add(bufferDataTypeExpr);
bufferVarDecl->type.exp = bufferVarTypeExpr;
- // Any semantics applied to the bufer declaration are taken as applying
+ // Any semantics applied to the buffer declaration are taken as applying
// to the variable instead.
ParseOptSemantics(parser, bufferVarDecl.Ptr());
@@ -2943,7 +2943,7 @@ namespace Slang
}
else if( auto declGroup = as<DeclGroup>(declBase) )
{
- if( declGroup->decls.Count() == 1 )
+ if( declGroup->decls.getCount() == 1 )
{
return declGroup->decls[0];
}
@@ -3340,14 +3340,14 @@ namespace Slang
}
else if (auto seqStmt = as<SeqStmt>(body))
{
- seqStmt->stmts.Add(stmt);
+ seqStmt->stmts.add(stmt);
}
else
{
RefPtr<SeqStmt> newBody = new SeqStmt();
newBody->loc = blockStatement->loc;
- newBody->stmts.Add(body);
- newBody->stmts.Add(stmt);
+ newBody->stmts.add(body);
+ newBody->stmts.add(stmt);
body = newBody;
}
@@ -3668,8 +3668,8 @@ namespace Slang
RefPtr<InfixExpr> expr = new InfixExpr();
expr->loc = op->loc;
expr->FunctionExpr = op;
- expr->Arguments.Add(left);
- expr->Arguments.Add(right);
+ expr->Arguments.add(left);
+ expr->Arguments.add(right);
return expr;
}
@@ -3696,11 +3696,11 @@ namespace Slang
select->loc = op->loc;
select->FunctionExpr = op;
- select->Arguments.Add(expr);
+ select->Arguments.add(expr);
- select->Arguments.Add(parser->ParseExpression(opPrec));
+ select->Arguments.add(parser->ParseExpression(opPrec));
parser->ReadToken(TokenType::Colon);
- select->Arguments.Add(parser->ParseExpression(opPrec));
+ select->Arguments.add(parser->ParseExpression(opPrec));
expr = select;
continue;
@@ -3855,7 +3855,7 @@ namespace Slang
//
// Proper disambiguation requires mixing up parsing
// and semantic checking (which we should do eventually)
- // but for now we will follow some hueristics.
+ // but for now we will follow some heuristics.
case TokenType::LParent:
{
Token openParen = parser->ReadToken(TokenType::LParent);
@@ -3868,7 +3868,7 @@ namespace Slang
parser->ReadToken(TokenType::RParent);
auto arg = parsePrefixExpr(parser);
- tcexpr->Arguments.Add(arg);
+ tcexpr->Arguments.add(arg);
return tcexpr;
}
@@ -3903,7 +3903,7 @@ namespace Slang
auto expr = parser->ParseArgExpr();
if( expr )
{
- initExpr->args.Add(expr);
+ initExpr->args.add(expr);
}
if(AdvanceIfMatch(parser, TokenType::RBrace))
@@ -4150,7 +4150,7 @@ namespace Slang
RefPtr<OperatorExpr> postfixExpr = new PostfixExpr();
parser->FillPosition(postfixExpr.Ptr());
postfixExpr->FunctionExpr = parseOperator(parser);
- postfixExpr->Arguments.Add(expr);
+ postfixExpr->Arguments.add(expr);
expr = postfixExpr;
}
@@ -4184,7 +4184,7 @@ namespace Slang
while (!parser->tokenReader.IsAtEnd())
{
if (!parser->LookAheadToken(TokenType::RParent))
- invokeExpr->Arguments.Add(parser->ParseArgExpr());
+ invokeExpr->Arguments.add(parser->ParseArgExpr());
else
{
break;
@@ -4259,7 +4259,7 @@ namespace Slang
RefPtr<PrefixExpr> prefixExpr = new PrefixExpr();
parser->FillPosition(prefixExpr.Ptr());
prefixExpr->FunctionExpr = parseOperator(parser);
- prefixExpr->Arguments.Add(parsePrefixExpr(parser));
+ prefixExpr->Arguments.add(parsePrefixExpr(parser));
return prefixExpr;
}
break;
@@ -4566,7 +4566,7 @@ namespace Slang
while( AdvanceIf(parser, TokenType::Comma) )
{
auto operand = uint32_t(StringToInt(parser->ReadToken(TokenType::IntegerLiteral).Content));
- modifier->irOperands.Add(operand);
+ modifier->irOperands.add(operand);
}
parser->ReadToken(TokenType::RParent);
diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp
index 103db7dcb..bf6f7b7ca 100644
--- a/source/slang/preprocessor.cpp
+++ b/source/slang/preprocessor.cpp
@@ -564,7 +564,7 @@ static void AddEndOfStreamToken(
{
Token token = PeekRawToken(preprocessor);
token.type = TokenType::EndOfFile;
- macro->tokens.mTokens.Add(token);
+ macro->tokens.mTokens.add(token);
}
static SimpleTokenInputStream* createSimpleInputStream(
@@ -574,13 +574,13 @@ static SimpleTokenInputStream* createSimpleInputStream(
SimpleTokenInputStream* inputStream = new SimpleTokenInputStream();
initializeInputStream(preprocessor, inputStream);
- inputStream->lexedTokens.mTokens.Add(token);
+ inputStream->lexedTokens.mTokens.add(token);
Token eofToken;
eofToken.type = TokenType::EndOfFile;
eofToken.loc = token.loc;
eofToken.flags = TokenFlag::AfterWhitespace | TokenFlag::AtStartOfLine;
- inputStream->lexedTokens.mTokens.Add(eofToken);
+ inputStream->lexedTokens.mTokens.add(eofToken);
inputStream->tokenReader = TokenReader(inputStream->lexedTokens);
@@ -659,7 +659,7 @@ static void MaybeBeginMacroExpansion(
expansion->environment = &expansion->argumentEnvironment;
// Try to read any arguments present.
- UInt paramCount = macro->params.Count();
+ UInt paramCount = macro->params.getCount();
UInt argIndex = 0;
switch (PeekRawTokenType(preprocessor))
@@ -740,7 +740,7 @@ static void MaybeBeginMacroExpansion(
}
// Add the token and continue parsing.
- arg->tokens.mTokens.Add(AdvanceRawToken(preprocessor));
+ arg->tokens.mTokens.add(AdvanceRawToken(preprocessor));
}
doneWithArgument: {}
// We've parsed an argument and should move onto
@@ -1586,7 +1586,7 @@ static SlangResult readFile(
//
auto linkage = context->preprocessor->linkage;
auto fileSystemExt = linkage->getFileSystemExt();
- SLANG_RETURN_ON_FAIL(fileSystemExt->loadFile(path.Buffer(), outBlob));
+ SLANG_RETURN_ON_FAIL(fileSystemExt->loadFile(path.getBuffer(), outBlob));
// If we are running the preprocessor as part of compiling a
// specific module, then we must keep track of the file we've
@@ -1732,7 +1732,7 @@ static void HandleDefineDirective(PreprocessorDirectiveContext* context)
// are not allowed to be used as macros or parameters).
// Add the parameter to the macro being deifned
- macro->params.Add(paramToken);
+ macro->params.add(paramToken);
// If we see `)` then we are done with arguments
if (PeekRawTokenType(context) == TokenType::RParent)
@@ -1755,12 +1755,12 @@ static void HandleDefineDirective(PreprocessorDirectiveContext* context)
// Last token on line will be turned into a conceptual end-of-file
// token for the sub-stream that the macro expands into.
token.type = TokenType::EndOfFile;
- macro->tokens.mTokens.Add(token);
+ macro->tokens.mTokens.add(token);
break;
}
// In the ordinary case, we just add the token to the definition
- macro->tokens.mTokens.Add(token);
+ macro->tokens.mTokens.add(token);
}
}
@@ -1939,7 +1939,7 @@ static const PragmaDirective kUnknownPragmaDirective = {
// Look up the `#pragma` directive with the given name.
static PragmaDirective const* findPragmaDirective(String const& name)
{
- char const* nameStr = name.Buffer();
+ char const* nameStr = name.getBuffer();
for (int ii = 0; kPragmaDirectives[ii].name; ++ii)
{
if (strcmp(kPragmaDirectives[ii].name, nameStr) != 0)
@@ -2037,7 +2037,7 @@ static const PreprocessorDirective kInvalidDirective = {
// Look up the directive with the given name.
static PreprocessorDirective const* FindDirective(String const& name)
{
- char const* nameStr = name.Buffer();
+ char const* nameStr = name.getBuffer();
for (int ii = 0; kDirectives[ii].name; ++ii)
{
if (strcmp(kDirectives[ii].name, nameStr) != 0)
@@ -2236,7 +2236,7 @@ static TokenList ReadAllTokens(
{
Token token = ReadToken(preprocessor);
- tokens.mTokens.Add(token);
+ tokens.mTokens.add(token);
// Note: we include the EOF token in the list,
// since that is expected by the `TokenList` type.
diff --git a/source/slang/reflection.cpp b/source/slang/reflection.cpp
index 9c33ca9d3..326a27854 100644
--- a/source/slang/reflection.cpp
+++ b/source/slang/reflection.cpp
@@ -137,13 +137,13 @@ SLANG_API char const* spReflectionUserAttribute_GetName(SlangReflectionUserAttri
{
auto userAttr = convert(attrib);
if (!userAttr) return nullptr;
- return userAttr->getName()->text.Buffer();
+ return userAttr->getName()->text.getBuffer();
}
SLANG_API unsigned int spReflectionUserAttribute_GetArgumentCount(SlangReflectionUserAttribute* attrib)
{
auto userAttr = convert(attrib);
if (!userAttr) return 0;
- return (unsigned int)userAttr->args.Count();
+ return (unsigned int)userAttr->args.getCount();
}
SlangReflectionType* spReflectionUserAttribute_GetArgumentType(SlangReflectionUserAttribute* attrib, unsigned int index)
{
@@ -155,7 +155,7 @@ SLANG_API SlangResult spReflectionUserAttribute_GetArgumentValueInt(SlangReflect
{
auto userAttr = convert(attrib);
if (!userAttr) return SLANG_ERROR_INVALID_PARAMETER;
- if (index >= userAttr->args.Count()) return SLANG_ERROR_INVALID_PARAMETER;
+ if (index >= (unsigned int)userAttr->args.getCount()) return SLANG_ERROR_INVALID_PARAMETER;
RefPtr<RefObject> val;
if (userAttr->intArgVals.TryGetValue(index, val))
{
@@ -168,7 +168,7 @@ SLANG_API SlangResult spReflectionUserAttribute_GetArgumentValueFloat(SlangRefle
{
auto userAttr = convert(attrib);
if (!userAttr) return SLANG_ERROR_INVALID_PARAMETER;
- if (index >= userAttr->args.Count()) return SLANG_ERROR_INVALID_PARAMETER;
+ if (index >= (unsigned int)userAttr->args.getCount()) return SLANG_ERROR_INVALID_PARAMETER;
if (auto cexpr = as<FloatingPointLiteralExpr>(userAttr->args[index]))
{
*rs = (float)cexpr->value;
@@ -180,7 +180,7 @@ SLANG_API const char* spReflectionUserAttribute_GetArgumentValueString(SlangRefl
{
auto userAttr = convert(attrib);
if (!userAttr) return nullptr;
- if (index >= userAttr->args.Count()) return nullptr;
+ if (index >= (unsigned int)userAttr->args.getCount()) return nullptr;
if (auto cexpr = as<StringLiteralExpr>(userAttr->args[index]))
{
if (bufLen)
@@ -772,7 +772,7 @@ static SlangParameterCategory getParameterCategory(
static SlangParameterCategory getParameterCategory(
TypeLayout* typeLayout)
{
- auto resourceInfoCount = typeLayout->resourceInfos.Count();
+ auto resourceInfoCount = typeLayout->resourceInfos.getCount();
if(resourceInfoCount == 1)
{
return getParameterCategory(typeLayout->resourceInfos[0].kind);
@@ -790,7 +790,7 @@ static TypeLayout* maybeGetContainerLayout(TypeLayout* typeLayout)
if (auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout))
{
auto containerTypeLayout = parameterGroupTypeLayout->containerVarLayout->typeLayout;
- if (containerTypeLayout->resourceInfos.Count() != 0)
+ if (containerTypeLayout->resourceInfos.getCount() != 0)
{
return containerTypeLayout;
}
@@ -816,7 +816,7 @@ SLANG_API unsigned spReflectionTypeLayout_GetCategoryCount(SlangReflectionTypeLa
typeLayout = maybeGetContainerLayout(typeLayout);
- return (unsigned) typeLayout->resourceInfos.Count();
+ return (unsigned) typeLayout->resourceInfos.getCount();
}
SLANG_API SlangParameterCategory spReflectionTypeLayout_GetCategoryByIndex(SlangReflectionTypeLayout* inTypeLayout, unsigned index)
@@ -871,9 +871,9 @@ SLANG_API char const* spReflectionVariable_GetName(SlangReflectionVariable* inVa
// If the variable is one that has an "external" name that is supposed
// to be exposed for reflection, then report it here
if(auto reflectionNameMod = var->FindModifier<ParameterGroupReflectionName>())
- return getText(reflectionNameMod->nameAndLoc.name).Buffer();
+ return getText(reflectionNameMod->nameAndLoc.name).getBuffer();
- return getText(var->getName()).Buffer();
+ return getText(var->getName()).getBuffer();
}
SLANG_API SlangReflectionType* spReflectionVariable_GetType(SlangReflectionVariable* inVar)
@@ -1046,7 +1046,7 @@ SLANG_API char const* spReflectionVariableLayout_GetSemanticName(SlangReflection
if (!(varLayout->flags & Slang::VarLayoutFlag::HasSemantic))
return 0;
- return varLayout->semanticName.Buffer();
+ return varLayout->semanticName.getBuffer();
}
SLANG_API size_t spReflectionVariableLayout_GetSemanticIndex(SlangReflectionVariableLayout* inVarLayout)
@@ -1124,7 +1124,7 @@ namespace Slang
if(auto structLayout = as<StructTypeLayout>(typeLayout))
{
- return (unsigned) structLayout->fields.Count();
+ return (unsigned) structLayout->fields.getCount();
}
return 0;
@@ -1259,7 +1259,7 @@ SLANG_API int spReflectionEntryPoint_usesAnySampleRateInput(
SLANG_API char const* spReflectionTypeParameter_GetName(SlangReflectionTypeParameter * inTypeParam)
{
auto typeParam = convert(inTypeParam);
- return typeParam->decl->getName()->text.Buffer();
+ return typeParam->decl->getName()->text.getBuffer();
}
SLANG_API unsigned spReflectionTypeParameter_GetIndex(SlangReflectionTypeParameter * inTypeParam)
@@ -1272,14 +1272,14 @@ SLANG_API unsigned int spReflectionTypeParameter_GetConstraintCount(SlangReflect
{
auto typeParam = convert(inTypeParam);
auto constraints = typeParam->decl->getMembersOfType<GenericTypeConstraintDecl>();
- return (unsigned int)constraints.Count();
+ return (unsigned int)constraints.getCount();
}
SLANG_API SlangReflectionType* spReflectionTypeParameter_GetConstraintByIndex(SlangReflectionTypeParameter * inTypeParam, unsigned index)
{
auto typeParam = convert(inTypeParam);
auto constraints = typeParam->decl->getMembersOfType<GenericTypeConstraintDecl>();
- return (SlangReflectionType*)constraints.ToArray()[index]->sup.Ptr();
+ return (SlangReflectionType*)constraints.toArray()[index]->sup.Ptr();
}
// Shader Reflection
@@ -1293,7 +1293,7 @@ SLANG_API unsigned spReflection_GetParameterCount(SlangReflection* inProgram)
if (!globalStructLayout)
return 0;
- return (unsigned) globalStructLayout->fields.Count();
+ return (unsigned) globalStructLayout->fields.getCount();
}
SLANG_API SlangReflectionParameter* spReflection_GetParameterByIndex(SlangReflection* inProgram, unsigned index)
@@ -1311,7 +1311,7 @@ SLANG_API SlangReflectionParameter* spReflection_GetParameterByIndex(SlangReflec
SLANG_API unsigned int spReflection_GetTypeParameterCount(SlangReflection * reflection)
{
auto program = convert(reflection);
- return (unsigned int)program->globalGenericParams.Count();
+ return (unsigned int)program->globalGenericParams.getCount();
}
SLANG_API SlangReflectionTypeParameter* spReflection_GetTypeParameterByIndex(SlangReflection * reflection, unsigned int index)
@@ -1334,7 +1334,7 @@ SLANG_API SlangUInt spReflection_getEntryPointCount(SlangReflection* inProgram)
auto program = convert(inProgram);
if(!program) return 0;
- return SlangUInt(program->entryPoints.Count());
+ return SlangUInt(program->entryPoints.getCount());
}
SLANG_API SlangReflectionEntryPoint* spReflection_getEntryPointByIndex(SlangReflection* inProgram, SlangUInt index)
diff --git a/source/slang/slang-file-system.cpp b/source/slang/slang-file-system.cpp
index 58cda679d..9cd2ee035 100644
--- a/source/slang/slang-file-system.cpp
+++ b/source/slang/slang-file-system.cpp
@@ -235,7 +235,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out
{
// Try getting the uniqueIdentity by asking underlying file system
ComPtr<ISlangBlob> uniqueIdentity;
- SLANG_RETURN_ON_FAIL(m_fileSystemExt->getFileUniqueIdentity(path.Buffer(), uniqueIdentity.writeRef()));
+ SLANG_RETURN_ON_FAIL(m_fileSystemExt->getFileUniqueIdentity(path.getBuffer(), uniqueIdentity.writeRef()));
// Get the path as a string
outUniqueIdentity = StringUtil::getString(uniqueIdentity);
return SLANG_OK;
@@ -255,7 +255,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out
case UniqueIdentityMode::Hash:
{
// I can only see if this is the same file as already loaded by loading the file and doing a hash
- Result res = m_fileSystem->loadFile(path.Buffer(), outFileContents.writeRef());
+ Result res = m_fileSystem->loadFile(path.getBuffer(), outFileContents.writeRef());
if (SLANG_FAILED(res) || outFileContents == nullptr)
{
return SLANG_FAIL;
@@ -265,7 +265,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out
const uint64_t hash = GetHashCode64((const char*)outFileContents->getBufferPointer(), outFileContents->getBufferSize());
String hashString = Path::getFileName(path);
- hashString = hashString.ToLower();
+ hashString = hashString.toLower();
hashString.append(':');
@@ -362,7 +362,7 @@ SlangResult CacheFileSystem::loadFile(char const* pathIn, ISlangBlob** blobOut)
if (info->m_loadFileResult == CompressedResult::Uninitialized)
{
- info->m_loadFileResult = toCompressedResult(m_fileSystem->loadFile(path.Buffer(), info->m_fileBlob.writeRef()));
+ info->m_loadFileResult = toCompressedResult(m_fileSystem->loadFile(path.getBuffer(), info->m_fileBlob.writeRef()));
}
*blobOut = info->m_fileBlob;
@@ -419,7 +419,7 @@ SlangResult CacheFileSystem::getPathType(const char* pathIn, SlangPathType* path
// Okay try to load the file
if (info->m_loadFileResult == CompressedResult::Uninitialized)
{
- info->m_loadFileResult = toCompressedResult(m_fileSystem->loadFile(path.Buffer(), info->m_fileBlob.writeRef()));
+ info->m_loadFileResult = toCompressedResult(m_fileSystem->loadFile(path.getBuffer(), info->m_fileBlob.writeRef()));
}
// Make the getPathResult the same as the load result
@@ -482,7 +482,7 @@ SlangResult CacheFileSystem::getCanonicalPath(const char* path, ISlangBlob** out
{
// Get the path as a string
String canonicalPath = StringUtil::getString(canonicalPathBlob);
- if (canonicalPath.Length() > 0)
+ if (canonicalPath.getLength() > 0)
{
info->m_canonicalPath = new StringBlob(canonicalPath);
}
diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp
index 183bed9ba..d2d29beae 100644
--- a/source/slang/slang-stdlib.cpp
+++ b/source/slang/slang-stdlib.cpp
@@ -12,7 +12,7 @@ namespace Slang
{
String Session::getStdlibPath()
{
- if(stdlibPath.Length() != 0)
+ if(stdlibPath.getLength() != 0)
return stdlibPath;
StringBuilder pathBuilder;
@@ -244,7 +244,7 @@ namespace Slang
String Session::getCoreLibraryCode()
{
- if (coreLibraryCode.Length() > 0)
+ if (coreLibraryCode.getLength() > 0)
return coreLibraryCode;
StringBuilder sb;
@@ -264,7 +264,7 @@ namespace Slang
String Session::getHLSLLibraryCode()
{
- if (hlslLibraryCode.Length() > 0)
+ if (hlslLibraryCode.getLength() > 0)
return hlslLibraryCode;
StringBuilder sb;
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index affce384b..7556ac9b2 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -75,7 +75,7 @@ Session::Session()
auto baseModuleDecl = populateBaseLanguageModule(
this,
baseLanguageScope);
- loadedModuleCode.Add(baseModuleDecl);
+ loadedModuleCode.add(baseModuleDecl);
coreLanguageScope = new Scope();
coreLanguageScope->nextSibling = baseLanguageScope;
@@ -108,7 +108,7 @@ struct IncludeHandlerImpl : IncludeHandler
ComPtr<ISlangBlob> combinedPathBlob;
SLANG_RETURN_ON_FAIL(fileSystemExt->calcCombinedPath(fromPathType, fromPath.begin(), path.begin(), combinedPathBlob.writeRef()));
String combinedPath(StringUtil::getString(combinedPathBlob));
- if (combinedPath.Length() <= 0)
+ if (combinedPath.getLength() <= 0)
{
return SLANG_FAIL;
}
@@ -126,7 +126,7 @@ struct IncludeHandlerImpl : IncludeHandler
// If the rel path exists -> a uniqueIdentity MUST exists too
String uniqueIdentity(StringUtil::getString(uniqueIdentityBlob));
- if (uniqueIdentity.Length() <= 0)
+ if (uniqueIdentity.getLength() <= 0)
{
// Unique identity can't be empty
return SLANG_FAIL;
@@ -188,7 +188,7 @@ struct IncludeHandlerImpl : IncludeHandler
{
ISlangFileSystemExt* fileSystemExt = _getFileSystemExt();
ComPtr<ISlangBlob> simplifiedPath;
- if (SLANG_FAILED(fileSystemExt->getSimplifiedPath(path.Buffer(), simplifiedPath.writeRef())))
+ if (SLANG_FAILED(fileSystemExt->getSimplifiedPath(path.getBuffer(), simplifiedPath.writeRef())))
{
return path;
}
@@ -422,7 +422,7 @@ SourceManager* TranslationUnitRequest::getSourceManager()
void TranslationUnitRequest::addSourceFile(SourceFile* sourceFile)
{
- m_sourceFiles.Add(sourceFile);
+ m_sourceFiles.add(sourceFile);
// We want to record that the compiled module has a dependency
// on the path of the source file, but we also need to account
@@ -472,7 +472,7 @@ void EndToEndCompileRequest::setWriter(WriterChannel chan, ISlangWriter* writer)
SlangResult Linkage::loadFile(String const& path, ISlangBlob** outBlob)
{
- return fileSystemExt->loadFile(path.Buffer(), outBlob);
+ return fileSystemExt->loadFile(path.getBuffer(), outBlob);
}
RefPtr<Expr> Linkage::parseTypeString(String typeStr, RefPtr<Scope> scope)
@@ -549,7 +549,7 @@ Type* Program::getTypeFromString(String typeStr, DiagnosticSink* sink)
//
List<RefPtr<Scope>> scopesToTry;
for(auto module : getModuleDependencies())
- scopesToTry.Add(module->getModuleDecl()->scope);
+ scopesToTry.add(module->getModuleDecl()->scope);
auto linkage = getLinkage();
for(auto& s : scopesToTry)
@@ -839,7 +839,7 @@ SlangResult EndToEndCompileRequest::executeActionsInner()
// TODO: This logic should be moved into `options.cpp` or somewhere else
// specific to the command-line tool.
//
- if (getLinkage()->targets.Count() == 0)
+ if (getLinkage()->targets.getCount() == 0)
{
auto language = inferSourceLanguage(getFrontEndReq());
switch (language)
@@ -938,7 +938,7 @@ SlangResult EndToEndCompileRequest::executeActions()
int FrontEndCompileRequest::addTranslationUnit(SourceLanguage language, Name* moduleName)
{
- UInt result = translationUnits.Count();
+ Index result = translationUnits.getCount();
RefPtr<TranslationUnitRequest> translationUnit = new TranslationUnitRequest(this);
translationUnit->compileRequest = this;
@@ -946,7 +946,7 @@ int FrontEndCompileRequest::addTranslationUnit(SourceLanguage language, Name* mo
translationUnit->moduleName = moduleName;
- translationUnits.Add(translationUnit);
+ translationUnits.add(translationUnit);
return (int) result;
}
@@ -959,7 +959,7 @@ int FrontEndCompileRequest::addTranslationUnit(SourceLanguage language)
// even when they are being compiled together.
//
String generatedName = "tu";
- generatedName.append(translationUnits.Count());
+ generatedName.append(translationUnits.getCount());
return addTranslationUnit(language, getNamePool()->getName(generatedName));
}
@@ -1029,7 +1029,7 @@ int FrontEndCompileRequest::addEntryPoint(
{
auto translationUnitReq = translationUnits[translationUnitIndex];
- UInt result = m_entryPointReqs.Count();
+ Index result = m_entryPointReqs.getCount();
RefPtr<FrontEndEntryPointRequest> entryPointReq = new FrontEndEntryPointRequest(
this,
@@ -1037,7 +1037,7 @@ int FrontEndCompileRequest::addEntryPoint(
getNamePool()->getName(name),
entryPointProfile);
- m_entryPointReqs.Add(entryPointReq);
+ m_entryPointReqs.add(entryPointReq);
// translationUnitReq->entryPoints.Add(entryPointReq);
return int(result);
@@ -1053,10 +1053,10 @@ int EndToEndCompileRequest::addEntryPoint(
EntryPointInfo entryPointInfo;
for (auto typeName : genericTypeNames)
- entryPointInfo.genericArgStrings.Add(typeName);
+ entryPointInfo.genericArgStrings.add(typeName);
- UInt result = entryPoints.Count();
- entryPoints.Add(_Move(entryPointInfo));
+ Index result = entryPoints.getCount();
+ entryPoints.add(_Move(entryPointInfo));
return (int) result;
}
@@ -1067,8 +1067,8 @@ UInt Linkage::addTarget(
targetReq->linkage = this;
targetReq->target = target;
- UInt result = targets.Count();
- targets.Add(targetReq);
+ Index result = targets.getCount();
+ targets.add(targetReq);
return (int) result;
}
@@ -1085,7 +1085,7 @@ void Linkage::loadParsedModule(
// Get a path
String mostUniqueIdentity = pathInfo.getMostUniqueIdentity();
- SLANG_ASSERT(mostUniqueIdentity.Length() > 0);
+ SLANG_ASSERT(mostUniqueIdentity.getLength() > 0);
mapPathToLoadedModule.Add(mostUniqueIdentity, loadedModule);
mapNameToLoadedModules.Add(name, loadedModule);
@@ -1107,7 +1107,7 @@ void Linkage::loadParsedModule(
SLANG_ASSERT(errorCountAfter == 0);
loadedModule->setIRModule(generateIRForTranslationUnit(translationUnit));
}
- loadedModulesList.Add(loadedModule);
+ loadedModulesList.add(loadedModule);
}
Module* Linkage::loadModule(String const& name)
@@ -1263,7 +1263,7 @@ RefPtr<Module> Linkage::findOrImportModule(
// Try to load it
ComPtr<ISlangBlob> fileContents;
- if(SLANG_FAILED(getFileSystemExt()->loadFile(filePathInfo.foundPath.Buffer(), fileContents.writeRef())))
+ if(SLANG_FAILED(getFileSystemExt()->loadFile(filePathInfo.foundPath.getBuffer(), fileContents.writeRef())))
{
sink->diagnose(loc, Diagnostics::cannotOpenFile, fileName);
mapNameToLoadedModules[name] = nullptr;
@@ -1314,7 +1314,7 @@ void ModuleDependencyList::_addDependency(Module* module)
if(m_moduleSet.Contains(module))
return;
- m_moduleList.Add(module);
+ m_moduleList.add(module);
m_moduleSet.Add(module);
}
@@ -1327,7 +1327,7 @@ void FilePathDependencyList::addDependency(String const& path)
if(m_filePathSet.Contains(path))
return;
- m_filePathList.Add(path);
+ m_filePathList.add(path);
m_filePathSet.Add(path);
}
@@ -1381,7 +1381,7 @@ void Program::addReferencedLeafModule(Module* module)
void Program::addEntryPoint(EntryPoint* entryPoint)
{
- m_entryPoints.Add(entryPoint);
+ m_entryPoints.add(entryPoint);
for(auto module : entryPoint->getModuleDependencies())
{
@@ -1423,7 +1423,7 @@ TargetProgram::TargetProgram(
: m_program(program)
, m_targetReq(targetReq)
{
- m_entryPointResults.SetSize(program->getEntryPoints().Count());
+ m_entryPointResults.setCount(program->getEntryPoints().getCount());
}
//
@@ -1516,7 +1516,7 @@ void Session::addBuiltinSource(
SlangResult res = compileRequest->executeActionsInner();
if (SLANG_FAILED(res))
{
- char const* diagnostics = sink.outputBuffer.Buffer();
+ char const* diagnostics = sink.outputBuffer.getBuffer();
fprintf(stderr, "%s", diagnostics);
#ifdef _WIN32
@@ -1556,7 +1556,7 @@ void Session::addBuiltinSource(
// We need to retain this AST so that we can use it in other code
// (Note that the `Scope` type does not retain the AST it points to)
- loadedModuleCode.Add(syntax);
+ loadedModuleCode.add(syntax);
}
Session::~Session()
@@ -1770,7 +1770,7 @@ SLANG_API void spSetCodeGenTarget(
{
auto req = convert(request);
auto linkage = req->getLinkage();
- linkage->targets.Clear();
+ linkage->targets.clear();
linkage->addTarget(Slang::CodeGenTarget(target));
}
@@ -1912,7 +1912,7 @@ SLANG_API void spAddSearchPath(
{
auto req = convert(request);
auto linkage = req->getLinkage();
- linkage->searchDirectories.searchDirectories.Add(Slang::SearchDirectory(path));
+ linkage->searchDirectories.searchDirectories.add(Slang::SearchDirectory(path));
}
SLANG_API void spAddPreprocessorDefine(
@@ -1990,7 +1990,7 @@ SLANG_API void spAddTranslationUnitSourceFile(
auto frontEndReq = req->getFrontEndReq();
if(!path) return;
if(translationUnitIndex < 0) return;
- if(Slang::UInt(translationUnitIndex) >= frontEndReq->translationUnits.Count()) return;
+ if(Slang::Index(translationUnitIndex) >= frontEndReq->translationUnits.getCount()) return;
frontEndReq->addTranslationUnitSourceFile(
translationUnitIndex,
@@ -2019,19 +2019,20 @@ SLANG_API void spAddTranslationUnitSourceStringSpan(
char const* sourceBegin,
char const* sourceEnd)
{
+ using namespace Slang;
if(!request) return;
auto req = convert(request);
auto frontEndReq = req->getFrontEndReq();
if(!sourceBegin) return;
if(translationUnitIndex < 0) return;
- if(Slang::UInt(translationUnitIndex) >= frontEndReq->translationUnits.Count()) return;
+ if(Index(translationUnitIndex) >= frontEndReq->translationUnits.getCount()) return;
if(!path) path = "";
frontEndReq->addTranslationUnitSourceString(
translationUnitIndex,
path,
- Slang::UnownedStringSlice(sourceBegin, sourceEnd));
+ UnownedStringSlice(sourceBegin, sourceEnd));
}
SLANG_API void spAddTranslationUnitSourceBlob(
@@ -2045,7 +2046,7 @@ SLANG_API void spAddTranslationUnitSourceBlob(
auto frontEndReq = req->getFrontEndReq();
if(!sourceBlob) return;
if(translationUnitIndex < 0) return;
- if(Slang::UInt(translationUnitIndex) >= frontEndReq->translationUnits.Count()) return;
+ if(Slang::Index(translationUnitIndex) >= frontEndReq->translationUnits.getCount()) return;
if(!path) path = "";
@@ -2090,19 +2091,20 @@ SLANG_API int spAddEntryPointEx(
int genericParamTypeNameCount,
char const ** genericParamTypeNames)
{
+ using namespace Slang;
if (!request) return -1;
auto req = convert(request);
auto frontEndReq = req->getFrontEndReq();
if (!name) return -1;
if (translationUnitIndex < 0) return -1;
- if (Slang::UInt(translationUnitIndex) >= frontEndReq->translationUnits.Count()) return -1;
- Slang::List<Slang::String> typeNames;
+ if (Index(translationUnitIndex) >= frontEndReq->translationUnits.getCount()) return -1;
+ List<String> typeNames;
for (int i = 0; i < genericParamTypeNameCount; i++)
- typeNames.Add(genericParamTypeNames[i]);
+ typeNames.add(genericParamTypeNames[i]);
return req->addEntryPoint(
translationUnitIndex,
name,
- Slang::Profile(Slang::Stage(stage)),
+ Profile(Stage(stage)),
typeNames);
}
@@ -2115,9 +2117,9 @@ SLANG_API SlangResult spSetGlobalGenericArgs(
auto req = convert(request);
auto& genericArgStrings = req->globalGenericArgStrings;
- genericArgStrings.Clear();
+ genericArgStrings.clear();
for (int i = 0; i < genericArgCount; i++)
- genericArgStrings.Add(genericArgs[i]);
+ genericArgStrings.add(genericArgs[i]);
return SLANG_OK;
}
@@ -2127,15 +2129,16 @@ SLANG_API SlangResult spSetTypeNameForGlobalExistentialTypeParam(
int slotIndex,
char const* typeName)
{
+ using namespace Slang;
if(!request) return SLANG_FAIL;
if(slotIndex < 0) return SLANG_FAIL;
if(!typeName) return SLANG_FAIL;
auto req = convert(request);
auto& typeArgStrings = req->globalExistentialSlotArgStrings;
- if(Slang::UInt(slotIndex) >= typeArgStrings.Count())
- typeArgStrings.SetSize(slotIndex+1);
- typeArgStrings[slotIndex] = Slang::String(typeName);
+ if(Index(slotIndex) >= typeArgStrings.getCount())
+ typeArgStrings.setCount(slotIndex+1);
+ typeArgStrings[slotIndex] = String(typeName);
return SLANG_OK;
}
@@ -2145,20 +2148,21 @@ SLANG_API SlangResult spSetTypeNameForEntryPointExistentialTypeParam(
int slotIndex,
char const* typeName)
{
+ using namespace Slang;
if(!request) return SLANG_FAIL;
if(entryPointIndex < 0) return SLANG_FAIL;
if(slotIndex < 0) return SLANG_FAIL;
if(!typeName) return SLANG_FAIL;
auto req = convert(request);
- if(Slang::UInt(entryPointIndex) >= req->entryPoints.Count())
+ if(Index(entryPointIndex) >= req->entryPoints.getCount())
return SLANG_FAIL;
auto& entryPointInfo = req->entryPoints[entryPointIndex];
auto& typeArgStrings = entryPointInfo.existentialArgStrings;
- if(Slang::UInt(slotIndex) >= typeArgStrings.Count())
- typeArgStrings.SetSize(slotIndex+1);
- typeArgStrings[slotIndex] = Slang::String(typeName);
+ if(Index(slotIndex) >= typeArgStrings.getCount())
+ typeArgStrings.setCount(slotIndex+1);
+ typeArgStrings[slotIndex] = String(typeName);
return SLANG_OK;
}
@@ -2224,7 +2228,7 @@ spGetDependencyFileCount(
auto req = convert(request);
auto frontEndReq = req->getFrontEndReq();
auto program = frontEndReq->getProgram();
- return (int) program->getFilePathDependencies().Count();
+ return (int) program->getFilePathDependencies().getCount();
}
/** Get the path to a file this compilation dependend on.
@@ -2247,7 +2251,7 @@ spGetTranslationUnitCount(
{
auto req = convert(request);
auto frontEndReq = req->getFrontEndReq();
- return (int) frontEndReq->translationUnits.Count();
+ return (int) frontEndReq->translationUnits.getCount();
}
// Get the output code associated with a specific translation unit
@@ -2264,44 +2268,45 @@ SLANG_API void const* spGetEntryPointCode(
int entryPointIndex,
size_t* outSize)
{
+ using namespace Slang;
auto req = convert(request);
auto linkage = req->getLinkage();
auto program = req->getSpecializedProgram();
// TODO: We should really accept a target index in this API
- Slang::UInt targetIndex = 0;
- auto targetCount = linkage->targets.Count();
+ Index targetIndex = 0;
+ auto targetCount = linkage->targets.getCount();
if (targetIndex >= targetCount)
return nullptr;
auto targetReq = linkage->targets[targetIndex];
if(entryPointIndex < 0) return nullptr;
- if(Slang::UInt(entryPointIndex) >= req->entryPoints.Count()) return nullptr;
+ if(Index(entryPointIndex) >= req->entryPoints.getCount()) return nullptr;
auto entryPoint = program->getEntryPoint(entryPointIndex);
auto targetProgram = program->getTargetProgram(targetReq);
if(!targetProgram)
return nullptr;
- Slang::CompileResult& result = targetProgram->getExistingEntryPointResult(entryPointIndex);
+ CompileResult& result = targetProgram->getExistingEntryPointResult(entryPointIndex);
void const* data = nullptr;
size_t size = 0;
switch (result.format)
{
- case Slang::ResultFormat::None:
+ case ResultFormat::None:
default:
break;
- case Slang::ResultFormat::Binary:
- data = result.outputBinary.Buffer();
- size = result.outputBinary.Count();
+ case ResultFormat::Binary:
+ data = result.outputBinary.getBuffer();
+ size = result.outputBinary.getCount();
break;
- case Slang::ResultFormat::Text:
- data = result.outputString.Buffer();
- size = result.outputString.Length();
+ case ResultFormat::Text:
+ data = result.outputString.getBuffer();
+ size = result.outputString.getLength();
break;
}
@@ -2315,6 +2320,7 @@ SLANG_API SlangResult spGetEntryPointCodeBlob(
int targetIndex,
ISlangBlob** outBlob)
{
+ using namespace Slang;
if(!request) return SLANG_ERROR_INVALID_PARAMETER;
if(!outBlob) return SLANG_ERROR_INVALID_PARAMETER;
@@ -2322,14 +2328,14 @@ SLANG_API SlangResult spGetEntryPointCodeBlob(
auto linkage = req->getLinkage();
auto program = req->getSpecializedProgram();
- int targetCount = (int) linkage->targets.Count();
+ Index targetCount = linkage->targets.getCount();
if((targetIndex < 0) || (targetIndex >= targetCount))
{
return SLANG_ERROR_INVALID_PARAMETER;
}
auto targetReq = linkage->targets[targetIndex];
- int entryPointCount = (int) req->entryPoints.Count();
+ Index entryPointCount = req->entryPoints.getCount();
if((entryPointIndex < 0) || (entryPointIndex >= entryPointCount))
{
return SLANG_ERROR_INVALID_PARAMETER;
@@ -2381,8 +2387,8 @@ SLANG_API SlangReflection* spGetReflection(
// so that we can do this better, and make it clear that
// `spGetReflection()` is shorthand for `targetIndex == 0`.
//
- Slang::UInt targetIndex = 0;
- auto targetCount = linkage->targets.Count();
+ Slang::Index targetIndex = 0;
+ auto targetCount = linkage->targets.getCount();
if (targetIndex >= targetCount)
return nullptr;
diff --git a/source/slang/source-loc.cpp b/source/slang/source-loc.cpp
index 886b4fefb..b67426053 100644
--- a/source/slang/source-loc.cpp
+++ b/source/slang/source-loc.cpp
@@ -34,7 +34,7 @@ int SourceView::findEntryIndex(SourceLoc sourceLoc) const
const auto rawValue = sourceLoc.getRaw();
- int hi = int(m_entries.Count());
+ Index hi = m_entries.getCount();
// If there are no entries, or it is in front of the first entry, then there is no associated entry
if (hi == 0 ||
m_entries[0].m_startLoc.getRaw() > sourceLoc.getRaw())
@@ -42,10 +42,10 @@ int SourceView::findEntryIndex(SourceLoc sourceLoc) const
return -1;
}
- int lo = 0;
+ Index lo = 0;
while (lo + 1 < hi)
{
- const int mid = (hi + lo) >> 1;
+ const Index mid = (hi + lo) >> 1;
const Entry& midEntry = m_entries[mid];
SourceLoc::RawValue midValue = midEntry.m_startLoc.getRaw();
if (midValue <= rawValue)
@@ -60,7 +60,7 @@ int SourceView::findEntryIndex(SourceLoc sourceLoc) const
}
}
- return lo;
+ return int(lo);
}
void SourceView::addLineDirective(SourceLoc directiveLoc, StringSlicePool::Handle pathHandle, int line)
@@ -69,7 +69,7 @@ void SourceView::addLineDirective(SourceLoc directiveLoc, StringSlicePool::Handl
SLANG_ASSERT(m_range.contains(directiveLoc));
// Check that the directiveLoc values are always increasing
- SLANG_ASSERT(m_entries.Count() == 0 || (m_entries.Last().m_startLoc.getRaw() < directiveLoc.getRaw()));
+ SLANG_ASSERT(m_entries.getCount() == 0 || (m_entries.getLast().m_startLoc.getRaw() < directiveLoc.getRaw()));
// Calculate the offset
const int offset = m_range.getOffset(directiveLoc);
@@ -88,7 +88,7 @@ void SourceView::addLineDirective(SourceLoc directiveLoc, StringSlicePool::Handl
// Taking both into account means +2 is correct 'fix'
entry.m_lineAdjust = line - (lineIndex + 2);
- m_entries.Add(entry);
+ m_entries.add(entry);
}
void SourceView::addLineDirective(SourceLoc directiveLoc, const String& path, int line)
@@ -101,10 +101,10 @@ void SourceView::addDefaultLineDirective(SourceLoc directiveLoc)
{
SLANG_ASSERT(m_range.contains(directiveLoc));
// Check that the directiveLoc values are always increasing
- SLANG_ASSERT(m_entries.Count() == 0 || (m_entries.Last().m_startLoc.getRaw() < directiveLoc.getRaw()));
+ SLANG_ASSERT(m_entries.getCount() == 0 || (m_entries.getLast().m_startLoc.getRaw() < directiveLoc.getRaw()));
// Well if there are no entries, or the last one puts it in default case, then we don't need to add anything
- if (m_entries.Count() == 0 || (m_entries.Count() && m_entries.Last().isDefault()))
+ if (m_entries.getCount() == 0 || (m_entries.getCount() && m_entries.getLast().isDefault()))
{
return;
}
@@ -116,7 +116,7 @@ void SourceView::addDefaultLineDirective(SourceLoc directiveLoc)
SLANG_ASSERT(entry.isDefault());
- m_entries.Add(entry);
+ m_entries.add(entry);
}
HumaneSourceLoc SourceView::getHumaneLoc(SourceLoc loc, SourceLocType type)
@@ -160,7 +160,7 @@ HumaneSourceLoc SourceView::getHumaneLoc(SourceLoc loc, SourceLocType type)
PathInfo SourceView::_getPathInfo() const
{
- if (m_viewPath.Length())
+ if (m_viewPath.getLength())
{
PathInfo pathInfo(m_sourceFile->getPathInfo());
pathInfo.foundPath = m_viewPath;
@@ -200,8 +200,8 @@ PathInfo SourceView::getPathInfo(SourceLoc loc, SourceLocType type)
void SourceFile::setLineBreakOffsets(const uint32_t* offsets, UInt numOffsets)
{
- m_lineBreakOffsets.Clear();
- m_lineBreakOffsets.AddRange(offsets, numOffsets);
+ m_lineBreakOffsets.clear();
+ m_lineBreakOffsets.addRange(offsets, numOffsets);
}
const List<uint32_t>& SourceFile::getLineBreakOffsets()
@@ -209,7 +209,7 @@ const List<uint32_t>& SourceFile::getLineBreakOffsets()
// We now have a raw input file that we can search for line breaks.
// We obviously don't want to do a linear scan over and over, so we will
// cache an array of line break locations in the file.
- if (m_lineBreakOffsets.Count() == 0)
+ if (m_lineBreakOffsets.getCount() == 0)
{
UnownedStringSlice content = getContent();
@@ -219,7 +219,7 @@ const List<uint32_t>& SourceFile::getLineBreakOffsets()
char const* cursor = begin;
// Treat the beginning of the file as a line break
- m_lineBreakOffsets.Add(0);
+ m_lineBreakOffsets.add(0);
while (cursor != end)
{
@@ -238,7 +238,7 @@ const List<uint32_t>& SourceFile::getLineBreakOffsets()
if ((c^d) == ('\r' ^ '\n'))
cursor++;
- m_lineBreakOffsets.Add(uint32_t(cursor - begin));
+ m_lineBreakOffsets.add(uint32_t(cursor - begin));
break;
}
default:
@@ -265,12 +265,12 @@ int SourceFile::calcLineIndexFromOffset(int offset)
// At this point we can assume the `lineBreakOffsets` array has been filled in.
// We will use a binary search to find the line index that contains our
// chosen offset.
- int lo = 0;
- int hi = int(lineBreakOffsets.Count());
+ Index lo = 0;
+ Index hi = lineBreakOffsets.getCount();
while (lo + 1 < hi)
{
- const int mid = (hi + lo) >> 1;
+ const Index mid = (hi + lo) >> 1;
const uint32_t midOffset = lineBreakOffsets[mid];
if (midOffset <= uint32_t(offset))
{
@@ -282,7 +282,7 @@ int SourceFile::calcLineIndexFromOffset(int offset)
}
}
- return lo;
+ return int(lo);
}
int SourceFile::calcColumnIndex(int lineIndex, int offset)
@@ -331,11 +331,11 @@ String SourceFile::calcVerbosePath() const
{
String canonicalPath;
ComPtr<ISlangBlob> canonicalPathBlob;
- if (SLANG_SUCCEEDED(fileSystemExt->getCanonicalPath(m_pathInfo.foundPath.Buffer(), canonicalPathBlob.writeRef())))
+ if (SLANG_SUCCEEDED(fileSystemExt->getCanonicalPath(m_pathInfo.foundPath.getBuffer(), canonicalPathBlob.writeRef())))
{
canonicalPath = StringUtil::getString(canonicalPathBlob);
}
- if (canonicalPath.Length() > 0)
+ if (canonicalPath.getLength() > 0)
{
return canonicalPath;
}
@@ -416,14 +416,14 @@ SourceRange SourceManager::allocateSourceRange(UInt size)
SourceFile* SourceManager::createSourceFileWithSize(const PathInfo& pathInfo, size_t contentSize)
{
SourceFile* sourceFile = new SourceFile(this, pathInfo, contentSize);
- m_sourceFiles.Add(sourceFile);
+ m_sourceFiles.add(sourceFile);
return sourceFile;
}
SourceFile* SourceManager::createSourceFileWithString(const PathInfo& pathInfo, const String& contents)
{
- SourceFile* sourceFile = new SourceFile(this, pathInfo, contents.Length());
- m_sourceFiles.Add(sourceFile);
+ SourceFile* sourceFile = new SourceFile(this, pathInfo, contents.getLength());
+ m_sourceFiles.add(sourceFile);
sourceFile->setContents(contents);
return sourceFile;
}
@@ -431,7 +431,7 @@ SourceFile* SourceManager::createSourceFileWithString(const PathInfo& pathInfo,
SourceFile* SourceManager::createSourceFileWithBlob(const PathInfo& pathInfo, ISlangBlob* blob)
{
SourceFile* sourceFile = new SourceFile(this, pathInfo, blob->getBufferSize());
- m_sourceFiles.Add(sourceFile);
+ m_sourceFiles.add(sourceFile);
sourceFile->setContents(blob);
return sourceFile;
}
@@ -442,7 +442,7 @@ SourceView* SourceManager::createSourceView(SourceFile* sourceFile, const PathIn
SourceView* sourceView = nullptr;
if (pathInfo &&
- (pathInfo->foundPath.Length() && sourceFile->getPathInfo().foundPath != pathInfo->foundPath))
+ (pathInfo->foundPath.getLength() && sourceFile->getPathInfo().foundPath != pathInfo->foundPath))
{
sourceView = new SourceView(sourceFile, range, &pathInfo->foundPath);
}
@@ -451,14 +451,14 @@ SourceView* SourceManager::createSourceView(SourceFile* sourceFile, const PathIn
sourceView = new SourceView(sourceFile, range, nullptr);
}
- m_sourceViews.Add(sourceView);
+ m_sourceViews.add(sourceView);
return sourceView;
}
SourceView* SourceManager::findSourceView(SourceLoc loc) const
{
- int hi = int(m_sourceViews.Count());
+ Index hi = m_sourceViews.getCount();
// It must be in the range of this manager and have associated views for it to possibly be a hit
if (!getSourceRange().contains(loc) || hi == 0)
{
@@ -482,10 +482,10 @@ SourceView* SourceManager::findSourceView(SourceLoc loc) const
const SourceLoc::RawValue rawLoc = loc.getRaw();
// Binary chop to see if we can find the associated SourceUnit
- int lo = 0;
+ Index lo = 0;
while (lo + 1 < hi)
{
- int mid = (hi + lo) >> 1;
+ Index mid = (hi + lo) >> 1;
SourceView* midView = m_sourceViews[mid];
if (midView->getRange().contains(loc))
diff --git a/source/slang/source-loc.h b/source/slang/source-loc.h
index e12ec640e..95db7a50e 100644
--- a/source/slang/source-loc.h
+++ b/source/slang/source-loc.h
@@ -53,11 +53,11 @@ struct PathInfo
};
/// True if has a canonical path
- SLANG_FORCE_INLINE bool hasUniqueIdentity() const { return type == Type::Normal && uniqueIdentity.Length() > 0; }
+ SLANG_FORCE_INLINE bool hasUniqueIdentity() const { return type == Type::Normal && uniqueIdentity.getLength() > 0; }
/// True if has a regular found path
- SLANG_FORCE_INLINE bool hasFoundPath() const { return type == Type::Normal || type == Type::FoundPath || (type == Type::FromString && foundPath.Length() > 0); }
+ SLANG_FORCE_INLINE bool hasFoundPath() const { return type == Type::Normal || type == Type::FoundPath || (type == Type::FromString && foundPath.getLength() > 0); }
/// True if has a found path that has originated from a file (as opposed to string or some other origin)
- SLANG_FORCE_INLINE bool hasFileFoundPath() const { return (type == Type::Normal || type == Type::FoundPath) && foundPath.Length() > 0; }
+ SLANG_FORCE_INLINE bool hasFileFoundPath() const { return (type == Type::Normal || type == Type::FoundPath) && foundPath.getLength() > 0; }
/// Returns the 'most unique' identity for the path. If has a 'uniqueIdentity' returns that, else the foundPath, else "".
const String getMostUniqueIdentity() const;
@@ -65,8 +65,8 @@ struct PathInfo
// So simplify construction. In normal usage it's safer to use make methods over constructing directly.
static PathInfo makeUnknown() { return PathInfo { Type::Unknown, "unknown", String() }; }
static PathInfo makeTokenPaste() { return PathInfo{ Type::TokenPaste, "token paste", String()}; }
- static PathInfo makeNormal(const String& foundPathIn, const String& uniqueIdentity) { SLANG_ASSERT(uniqueIdentity.Length() > 0 && foundPathIn.Length() > 0); return PathInfo { Type::Normal, foundPathIn, uniqueIdentity }; }
- static PathInfo makePath(const String& pathIn) { SLANG_ASSERT(pathIn.Length() > 0); return PathInfo { Type::FoundPath, pathIn, String()}; }
+ static PathInfo makeNormal(const String& foundPathIn, const String& uniqueIdentity) { SLANG_ASSERT(uniqueIdentity.getLength() > 0 && foundPathIn.getLength() > 0); return PathInfo { Type::Normal, foundPathIn, uniqueIdentity }; }
+ static PathInfo makePath(const String& pathIn) { SLANG_ASSERT(pathIn.getLength() > 0); return PathInfo { Type::FoundPath, pathIn, String()}; }
static PathInfo makeTypeParse() { return PathInfo { Type::TypeParse, "type string", String() }; }
static PathInfo makeCommandLine() { return PathInfo { Type::CommandLine, "command line", String() }; }
static PathInfo makeFromString(const String& userPath) { return PathInfo{ Type::FromString, userPath, String() }; }
@@ -264,7 +264,7 @@ class SourceView
/// Get the entries
const List<Entry>& getEntries() const { return m_entries; }
/// Set the entries list
- void setEntries(const Entry* entries, UInt numEntries) { m_entries.Clear(); m_entries.AddRange(entries, numEntries); }
+ void setEntries(const Entry* entries, UInt numEntries) { m_entries.clear(); m_entries.addRange(entries, numEntries); }
/// Get the source file holds the contents this view
SourceFile* getSourceFile() const { return m_sourceFile; }
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp
index c48eb7755..c069c69d7 100644
--- a/source/slang/syntax.cpp
+++ b/source/slang/syntax.cpp
@@ -299,7 +299,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
auto substitutions = new GenericSubstitution();
substitutions->genericDecl = genericDecl;
- substitutions->args.Add(valueType);
+ substitutions->args.add(valueType);
auto declRef = DeclRef<Decl>(typeDecl.Ptr(), substitutions);
auto rsType = DeclRefType::Create(
@@ -766,7 +766,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
}
else if (magicMod->name == "Vector")
{
- SLANG_ASSERT(subst && subst->args.Count() == 2);
+ SLANG_ASSERT(subst && subst->args.getCount() == 2);
auto vecType = new VectorExpressionType();
vecType->setSession(session);
vecType->declRef = declRef;
@@ -776,7 +776,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
}
else if (magicMod->name == "Matrix")
{
- SLANG_ASSERT(subst && subst->args.Count() == 3);
+ SLANG_ASSERT(subst && subst->args.getCount() == 3);
auto matType = new MatrixExpressionType();
matType->setSession(session);
matType->declRef = declRef;
@@ -784,7 +784,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
}
else if (magicMod->name == "Texture")
{
- SLANG_ASSERT(subst && subst->args.Count() >= 1);
+ SLANG_ASSERT(subst && subst->args.getCount() >= 1);
auto textureType = new TextureType(
TextureFlavor(magicMod->tag),
ExtractGenericArgType(subst->args[0]));
@@ -794,7 +794,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
}
else if (magicMod->name == "TextureSampler")
{
- SLANG_ASSERT(subst && subst->args.Count() >= 1);
+ SLANG_ASSERT(subst && subst->args.getCount() >= 1);
auto textureType = new TextureSamplerType(
TextureFlavor(magicMod->tag),
ExtractGenericArgType(subst->args[0]));
@@ -804,7 +804,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
}
else if (magicMod->name == "GLSLImageType")
{
- SLANG_ASSERT(subst && subst->args.Count() >= 1);
+ SLANG_ASSERT(subst && subst->args.getCount() >= 1);
auto textureType = new GLSLImageType(
TextureFlavor(magicMod->tag),
ExtractGenericArgType(subst->args[0]));
@@ -832,7 +832,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
#define CASE(n,T) \
else if(magicMod->name == #n) { \
- SLANG_ASSERT(subst && subst->args.Count() == 1); \
+ SLANG_ASSERT(subst && subst->args.getCount() == 1); \
auto type = new T(); \
type->setSession(session); \
type->elementType = ExtractGenericArgType(subst->args[0]); \
@@ -1074,7 +1074,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
List<RefPtr<Type>> substParamTypes;
for( auto pp : paramTypes )
{
- substParamTypes.Add(pp->SubstituteImpl(subst, &diff).as<Type>());
+ substParamTypes.add(pp->SubstituteImpl(subst, &diff).as<Type>());
}
// early exit for no change...
@@ -1098,7 +1098,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
List<RefPtr<Type>> canParamTypes;
for( auto pp : paramTypes )
{
- canParamTypes.Add(pp->GetCanonicalType());
+ canParamTypes.add(pp->GetCanonicalType());
}
RefPtr<FuncType> canType = new FuncType();
@@ -1256,8 +1256,8 @@ void Type::accept(IValVisitor* visitor, void* extra)
auto substitutions = new GenericSubstitution();
substitutions->genericDecl = vectorGenericDecl.Ptr();
- substitutions->args.Add(elementType);
- substitutions->args.Add(elementCount);
+ substitutions->args.add(elementType);
+ substitutions->args.add(elementCount);
auto declRef = DeclRef<Decl>(vectorTypeDecl.Ptr(), substitutions);
@@ -1348,7 +1348,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
List<RefPtr<Val>> substArgs;
for (auto a : args)
{
- substArgs.Add(a->SubstituteImpl(substSet, &diff));
+ substArgs.add(a->SubstituteImpl(substSet, &diff));
}
if (!diff) return this;
@@ -1375,9 +1375,9 @@ void Type::accept(IValVisitor* visitor, void* extra)
if (genericDecl != genericSubst->genericDecl)
return false;
- UInt argCount = args.Count();
- SLANG_RELEASE_ASSERT(args.Count() == genericSubst->args.Count());
- for (UInt aa = 0; aa < argCount; ++aa)
+ Index argCount = args.getCount();
+ SLANG_RELEASE_ASSERT(args.getCount() == genericSubst->args.getCount());
+ for (Index aa = 0; aa < argCount; ++aa)
{
if (!args[aa]->EqualsVal(genericSubst->args[aa].Ptr()))
return false;
@@ -1447,7 +1447,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
substConstraintArg.decl = constraintArg.decl;
substConstraintArg.val = constraintArg.val->SubstituteImpl(substSet, &diff);
- substConstraintArgs.Add(substConstraintArg);
+ substConstraintArgs.add(substConstraintArg);
}
if(!diff)
@@ -1476,9 +1476,9 @@ void Type::accept(IValVisitor* visitor, void* extra)
return false;
if (!actualType->EqualsVal(genSubst->actualType))
return false;
- if (constraintArgs.Count() != genSubst->constraintArgs.Count())
+ if (constraintArgs.getCount() != genSubst->constraintArgs.getCount())
return false;
- for (UInt i = 0; i < constraintArgs.Count(); i++)
+ for (Index i = 0; i < constraintArgs.getCount(); i++)
{
if (!constraintArgs[i].val->EqualsVal(genSubst->constraintArgs[i].val))
return false;
@@ -2139,7 +2139,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
paramType = session->getOutType(paramType);
}
}
- funcType->paramTypes.Add(paramType);
+ funcType->paramTypes.add(paramType);
}
return funcType;
@@ -2238,7 +2238,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
continue;
bool found = false;
- UInt index = 0;
+ Index index = 0;
for (auto m : genericDecl->Members)
{
if (auto constraintParam = as<GenericTypeConstraintDecl>(m))
@@ -2254,9 +2254,9 @@ void Type::accept(IValVisitor* visitor, void* extra)
if (found)
{
(*ioDiff)++;
- auto ordinaryParamCount = genericDecl->getMembersOfType<GenericTypeParamDecl>().Count() +
- genericDecl->getMembersOfType<GenericValueParamDecl>().Count();
- SLANG_ASSERT(index + ordinaryParamCount < genericSubst->args.Count());
+ auto ordinaryParamCount = genericDecl->getMembersOfType<GenericTypeParamDecl>().getCount() +
+ genericDecl->getMembersOfType<GenericValueParamDecl>().getCount();
+ SLANG_ASSERT(index + ordinaryParamCount < genericSubst->args.getCount());
return genericSubst->args[index + ordinaryParamCount];
}
}
@@ -2583,11 +2583,11 @@ void Type::accept(IValVisitor* visitor, void* extra)
if(!taggedUnion)
return false;
- auto caseCount = caseTypes.Count();
- if(caseCount != taggedUnion->caseTypes.Count())
+ auto caseCount = caseTypes.getCount();
+ if(caseCount != taggedUnion->caseTypes.getCount())
return false;
- for( UInt ii = 0; ii < caseCount; ++ii )
+ for( Index ii = 0; ii < caseCount; ++ii )
{
if(!caseTypes[ii]->Equals(taggedUnion->caseTypes[ii]))
return false;
@@ -2613,7 +2613,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
for( auto caseType : caseTypes )
{
auto canCaseType = caseType->GetCanonicalType();
- canType->caseTypes.Add(canCaseType);
+ canType->caseTypes.add(canCaseType);
}
return canType;
@@ -2626,7 +2626,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
List<RefPtr<Type>> substCaseTypes;
for( auto caseType : caseTypes )
{
- substCaseTypes.Add(caseType->SubstituteImpl(subst, &diff).as<Type>());
+ substCaseTypes.add(caseType->SubstituteImpl(subst, &diff).as<Type>());
}
if(!diff)
return this;
@@ -2635,7 +2635,7 @@ void Type::accept(IValVisitor* visitor, void* extra)
RefPtr<TaggedUnionType> substType = new TaggedUnionType();
substType->setSession(getSession());
- substType->caseTypes.SwapWith(substCaseTypes);
+ substType->caseTypes.swapWith(substCaseTypes);
return substType;
}
@@ -2650,11 +2650,11 @@ bool TaggedUnionSubtypeWitness::EqualsVal(Val* val)
if(!taggedUnionWitness)
return false;
- auto caseCount = caseWitnesses.Count();
- if(caseCount != taggedUnionWitness->caseWitnesses.Count())
+ auto caseCount = caseWitnesses.getCount();
+ if(caseCount != taggedUnionWitness->caseWitnesses.getCount())
return false;
- for(UInt ii = 0; ii < caseCount; ++ii)
+ for(Index ii = 0; ii < caseCount; ++ii)
{
if(!caseWitnesses[ii]->EqualsVal(taggedUnionWitness->caseWitnesses[ii]))
return false;
@@ -2698,7 +2698,7 @@ RefPtr<Val> TaggedUnionSubtypeWitness::SubstituteImpl(SubstitutionSet subst, int
List<RefPtr<Val>> substCaseWitnesses;
for( auto caseWitness : caseWitnesses )
{
- substCaseWitnesses.Add(caseWitness->SubstituteImpl(subst, &diff));
+ substCaseWitnesses.add(caseWitness->SubstituteImpl(subst, &diff));
}
if(!diff)
@@ -2709,7 +2709,7 @@ RefPtr<Val> TaggedUnionSubtypeWitness::SubstituteImpl(SubstitutionSet subst, int
RefPtr<TaggedUnionSubtypeWitness> substWitness = new TaggedUnionSubtypeWitness();
substWitness->sub = substSub;
substWitness->sup = substSup;
- substWitness->caseWitnesses.SwapWith(substCaseWitnesses);
+ substWitness->caseWitnesses.swapWith(substCaseWitnesses);
return substWitness;
}
diff --git a/source/slang/syntax.h b/source/slang/syntax.h
index 41d8b2cec..eb7cee40a 100644
--- a/source/slang/syntax.h
+++ b/source/slang/syntax.h
@@ -589,50 +589,50 @@ namespace Slang
typedef RefPtr<Decl> Element;
FilteredMemberList()
- : mBegin(NULL)
- , mEnd(NULL)
+ : m_begin(nullptr)
+ , m_end(nullptr)
{}
explicit FilteredMemberList(
List<Element> const& list)
- : mBegin(Adjust(list.begin(), list.end()))
- , mEnd(list.end())
+ : m_begin(adjust(list.begin(), list.end()))
+ , m_end(list.end())
{}
struct Iterator
{
- Element* mCursor;
- Element* mEnd;
+ Element* m_cursor;
+ Element* m_end;
bool operator!=(Iterator const& other)
{
- return mCursor != other.mCursor;
+ return m_cursor != other.m_cursor;
}
void operator++()
{
- mCursor = Adjust(mCursor + 1, mEnd);
+ m_cursor = adjust(m_cursor + 1, m_end);
}
RefPtr<T>& operator*()
{
- return *(RefPtr<T>*)mCursor;
+ return *(RefPtr<T>*)m_cursor;
}
};
Iterator begin()
{
- Iterator iter = { mBegin, mEnd };
+ Iterator iter = { m_begin, m_end };
return iter;
}
Iterator end()
{
- Iterator iter = { mEnd, mEnd };
+ Iterator iter = { m_end, m_end };
return iter;
}
- static Element* Adjust(Element* cursor, Element* end)
+ static Element* adjust(Element* cursor, Element* end)
{
while (cursor != end)
{
@@ -645,10 +645,10 @@ namespace Slang
// TODO(tfoley): It is ugly to have these.
// We should probably fix the call sites instead.
- RefPtr<T>& First() { return *begin(); }
- UInt Count()
+ RefPtr<T>& getFirst() { return *begin(); }
+ Index getCount()
{
- UInt count = 0;
+ Index count = 0;
for (auto iter : (*this))
{
(void)iter;
@@ -657,18 +657,18 @@ namespace Slang
return count;
}
- List<RefPtr<T>> ToArray()
+ List<RefPtr<T>> toArray()
{
List<RefPtr<T>> result;
for (auto element : (*this))
{
- result.Add(element);
+ result.add(element);
}
return result;
}
- Element* mBegin;
- Element* mEnd;
+ Element* m_begin;
+ Element* m_end;
};
struct TransparentMemberInfo
@@ -702,7 +702,7 @@ namespace Slang
{
List<DeclRef<T>> result;
for (auto d : *this)
- result.Add(d);
+ result.add(d);
return result;
}
@@ -998,11 +998,11 @@ namespace Slang
// Was at least one result found?
bool isValid() const { return item.declRef.getDecl() != nullptr; }
- bool isOverloaded() const { return items.Count() > 1; }
+ bool isOverloaded() const { return items.getCount() > 1; }
Name* getName() const
{
- return items.Count() > 1 ? items[0].declRef.GetName() : item.declRef.GetName();
+ return items.getCount() > 1 ? items[0].declRef.GetName() : item.declRef.GetName();
}
LookupResultItem* begin()
{
@@ -1217,14 +1217,14 @@ namespace Slang
{
List<DeclRef<T>> rs;
for (auto d : getMembersOfType<T>(declRef))
- rs.Add(d);
+ rs.add(d);
if (auto aggDeclRef = declRef.as<AggTypeDecl>())
{
for (auto ext = GetCandidateExtensions(aggDeclRef); ext; ext = ext->nextCandidateExtension)
{
auto extMembers = getMembersOfType<T>(DeclRef<ContainerDecl>(ext, declRef.substitutions));
for (auto mbr : extMembers)
- rs.Add(mbr);
+ rs.add(mbr);
}
}
return rs;
diff --git a/source/slang/type-defs.h b/source/slang/type-defs.h
index b7af1d975..2d376d754 100644
--- a/source/slang/type-defs.h
+++ b/source/slang/type-defs.h
@@ -406,7 +406,7 @@ RAW(
FuncType()
{}
- UInt getParamCount() { return paramTypes.Count(); }
+ UInt getParamCount() { return paramTypes.getCount(); }
Type* getParamType(UInt index) { return paramTypes[index]; }
Type* getResultType() { return resultType; }
diff --git a/source/slang/type-layout.cpp b/source/slang/type-layout.cpp
index 90acf0d3c..e315c2fb6 100644
--- a/source/slang/type-layout.cpp
+++ b/source/slang/type-layout.cpp
@@ -1119,7 +1119,7 @@ RefPtr<TypeLayout> applyOffsetToTypeLayout(
}
}
- newStructTypeLayout->fields.Add(newField);
+ newStructTypeLayout->fields.add(newField);
mapOldFieldToNew.Add(oldField.Ptr(), newField.Ptr());
}
@@ -1843,7 +1843,7 @@ static TypeLayoutResult _createTypeLayout(
int findGenericParam(List<RefPtr<GenericParamLayout>> & genericParameters, GlobalGenericParamDecl * decl)
{
- return (int)genericParameters.FindFirst([=](RefPtr<GenericParamLayout> & x) {return x->decl.Ptr() == decl; });
+ return (int)genericParameters.findFirstIndex([=](RefPtr<GenericParamLayout> & x) {return x->decl.Ptr() == decl; });
}
// When constructing a new var layout from an existing one,
@@ -1999,7 +1999,7 @@ static RefPtr<TypeLayout> maybeAdjustLayoutForArrayElementType(
}
else if(auto originalStructTypeLayout = originalTypeLayout.as<StructTypeLayout>() )
{
- UInt fieldCount = originalStructTypeLayout->fields.Count();
+ Index fieldCount = originalStructTypeLayout->fields.getCount();
// Empty struct? Bail out.
if(fieldCount == 0)
@@ -2072,7 +2072,7 @@ static RefPtr<TypeLayout> maybeAdjustLayoutForArrayElementType(
}
}
- adjustedStructTypeLayout->fields.Add(adjustedField);
+ adjustedStructTypeLayout->fields.add(adjustedField);
mapOriginalFieldToAdjusted.Add(originalField, adjustedField);
}
@@ -2119,7 +2119,7 @@ TypeLayoutResult makeTypeLayoutResult(RefPtr<TypeLayout> typeLayout)
// If the type only consumes a single kind of non-uniform resource,
// we can fill in the `info` field directly.
//
- if( typeLayout->resourceInfos.Count() == 1 )
+ if( typeLayout->resourceInfos.getCount() == 1 )
{
auto resInfo = typeLayout->resourceInfos[0];
if( resInfo.kind != LayoutResourceKind::Uniform )
@@ -2209,7 +2209,7 @@ RefPtr<VarLayout> StructTypeLayoutBuilder::addField(
RefPtr<VarLayout> fieldLayout = new VarLayout();
fieldLayout->varDecl = field;
fieldLayout->typeLayout = fieldTypeLayout;
- m_typeLayout->fields.Add(fieldLayout);
+ m_typeLayout->fields.add(fieldLayout);
m_typeLayout->mapVarToLayout.Add(field.getDecl(), fieldLayout);
// Set up uniform offset information, if there is any uniform data in the field
@@ -2906,7 +2906,7 @@ static TypeLayoutResult _createTypeLayout(
// We need to remember the layout of the case type
// on the final `TaggedUnionTypeLayout`.
//
- taggedUnionLayout->caseTypeLayouts.Add(caseTypeLayout);
+ taggedUnionLayout->caseTypeLayouts.add(caseTypeLayout);
// We also need to consider contributions for other
// resource kinds beyond uniform data.
diff --git a/source/slang/type-layout.h b/source/slang/type-layout.h
index f0c09f371..fcb2c3419 100644
--- a/source/slang/type-layout.h
+++ b/source/slang/type-layout.h
@@ -358,8 +358,8 @@ public:
ResourceInfo info;
info.kind = kind;
info.count = 0;
- resourceInfos.Add(info);
- return &resourceInfos.Last();
+ resourceInfos.add(info);
+ return &resourceInfos.getLast();
}
void addResourceUsage(ResourceInfo info)
@@ -460,8 +460,8 @@ public:
info.space = 0;
info.index = 0;
- resourceInfos.Add(info);
- return &resourceInfos.Last();
+ resourceInfos.add(info);
+ return &resourceInfos.getLast();
}
ResourceInfo* findOrAddResourceInfo(LayoutResourceKind kind)