diff options
Diffstat (limited to 'source')
31 files changed, 236 insertions, 267 deletions
diff --git a/source/slang/slang-ast-dump.cpp b/source/slang/slang-ast-dump.cpp index 13e833aaa..8b9f643dd 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -417,7 +417,7 @@ struct Context void dump(const QualType& qualType) { - if (qualType.IsLeftValue) + if (qualType.isLeftValue) { m_writer->emit("left "); } diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h index 5cb7f3202..3fc14e2ee 100644 --- a/source/slang/slang-ast-support-types.h +++ b/source/slang/slang-ast-support-types.h @@ -13,8 +13,6 @@ #include "slang-ast-reflect.h" - - #include "slang-name.h" #include <assert.h> @@ -129,14 +127,6 @@ namespace Slang class Decl; class Val; -#if 0 - // Forward-declare all syntax classes -#define SYNTAX_CLASS(NAME, BASE, ...) class NAME; -#include "slang-object-meta-begin.h" -#include "slang-syntax-defs.h" -#include "slang-object-meta-end.h" -#endif - // Helper type for pairing up a name and the location where it appeared struct NameLoc { @@ -202,11 +192,6 @@ namespace Slang } void operator++(); -#if 0 - { - current = current->next.Ptr(); - } -#endif bool operator!=(Iterator other) { @@ -251,12 +236,7 @@ namespace Slang } void operator++(); - #if 0 - { - current = Adjust(current->next.Ptr()); - } - #endif - + bool operator!=(Iterator other) { return current != other.current; @@ -276,24 +256,13 @@ namespace Slang {} FilteredModifierList(Modifier* modifiers) - : modifiers(Adjust(modifiers)) + : modifiers(adjust(modifiers)) {} Iterator begin() { return Iterator(modifiers); } Iterator end() { return Iterator(nullptr); } - static Modifier* Adjust(Modifier* modifier); - #if 0 - { - Modifier* m = modifier; - for (;;) - { - if (!m) return m; - if (dynamicCast<T>(m)) return m; - m = m->next.Ptr(); - } - } - #endif + static Modifier* adjust(Modifier* modifier); Modifier* modifiers; }; @@ -327,7 +296,7 @@ namespace Slang // Try to extract a simple integer value from an `IntVal`. // This fill assert-fail if the object doesn't represent a literal value. - IntegerLiteralValue GetIntVal(RefPtr<IntVal> val); + IntegerLiteralValue getIntVal(RefPtr<IntVal> val); /// Represents how much checking has been applied to a declaration. enum class DeclCheckState : uint8_t @@ -461,15 +430,15 @@ namespace Slang struct QualType { RefPtr<Type> type; - bool IsLeftValue; + bool isLeftValue; QualType() - : IsLeftValue(false) + : isLeftValue(false) {} QualType(Type* type) : type(type) - , IsLeftValue(false) + , isLeftValue(false) {} Type* Ptr() { return type.Ptr(); } @@ -672,9 +641,9 @@ namespace Slang } // Convenience accessors for common properties of declarations - Name* GetName() const; + Name* getName() const; SourceLoc getLoc() const; - DeclRefBase GetParent() const; + DeclRefBase getParent() const; HashCode getHashCode() const; @@ -743,9 +712,9 @@ namespace Slang return DeclRef<T>::unsafeInit(DeclRefBase::substituteImpl(astBuilder, subst, ioDiff)); } - DeclRef<ContainerDecl> GetParent() const + DeclRef<ContainerDecl> getParent() const { - return DeclRef<ContainerDecl>::unsafeInit(DeclRefBase::GetParent()); + return DeclRef<ContainerDecl>::unsafeInit(DeclRefBase::getParent()); } }; @@ -1201,7 +1170,7 @@ namespace Slang Name* getName() const { - return items.getCount() > 1 ? items[0].declRef.GetName() : item.declRef.GetName(); + return items.getCount() > 1 ? items[0].declRef.getName() : item.declRef.getName(); } LookupResultItem* begin() { diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index 4a149c10f..4d54a93fb 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -211,7 +211,7 @@ namespace Slang for (auto genConstraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(aggTypeDeclRef)) { ensureDecl(genConstraintDeclRef, DeclCheckState::CanUseBaseOfInheritanceDecl); - auto inheritedType = GetSup(m_astBuilder, genConstraintDeclRef); + auto inheritedType = getSup(m_astBuilder, genConstraintDeclRef); TypeWitnessBreadcrumb breadcrumb; breadcrumb.prev = inBreadcrumbs; breadcrumb.sub = type; @@ -228,13 +228,13 @@ namespace Slang // We need to enumerate the constraints placed on this type by its outer // generic declaration, and see if any of them guarantees that we // satisfy the given interface.. - auto genericDeclRef = genericTypeParamDeclRef.GetParent().as<GenericDecl>(); + auto genericDeclRef = genericTypeParamDeclRef.getParent().as<GenericDecl>(); SLANG_ASSERT(genericDeclRef); for( auto constraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(genericDeclRef) ) { - auto sub = GetSub(m_astBuilder, constraintDeclRef); - auto sup = GetSup(m_astBuilder, constraintDeclRef); + auto sub = getSub(m_astBuilder, constraintDeclRef); + auto sup = getSup(m_astBuilder, constraintDeclRef); auto subDeclRef = as<DeclRefType>(sub); if(!subDeclRef) diff --git a/source/slang/slang-check-constraint.cpp b/source/slang/slang-check-constraint.cpp index 315f9c5b1..427ba9ec2 100644 --- a/source/slang/slang-check-constraint.cpp +++ b/source/slang/slang-check-constraint.cpp @@ -286,7 +286,7 @@ namespace Slang // that `X<T>.IndexType == T`. for( auto constraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(genericDeclRef) ) { - if(!TryUnifyTypes(*system, GetSub(m_astBuilder, constraintDeclRef), GetSup(m_astBuilder, constraintDeclRef))) + if(!TryUnifyTypes(*system, getSub(m_astBuilder, constraintDeclRef), getSup(m_astBuilder, constraintDeclRef))) return SubstitutionSet(); } SubstitutionSet resultSubst = genericDeclRef.substitutions; @@ -404,8 +404,8 @@ namespace Slang solvedSubst); // Extract the (substituted) sub- and super-type from the constraint. - auto sub = GetSub(m_astBuilder, constraintDeclRef); - auto sup = GetSup(m_astBuilder, constraintDeclRef); + auto sub = getSub(m_astBuilder, constraintDeclRef); + auto sup = getSup(m_astBuilder, constraintDeclRef); // Search for a witness that shows the constraint is satisfied. auto subTypeWitness = tryGetSubtypeWitness(sub, sup); diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp index dfcf7ece2..1f34e240d 100644 --- a/source/slang/slang-check-conversion.cpp +++ b/source/slang/slang-check-conversion.cpp @@ -382,7 +382,7 @@ namespace Slang { RefPtr<Expr> coercedArg; bool argResult = _readValueFromInitializerList( - GetType(m_astBuilder, fieldDeclRef), + getType(m_astBuilder, fieldDeclRef), outToExpr ? &coercedArg : nullptr, fromInitializerListExpr, ioArgIndex); diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index b08baa42f..66a8ceaf8 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -322,7 +322,7 @@ namespace Slang if (auto varDeclRef = declRef.as<VarDeclBase>()) { QualType qualType; - qualType.type = GetType(astBuilder, varDeclRef); + qualType.type = getType(astBuilder, varDeclRef); bool isLValue = true; if(varDeclRef.getDecl()->findModifier<ConstModifier>()) @@ -362,14 +362,14 @@ namespace Slang } } - qualType.IsLeftValue = isLValue; + qualType.isLeftValue = isLValue; return qualType; } else if( auto enumCaseDeclRef = declRef.as<EnumCaseDecl>() ) { QualType qualType; qualType.type = getType(astBuilder, enumCaseDeclRef); - qualType.IsLeftValue = false; + qualType.isLeftValue = false; return qualType; } else if (auto typeAliasDeclRef = declRef.as<TypeDefDecl>()) @@ -406,7 +406,7 @@ namespace Slang // When we access a constraint or an inheritance decl (as a member), // we are conceptually performing a "cast" to the given super-type, // with the declaration showing that such a cast is legal. - auto type = GetSup(astBuilder, constraintDeclRef); + auto type = getSup(astBuilder, constraintDeclRef); return QualType(type); } else if( auto namespaceDeclRef = declRef.as<NamespaceDeclBase>()) @@ -428,7 +428,7 @@ namespace Slang // TODO: This code could break if we ever go down this path with // an identifier that doesn't have a name. // - sink->diagnose(loc, Diagnostics::undefinedIdentifier2, declRef.GetName()); + sink->diagnose(loc, Diagnostics::undefinedIdentifier2, declRef.getName()); } return QualType(astBuilder->getErrorType()); } @@ -1285,7 +1285,7 @@ namespace Slang for (auto requiredConstraintDeclRef : getMembersOfType<TypeConstraintDecl>(requiredAssociatedTypeDeclRef)) { // Grab the type we expect to conform to from the constraint. - auto requiredSuperType = GetSup(m_astBuilder, requiredConstraintDeclRef); + auto requiredSuperType = getSup(m_astBuilder, requiredConstraintDeclRef); // Perform a search for a witness to the subtype relationship. auto witness = tryGetSubtypeWitness(satisfyingType, requiredSuperType); @@ -1478,7 +1478,7 @@ namespace Slang // since only same-name members will be able to // satisfy the requirement. // - Name* name = requiredMemberDeclRef.GetName(); + Name* name = requiredMemberDeclRef.getName(); // We start by looking up members of the same // name, on the type that is claiming to conform. @@ -1714,7 +1714,7 @@ namespace Slang void SemanticsVisitor::checkExtensionConformance(ExtensionDecl* decl) { auto declRef = createDefaultSubstitutionsIfNeeded(m_astBuilder, makeDeclRef(decl)).as<ExtensionDecl>(); - auto targetType = GetTargetType(m_astBuilder, declRef); + auto targetType = getTargetType(m_astBuilder, declRef); for (auto inheritanceDecl : decl->getMembersOfType<InheritanceDecl>()) { @@ -2297,12 +2297,12 @@ namespace Slang // and `sup` types are pairwise equivalent. // auto leftSub = leftConstraint->sub; - auto rightSub = GetSub(m_astBuilder, rightConstraint); + auto rightSub = getSub(m_astBuilder, rightConstraint); if(!leftSub->equals(rightSub)) return false; auto leftSup = leftConstraint->sup; - auto rightSup = GetSup(m_astBuilder, rightConstraint); + auto rightSup = getSup(m_astBuilder, rightConstraint); if(!leftSup->equals(rightSup)) return false; } @@ -2320,8 +2320,8 @@ namespace Slang { // TODO(tfoley): This copies the parameter array, which is bad for performance. - auto fstParams = GetParameters(fst).toArray(); - auto sndParams = GetParameters(snd).toArray(); + auto fstParams = getParameters(fst).toArray(); + auto sndParams = getParameters(snd).toArray(); // If the functions have different numbers of parameters, then // their signatures trivially don't match. @@ -2336,7 +2336,7 @@ namespace Slang auto sndParam = sndParams[ii]; // If a given parameter type doesn't match, then signatures don't match - if (!GetType(m_astBuilder, fstParam)->equals(GetType(m_astBuilder, sndParam))) + if (!getType(m_astBuilder, fstParam)->equals(getType(m_astBuilder, sndParam))) return false; // If one parameter is `out` and the other isn't, then they don't match @@ -2543,8 +2543,8 @@ namespace Slang // consider result types earlier, as part of the signature // matching step. // - auto resultType = GetResultType(m_astBuilder, newDeclRef); - auto prevResultType = GetResultType(m_astBuilder, oldDeclRef); + auto resultType = getResultType(m_astBuilder, newDeclRef); + auto prevResultType = getResultType(m_astBuilder, oldDeclRef); if (!resultType->equals(prevResultType)) { // Bad redeclaration @@ -2919,7 +2919,7 @@ namespace Slang // sooner or later. // ensureDecl(extDeclRef, DeclCheckState::CanUseExtensionTargetType); - auto targetType = GetTargetType(m_astBuilder, extDeclRef); + auto targetType = getTargetType(m_astBuilder, extDeclRef); return calcThisType(targetType); } else @@ -3064,7 +3064,7 @@ namespace Slang } // Now extract the target type from our (possibly specialized) extension decl-ref. - RefPtr<Type> targetType = GetTargetType(m_astBuilder, extDeclRef); + RefPtr<Type> targetType = getTargetType(m_astBuilder, extDeclRef); // As a bit of a kludge here, if the target type of the extension is // an interface, and the `type` we are trying to match up has a this-type diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index e0f439ab3..2be64777b 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -215,14 +215,14 @@ namespace Slang loc, Diagnostics::staticRefToNonStaticMember, typeType->type, - declRef.GetName()); + declRef.getName()); } auto expr = m_astBuilder->create<StaticMemberExpr>(); expr->loc = loc; expr->type = type; expr->baseExpression = baseExpr; - expr->name = declRef.GetName(); + expr->name = declRef.getName(); expr->declRef = declRef; return expr; } @@ -238,7 +238,7 @@ namespace Slang expr->loc = loc; expr->type = type; expr->baseExpression = baseTypeExpr; - expr->name = declRef.GetName(); + expr->name = declRef.getName(); expr->declRef = declRef; return expr; } @@ -251,7 +251,7 @@ namespace Slang expr->loc = loc; expr->type = type; expr->baseExpression = baseExpr; - expr->name = declRef.GetName(); + expr->name = declRef.getName(); expr->declRef = declRef; // When referring to a member through an expression, @@ -261,9 +261,9 @@ namespace Slang // We have already used the `QualType` from the member // above (that is `type`), so we need to take the // l-value status of the base expression into account now. - if(!baseExpr->type.IsLeftValue) + if(!baseExpr->type.isLeftValue) { - expr->type.IsLeftValue = false; + expr->type.isLeftValue = false; } return expr; @@ -276,7 +276,7 @@ namespace Slang // auto expr = m_astBuilder->create<VarExpr>(); expr->loc = loc; - expr->name = declRef.GetName(); + expr->name = declRef.getName(); expr->type = type; expr->declRef = declRef; return expr; @@ -389,7 +389,7 @@ namespace Slang // logic will have computed an appropriate "mode" based // on the context during lookup. // - expr->type.IsLeftValue = thisParameterMode == LookupResultItem::Breadcrumb::ThisParameterMode::MutableValue; + expr->type.isLeftValue = thisParameterMode == LookupResultItem::Breadcrumb::ThisParameterMode::MutableValue; bb = expr; } @@ -485,7 +485,7 @@ namespace Slang void SemanticsVisitor::diagnoseAmbiguousReference(OverloadedExpr* overloadedExpr, LookupResult const& lookupResult) { - getSink()->diagnose(overloadedExpr, Diagnostics::ambiguousReference, lookupResult.items[0].declRef.GetName()); + getSink()->diagnose(overloadedExpr, Diagnostics::ambiguousReference, lookupResult.items[0].declRef.getName()); for(auto item : lookupResult.items) { @@ -656,7 +656,7 @@ namespace Slang return expr; } - IntVal* SemanticsVisitor::GetIntVal(IntegerLiteralExpr* expr) + IntVal* SemanticsVisitor::getIntVal(IntegerLiteralExpr* expr) { // TODO(tfoley): don't keep allocating here! return m_astBuilder->create<ConstantIntVal>(expr->value); @@ -734,7 +734,7 @@ namespace Slang // At this point, all the operands had simple integer values, so we are golden. IntegerLiteralValue resultValue = 0; - auto opName = funcDeclRef.GetName(); + auto opName = funcDeclRef.getName(); // handle binary operators if (opName == getName("-")) @@ -800,7 +800,7 @@ namespace Slang // TODO(tfoley): more serious constant folding here if (auto intLitExpr = as<IntegerLiteralExpr>(expr)) { - return GetIntVal(intLitExpr); + return getIntVal(intLitExpr); } // it is possible that we are referring to a generic value param @@ -933,7 +933,7 @@ namespace Slang subscriptExpr->type = QualType(elementType); // TODO(tfoley): need to be more careful about this stuff - subscriptExpr->type.IsLeftValue = baseExpr->type.IsLeftValue; + subscriptExpr->type.isLeftValue = baseExpr->type.isLeftValue; return subscriptExpr; } @@ -1086,7 +1086,7 @@ namespace Slang // and if it is immutable. if(auto thisExpr = as<ThisExpr>(e)) { - if(!thisExpr->type.IsLeftValue) + if(!thisExpr->type.isLeftValue) { getSink()->diagnose(thisExpr, Diagnostics::thisIsImmutableByDefault); } @@ -1101,7 +1101,7 @@ namespace Slang expr->right = coerce(type, CheckTerm(expr->right)); - if (!type.IsLeftValue) + if (!type.isLeftValue) { if (as<ErrorType>(type)) { @@ -1157,7 +1157,7 @@ namespace Slang if( pp < expr->arguments.getCount() ) { auto argExpr = expr->arguments[pp]; - if( !argExpr->type.IsLeftValue ) + if( !argExpr->type.isLeftValue ) { getSink()->diagnose( argExpr, @@ -1341,7 +1341,7 @@ namespace Slang if (auto pointerLikeType = as<PointerLikeType>(baseType)) { auto elementType = QualType(pointerLikeType->elementType); - elementType.IsLeftValue = baseType.IsLeftValue; + elementType.isLeftValue = baseType.isLeftValue; auto derefExpr = m_astBuilder->create<DerefExpr>(); derefExpr->base = expr; @@ -1445,7 +1445,7 @@ namespace Slang // A swizzle can be used as an l-value as long as there // were no duplicates in the list of components - swizExpr->type.IsLeftValue = !anyDuplicates; + swizExpr->type.isLeftValue = !anyDuplicates; return swizExpr; } @@ -1745,7 +1745,7 @@ namespace Slang RefPtr<Expr> SemanticsExprVisitor::visitThisExpr(ThisExpr* expr) { // A `this` expression will default to immutable. - expr->type.IsLeftValue = false; + expr->type.isLeftValue = false; // We will do an upwards search starting in the current // scope, looking for a surrounding type (or `extension`) @@ -1759,7 +1759,7 @@ namespace Slang { if( funcDeclBase->hasModifier<MutatingAttribute>() ) { - expr->type.IsLeftValue = true; + expr->type.isLeftValue = true; } } else if( auto typeOrExtensionDecl = as<AggTypeDeclBase>(containerDecl) ) diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index fba43adcb..52f460488 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -820,7 +820,7 @@ namespace Slang void validateArraySizeForVariable(VarDeclBase* varDecl); - IntVal* GetIntVal(IntegerLiteralExpr* expr); + IntVal* getIntVal(IntegerLiteralExpr* expr); Name* getName(String const& text) { diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index 6af2eec58..0bfb4ccaa 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -68,7 +68,7 @@ namespace Slang switch (candidate.flavor) { case OverloadCandidate::Flavor::Func: - paramCounts = CountParameters(GetParameters(candidate.item.declRef.as<CallableDecl>())); + paramCounts = CountParameters(getParameters(candidate.item.declRef.as<CallableDecl>())); break; case OverloadCandidate::Flavor::Generic: @@ -257,7 +257,7 @@ namespace Slang if (context.mode == OverloadResolveContext::Mode::JustTrying) { ConversionCost cost = kConversionCost_None; - if (!canCoerce(GetType(m_astBuilder, valParamRef), arg->type, &cost)) + if (!canCoerce(getType(m_astBuilder, valParamRef), arg->type, &cost)) { success = false; } @@ -265,7 +265,7 @@ namespace Slang } else { - arg = coerce(GetType(m_astBuilder, valParamRef), arg); + arg = coerce(getType(m_astBuilder, valParamRef), arg); } } @@ -316,7 +316,7 @@ namespace Slang switch (candidate.flavor) { case OverloadCandidate::Flavor::Func: - params = GetParameters(candidate.item.declRef.as<CallableDecl>()).toArray(); + params = getParameters(candidate.item.declRef.as<CallableDecl>()).toArray(); break; case OverloadCandidate::Flavor::Generic: @@ -343,10 +343,10 @@ namespace Slang if( context.disallowNestedConversions ) { // We need an exact match in this case. - if(!GetType(m_astBuilder, param)->equals(argType)) + if(!getType(m_astBuilder, param)->equals(argType)) return false; } - else if (!canCoerce(GetType(m_astBuilder, param), argType, &cost)) + else if (!canCoerce(getType(m_astBuilder, param), argType, &cost)) { return false; } @@ -354,7 +354,7 @@ namespace Slang } else { - arg = coerce(GetType(m_astBuilder, param), arg); + arg = coerce(getType(m_astBuilder, param), arg); } } return true; @@ -396,8 +396,8 @@ namespace Slang DeclRef<GenericTypeConstraintDecl> constraintDeclRef( constraintDecl, subset); - auto sub = GetSub(m_astBuilder, constraintDeclRef); - auto sup = GetSup(m_astBuilder, constraintDeclRef); + auto sub = getSub(m_astBuilder, constraintDeclRef); + auto sup = getSup(m_astBuilder, constraintDeclRef); auto subTypeWitness = tryGetSubtypeWitness(sub, sup); if(subTypeWitness) @@ -465,7 +465,7 @@ namespace Slang subst->genericDecl = baseGenericRef.getDecl(); subst->outer = baseGenericRef.substitutions.substitutions; - DeclRef<Decl> innerDeclRef(GetInner(baseGenericRef), subst); + DeclRef<Decl> innerDeclRef(getInner(baseGenericRef), subst); RefPtr<Expr> base; if (auto mbrExpr = as<MemberExpr>(baseExpr)) @@ -540,7 +540,7 @@ namespace Slang const auto& decl = subscriptDeclRef.getDecl(); if (decl->getMembersOfType<SetterDecl>().isNonEmpty() || decl->getMembersOfType<RefAccessorDecl>().isNonEmpty()) { - callExpr->type.IsLeftValue = true; + callExpr->type.isLeftValue = true; } } @@ -584,9 +584,9 @@ namespace Slang if(!declRef) return false; - auto parent = declRef.GetParent(); + auto parent = declRef.getParent(); if(parent.as<GenericDecl>()) - parent = parent.GetParent(); + parent = parent.getParent(); if(parent.as<InterfaceDecl>()) return true; @@ -606,7 +606,7 @@ namespace Slang // "inner" declaration of a generic. That means that // the parent of the decl ref must be a generic. // - auto parentGeneric = declRef.GetParent().as<GenericDecl>(); + auto parentGeneric = declRef.getParent().as<GenericDecl>(); if(!parentGeneric) return 0; // @@ -940,7 +940,7 @@ namespace Slang OverloadCandidate candidate; candidate.flavor = OverloadCandidate::Flavor::Func; candidate.item = item; - candidate.resultType = GetResultType(m_astBuilder, funcDeclRef); + candidate.resultType = getResultType(m_astBuilder, funcDeclRef); AddOverloadCandidate(context, candidate); } @@ -994,14 +994,14 @@ namespace Slang // Construct a reference to the inner declaration that has any generic // parameter substitutions in place already, but *not* any substutions // for the generic declaration we are currently trying to infer. - auto innerDecl = GetInner(genericDeclRef); + auto innerDecl = getInner(genericDeclRef); DeclRef<Decl> unspecializedInnerRef = DeclRef<Decl>(innerDecl, genericDeclRef.substitutions); // Check what type of declaration we are dealing with, and then try // to match it up with the arguments accordingly... if (auto funcDeclRef = unspecializedInnerRef.as<CallableDecl>()) { - auto params = GetParameters(funcDeclRef).toArray(); + auto params = getParameters(funcDeclRef).toArray(); Index argCount = context.getArgCount(); Index paramCount = params.getCount(); @@ -1037,7 +1037,7 @@ namespace Slang // So the question is then whether a mismatch during the // unification step should be taken as an immediate failure... - TryUnifyTypes(constraints, context.getArgType(aa), GetType(m_astBuilder, params[aa])); + TryUnifyTypes(constraints, context.getArgType(aa), getType(m_astBuilder, params[aa])); #endif } } @@ -1253,14 +1253,14 @@ namespace Slang void SemanticsVisitor::formatDeclPath(StringBuilder& sb, DeclRef<Decl> declRef) { // Find the parent declaration - auto parentDeclRef = declRef.GetParent(); + auto parentDeclRef = declRef.getParent(); // If the immediate parent is a generic, then we probably // want the declaration above that... auto parentGenericDeclRef = parentDeclRef.as<GenericDecl>(); if(parentGenericDeclRef) { - parentDeclRef = parentGenericDeclRef.GetParent(); + parentDeclRef = parentGenericDeclRef.getParent(); } // Depending on what the parent is, we may want to format things specially @@ -1320,11 +1320,11 @@ namespace Slang sb << "("; bool first = true; - for (auto paramDeclRef : GetParameters(funcDeclRef)) + for (auto paramDeclRef : getParameters(funcDeclRef)) { if (!first) sb << ", "; - formatType(sb, GetType(m_astBuilder, paramDeclRef)); + formatType(sb, getType(m_astBuilder, paramDeclRef)); first = false; @@ -1343,23 +1343,23 @@ namespace Slang if (!first) sb << ", "; first = false; - sb << getText(genericTypeParam.GetName()); + sb << getText(genericTypeParam.getName()); } else if(auto genericValParam = paramDeclRef.as<GenericValueParamDecl>()) { if (!first) sb << ", "; first = false; - sb << getText(genericValParam.GetName()); + sb << getText(genericValParam.getName()); sb << ":"; - formatType(sb, GetType(m_astBuilder, genericValParam)); + formatType(sb, getType(m_astBuilder, genericValParam)); } else {} } sb << ">"; - formatDeclParams(sb, DeclRef<Decl>(GetInner(genericDeclRef), genericDeclRef.substitutions)); + formatDeclParams(sb, DeclRef<Decl>(getInner(genericDeclRef), genericDeclRef.substitutions)); } else { @@ -1383,7 +1383,7 @@ namespace Slang DeclRef<Decl> declRef = inDeclRef; if(auto genericDeclRef = declRef.as<GenericDecl>()) { - declRef = DeclRef<Decl>(GetInner(genericDeclRef), genericDeclRef.substitutions); + declRef = DeclRef<Decl>(getInner(genericDeclRef), genericDeclRef.substitutions); } if(as<ConstructorDecl>(declRef)) @@ -1391,7 +1391,7 @@ namespace Slang else if(auto callableDeclRef = declRef.as<CallableDecl>()) { sb << " -> "; - formatType(sb, GetResultType(m_astBuilder, callableDeclRef)); + formatType(sb, getResultType(m_astBuilder, callableDeclRef)); } } diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp index a037218f9..80860074d 100644 --- a/source/slang/slang-check-shader.cpp +++ b/source/slang/slang-check-shader.cpp @@ -95,7 +95,7 @@ namespace Slang // A structure type should recursively introduce // existential slots for its fields. // - for( auto fieldDeclRef : GetFields(structDeclRef, MemberFilterStyle::Instance) ) + for( auto fieldDeclRef : getFields(structDeclRef, MemberFilterStyle::Instance) ) { _collectExistentialSpecializationParamsRec( astBuilder, @@ -118,7 +118,7 @@ namespace Slang _collectExistentialSpecializationParamsRec( astBuilder, ioSpecializationParams, - GetType(astBuilder, paramDeclRef), + getType(astBuilder, paramDeclRef), paramDeclRef.getLoc()); } @@ -200,7 +200,7 @@ namespace Slang // if( auto funcDeclRef = getFuncDeclRef() ) { - for( auto paramDeclRef : GetParameters(funcDeclRef) ) + for( auto paramDeclRef : getParameters(funcDeclRef) ) { ShaderParamInfo shaderParamInfo; shaderParamInfo.paramDeclRef = paramDeclRef; @@ -1019,7 +1019,7 @@ namespace Slang sink->diagnose(genericTypeParamDecl, Diagnostics::cannotSpecializeGlobalGenericToAnotherGenericParam, genericTypeParamDecl->getName(), - argGenericParamDeclRef.GetName()); + argGenericParamDeclRef.getName()); continue; } } @@ -1035,7 +1035,7 @@ namespace Slang for(auto constraintDecl : genericTypeParamDecl->getMembersOfType<GenericTypeConstraintDecl>()) { // Get the type that the constraint is enforcing conformance to - auto interfaceType = GetSup(getLinkage()->getASTBuilder(), DeclRef<GenericTypeConstraintDecl>(constraintDecl, nullptr)); + auto interfaceType = getSup(getLinkage()->getASTBuilder(), DeclRef<GenericTypeConstraintDecl>(constraintDecl, nullptr)); // Use our semantic-checking logic to search for a witness to the required conformance auto witness = visitor.tryGetSubtypeWitness(argType, interfaceType); @@ -1172,7 +1172,7 @@ namespace Slang // the semantic checking machinery to expand out // the rest of the arguments via inference... - auto genericDeclRef = m_funcDeclRef.GetParent().as<GenericDecl>(); + auto genericDeclRef = m_funcDeclRef.getParent().as<GenericDecl>(); SLANG_ASSERT(genericDeclRef); // otherwise we wouldn't have generic parameters RefPtr<GenericSubstitution> genericSubst = getLinkage()->getASTBuilder()->create<GenericSubstitution>(); @@ -1195,8 +1195,8 @@ namespace Slang ASTBuilder* astBuilder = getLinkage()->getASTBuilder(); - auto sub = GetSub(astBuilder, constraintDeclRef); - auto sup = GetSup(astBuilder, constraintDeclRef); + auto sub = getSub(astBuilder, constraintDeclRef); + auto sup = getSup(astBuilder, constraintDeclRef); auto subTypeWitness = visitor.tryGetSubtypeWitness(sub, sup); if(subTypeWitness) diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp index db5d555cd..bdb043413 100644 --- a/source/slang/slang-check-type.cpp +++ b/source/slang/slang-check-type.cpp @@ -159,7 +159,7 @@ namespace Slang } DeclRef<Decl> innerDeclRef; - innerDeclRef.decl = GetInner(genericDeclRef); + innerDeclRef.decl = getInner(genericDeclRef); innerDeclRef.substitutions = SubstitutionSet(subst); return DeclRefType::create(m_astBuilder, innerDeclRef); diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 41112f3cc..a15d7f945 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -185,7 +185,7 @@ namespace Slang { RefPtr<EntryPoint> entryPoint = new EntryPoint( linkage, - funcDeclRef.GetName(), + funcDeclRef.getName(), profile, funcDeclRef); entryPoint->m_mangledName = getMangledName(linkage->getASTBuilder(), funcDeclRef); diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 811036dc0..61b5ed139 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -209,7 +209,7 @@ void CLikeSourceEmitter::emitSimpleType(IRType* type) IRNumThreadsDecoration* decor = func->findDecoration<IRNumThreadsDecoration>(); for (int i = 0; i < 3; ++i) { - outNumThreads[i] = decor ? Int(GetIntVal(decor->getOperand(i))) : 1; + outNumThreads[i] = decor ? Int(getIntVal(decor->getOperand(i))) : 1; } return decor; } @@ -1521,7 +1521,7 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl( else if (auto vectorType = as<IRVectorType>(elementType)) { // A vector result is expected - auto elementCount = GetIntVal(vectorType->getElementCount()); + auto elementCount = getIntVal(vectorType->getElementCount()); if (elementCount < 4) { @@ -1553,7 +1553,7 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl( auto vectorArg = args[argIndex].get(); if (auto vectorType = as<IRVectorType>(vectorArg->getDataType())) { - auto elementCount = GetIntVal(vectorType->getElementCount()); + auto elementCount = getIntVal(vectorType->getElementCount()); m_writer->emit(elementCount); } else @@ -1578,7 +1578,7 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl( IRType* elementType = arg->getDataType(); if (auto vectorType = as<IRVectorType>(elementType)) { - elementCount = GetIntVal(vectorType->getElementCount()); + elementCount = getIntVal(vectorType->getElementCount()); elementType = vectorType->getElementType(); } @@ -1685,7 +1685,7 @@ void CLikeSourceEmitter::emitIntrinsicCallExprImpl( if(coordsVecType) { coordsType = coordsVecType->getElementType(); - elementCount = GetIntVal(coordsVecType->getElementCount()); + elementCount = getIntVal(coordsVecType->getElementCount()); } SLANG_ASSERT(coordsType->op == kIROp_UIntType); diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp index 716a8f046..bc82475f4 100644 --- a/source/slang/slang-emit-cpp.cpp +++ b/source/slang/slang-emit-cpp.cpp @@ -219,7 +219,7 @@ void CPPSourceEmitter::emitTypeDefinition(IRType* inType) case kIROp_VectorType: { auto vecType = static_cast<IRVectorType*>(type); - int count = int(GetIntVal(vecType->getElementCount())); + int count = int(getIntVal(vecType->getElementCount())); SLANG_ASSERT(count > 0 && count < 4); @@ -251,8 +251,8 @@ void CPPSourceEmitter::emitTypeDefinition(IRType* inType) { auto matType = static_cast<IRMatrixType*>(type); - const auto rowCount = int(GetIntVal(matType->getRowCount())); - const auto colCount = int(GetIntVal(matType->getColumnCount())); + const auto rowCount = int(getIntVal(matType->getRowCount())); + const auto colCount = int(getIntVal(matType->getColumnCount())); IRType* vecType = m_typeSet.addVectorType(matType->getElementType(), colCount); @@ -420,7 +420,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S case kIROp_VectorType: { auto vecType = static_cast<IRVectorType*>(type); - auto vecCount = int(GetIntVal(vecType->getElementCount())); + auto vecCount = int(getIntVal(vecType->getElementCount())); auto elemType = vecType->getElementType(); if (target == CodeGenTarget::CPPSource || target == CodeGenTarget::CUDASource) @@ -446,8 +446,8 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S auto matType = static_cast<IRMatrixType*>(type); auto elementType = matType->getElementType(); - const auto rowCount = int(GetIntVal(matType->getRowCount())); - const auto colCount = int(GetIntVal(matType->getColumnCount())); + const auto rowCount = int(getIntVal(matType->getRowCount())); + const auto colCount = int(getIntVal(matType->getColumnCount())); if (target == CodeGenTarget::CPPSource || target == CodeGenTarget::CUDASource) { @@ -471,7 +471,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S { auto arrayType = static_cast<IRArrayType*>(type); auto elementType = arrayType->getElementType(); - int elementCount = int(GetIntVal(arrayType->getElementCount())); + int elementCount = int(getIntVal(arrayType->getElementCount())); out << "FixedArray<"; SLANG_RETURN_ON_FAIL(calcTypeName(elementType, target, out)); @@ -606,14 +606,14 @@ static IRBasicType* _getElementType(IRType* type) case kIROp_VectorType: { auto vecType = static_cast<IRVectorType*>(type); - const int elemCount = int(GetIntVal(vecType->getElementCount())); + const int elemCount = int(getIntVal(vecType->getElementCount())); return (!vecSwap) ? TypeDimension{1, elemCount} : TypeDimension{ elemCount, 1}; } case kIROp_MatrixType: { auto matType = static_cast<IRMatrixType*>(type); - const int colCount = int(GetIntVal(matType->getColumnCount())); - const int rowCount = int(GetIntVal(matType->getRowCount())); + const int colCount = int(getIntVal(matType->getColumnCount())); + const int rowCount = int(getIntVal(matType->getRowCount())); return TypeDimension{rowCount, colCount}; } default: return TypeDimension{1, 1}; @@ -942,7 +942,7 @@ void CPPSourceEmitter::_emitGetAtDefinition(const UnownedStringSlice& funcName, if (auto vectorType = as<IRVectorType>(srcType)) { - int vecSize = int(GetIntVal(vectorType->getElementCount())); + int vecSize = int(getIntVal(vectorType->getElementCount())); writer->emit("assert(b >= 0 && b < "); writer->emit(vecSize); @@ -952,8 +952,8 @@ void CPPSourceEmitter::_emitGetAtDefinition(const UnownedStringSlice& funcName, } else if (auto matrixType = as<IRMatrixType>(srcType)) { - //int colCount = int(GetIntVal(matrixType->getColumnCount())); - int rowCount = int(GetIntVal(matrixType->getRowCount())); + //int colCount = int(getIntVal(matrixType->getColumnCount())); + int rowCount = int(getIntVal(matrixType->getRowCount())); writer->emit("assert(b >= 0 && b < "); writer->emit(rowCount); @@ -1083,7 +1083,7 @@ void CPPSourceEmitter::_emitInitDefinition(const UnownedStringSlice& funcName, c if (IRVectorType* vecType = as<IRVectorType>(retType)) { - Index elementCount = Index(GetIntVal(vecType->getElementCount())); + Index elementCount = Index(getIntVal(vecType->getElementCount())); Index paramIndex = 0; Index paramSubIndex = 0; @@ -1105,7 +1105,7 @@ void CPPSourceEmitter::_emitInitDefinition(const UnownedStringSlice& funcName, c if (IRVectorType* paramVecType = as<IRVectorType>(paramType)) { - Index paramElementCount = Index(GetIntVal(paramVecType->getElementCount())); + Index paramElementCount = Index(getIntVal(paramVecType->getElementCount())); writer->emitChar('a' + char(paramIndex)); writer->emit("."); diff --git a/source/slang/slang-emit-cuda.cpp b/source/slang/slang-emit-cuda.cpp index d8f910faa..639e7f737 100644 --- a/source/slang/slang-emit-cuda.cpp +++ b/source/slang/slang-emit-cuda.cpp @@ -160,7 +160,7 @@ SlangResult CUDASourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, case kIROp_VectorType: { auto vecType = static_cast<IRVectorType*>(type); - auto vecCount = int(GetIntVal(vecType->getElementCount())); + auto vecCount = int(getIntVal(vecType->getElementCount())); const IROp elemType = vecType->getElementType()->op; UnownedStringSlice prefix = getVectorPrefix(elemType); @@ -178,8 +178,8 @@ SlangResult CUDASourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, auto matType = static_cast<IRMatrixType*>(type); auto elementType = matType->getElementType(); - const auto rowCount = int(GetIntVal(matType->getRowCount())); - const auto colCount = int(GetIntVal(matType->getColumnCount())); + const auto rowCount = int(getIntVal(matType->getRowCount())); + const auto colCount = int(getIntVal(matType->getColumnCount())); out << "Matrix<" << getBuiltinTypeName(elementType->op) << ", " << rowCount << ", " << colCount << ">"; return SLANG_OK; @@ -312,7 +312,7 @@ void CUDASourceEmitter::emitCall(const HLSLIntrinsic* specOp, IRInst* inst, cons if (IRVectorType* vecType = as<IRVectorType>(retType)) { - if (numOperands == GetIntVal(vecType->getElementCount())) + if (numOperands == getIntVal(vecType->getElementCount())) { // Get the type name writer->emit("make_"); @@ -366,15 +366,15 @@ static bool _areEquivalent(IRType* a, IRType* b) { IRVectorType* vecA = static_cast<IRVectorType*>(a); IRVectorType* vecB = static_cast<IRVectorType*>(b); - return GetIntVal(vecA->getElementCount()) == GetIntVal(vecB->getElementCount()) && + return getIntVal(vecA->getElementCount()) == getIntVal(vecB->getElementCount()) && _areEquivalent(vecA->getElementType(), vecB->getElementType()); } case kIROp_MatrixType: { IRMatrixType* matA = static_cast<IRMatrixType*>(a); IRMatrixType* matB = static_cast<IRMatrixType*>(b); - return GetIntVal(matA->getColumnCount()) == GetIntVal(matB->getColumnCount()) && - GetIntVal(matA->getRowCount()) == GetIntVal(matB->getRowCount()) && + return getIntVal(matA->getColumnCount()) == getIntVal(matB->getColumnCount()) && + getIntVal(matA->getRowCount()) == getIntVal(matB->getRowCount()) && _areEquivalent(matA->getElementType(), matB->getElementType()); } default: @@ -401,7 +401,7 @@ void CUDASourceEmitter::_emitInitializerListValue(IRType* dstType, IRInst* value { if (auto vecType = as<IRVectorType>(type)) { - if (UInt(GetIntVal(vecType->getElementCount())) == value->getOperandCount()) + if (UInt(getIntVal(vecType->getElementCount())) == value->getOperandCount()) { _emitInitializerList(vecType->getElementType(), value->getOperands(), value->getOperandCount()); return; @@ -409,8 +409,8 @@ void CUDASourceEmitter::_emitInitializerListValue(IRType* dstType, IRInst* value } else if (auto matType = as<IRMatrixType>(type)) { - const Index colCount = Index(GetIntVal(matType->getColumnCount())); - const Index rowCount = Index(GetIntVal(matType->getRowCount())); + const Index colCount = Index(getIntVal(matType->getColumnCount())); + const Index rowCount = Index(getIntVal(matType->getRowCount())); // TODO(JS): If num cols = 1, then it *doesn't* actually return a vector. // That could be argued is an error because we want swizzling or [] to work. diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index ef7e557f6..18bb84e0e 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -797,7 +797,7 @@ void GLSLSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPoin { if (auto decor = irFunc->findDecoration<IRMaxVertexCountDecoration>()) { - auto count = GetIntVal(decor->getCount()); + auto count = getIntVal(decor->getCount()); m_writer->emit("layout(max_vertices = "); m_writer->emit(Int(count)); m_writer->emit(") out;\n"); @@ -805,7 +805,7 @@ void GLSLSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPoin if (auto decor = irFunc->findDecoration<IRInstanceDecoration>()) { - auto count = GetIntVal(decor->getCount()); + auto count = getIntVal(decor->getCount()); m_writer->emit("layout(invocations = "); m_writer->emit(Int(count)); m_writer->emit(") in;\n"); @@ -1594,7 +1594,7 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type) case kIROp_VectorType: { auto vecType = (IRVectorType*)type; - emitVectorTypeNameImpl(vecType->getElementType(), GetIntVal(vecType->getElementCount())); + emitVectorTypeNameImpl(vecType->getElementType(), getIntVal(vecType->getElementCount())); return; } case kIROp_MatrixType: diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index 338e99e68..5ebd7e9fc 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -27,7 +27,7 @@ void HLSLSourceEmitter::_emitHLSLDecorationSingleInt(const char* name, IRFunc* e SLANG_UNUSED(entryPoint); SLANG_ASSERT(val); - auto intVal = GetIntVal(val); + auto intVal = getIntVal(val); m_writer->emit("["); m_writer->emit(name); @@ -326,7 +326,7 @@ void HLSLSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPoin { if (auto decor = irFunc->findDecoration<IRMaxVertexCountDecoration>()) { - auto count = GetIntVal(decor->getCount()); + auto count = getIntVal(decor->getCount()); m_writer->emit("[maxvertexcount("); m_writer->emit(Int(count)); m_writer->emit(")]\n"); @@ -334,7 +334,7 @@ void HLSLSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPoin if (auto decor = irFunc->findDecoration<IRInstanceDecoration>()) { - auto count = GetIntVal(decor->getCount()); + auto count = getIntVal(decor->getCount()); m_writer->emit("[instance("); m_writer->emit(Int(count)); m_writer->emit(")]\n"); @@ -743,7 +743,7 @@ void HLSLSourceEmitter::emitSimpleTypeImpl(IRType* type) case kIROp_VectorType: { auto vecType = (IRVectorType*)type; - emitVectorTypeNameImpl(vecType->getElementType(), GetIntVal(vecType->getElementCount())); + emitVectorTypeNameImpl(vecType->getElementType(), getIntVal(vecType->getElementCount())); return; } case kIROp_MatrixType: diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 6c29485cd..63d46aa30 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -60,7 +60,7 @@ EntryPointLayout* findEntryPointLayout( for( auto entryPointLayout : programLayout->entryPoints ) { - if(entryPointLayout->entryPoint.GetName() != entryPoint->getName()) + if(entryPointLayout->entryPoint.getName() != entryPoint->getName()) continue; // TODO: We need to be careful about this check, since it relies on diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp index c7dfb242f..afb67a081 100644 --- a/source/slang/slang-ir-glsl-legalize.cpp +++ b/source/slang/slang-ir-glsl-legalize.cpp @@ -636,7 +636,7 @@ ScalarizedVal createSimpleGLSLGlobalVarying( // TODO: it is kind of gross to be re-running some // of the type layout logic here. - UInt elementCount = (UInt) GetIntVal(dd->elementCount); + UInt elementCount = (UInt) getIntVal(dd->elementCount); arrayTypeLayoutBuilder.addResourceUsage( kind, resInfo->getSize() * elementCount); @@ -1146,7 +1146,7 @@ IRInst* materializeTupleValue( // then use these to construct our result. List<IRInst*> arrayElementVals; - UInt arrayElementCount = (UInt) GetIntVal(arrayType->getElementCount()); + UInt arrayElementCount = (UInt) getIntVal(arrayType->getElementCount()); for( UInt ii = 0; ii < arrayElementCount; ++ii ) { diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h index 8b13f48a1..06a5c1412 100644 --- a/source/slang/slang-ir-insts.h +++ b/source/slang/slang-ir-insts.h @@ -285,7 +285,7 @@ struct IREntryPointDecoration : IRDecoration IR_LEAF_ISA(EntryPointDecoration) IRIntLit* getProfileInst() { return cast<IRIntLit>(getOperand(0)); } - Profile getProfile() { return Profile(Profile::RawVal(GetIntVal(getProfileInst()))); } + Profile getProfile() { return Profile(Profile::RawVal(getIntVal(getProfileInst()))); } IRStringLit* getName() { return cast<IRStringLit>(getOperand(1)); } }; @@ -435,7 +435,7 @@ struct IRSemanticDecoration : public IRDecoration UnownedStringSlice getSemanticName() { return getSemanticNameOperand()->getStringSlice(); } IRIntLit* getSemanticIndexOperand() { return cast<IRIntLit>(getOperand(1)); } - int getSemanticIndex() { return int(GetIntVal(getSemanticIndexOperand())); } + int getSemanticIndex() { return int(getIntVal(getSemanticIndexOperand())); } }; /// An attribute that can be attached to another instruction as an operand. @@ -465,7 +465,7 @@ struct IRLayoutResourceInfoAttr : public IRAttr IR_PARENT_ISA(LayoutResourceInfoAttr); IRIntLit* getResourceKindInst() { return cast<IRIntLit>(getOperand(0)); } - LayoutResourceKind getResourceKind() { return LayoutResourceKind(GetIntVal(getResourceKindInst())); } + LayoutResourceKind getResourceKind() { return LayoutResourceKind(getIntVal(getResourceKindInst())); } }; /// An attribute that specifies offset information for a single resource kind. @@ -479,7 +479,7 @@ struct IRVarOffsetAttr : public IRLayoutResourceInfoAttr IR_LEAF_ISA(VarOffsetAttr); IRIntLit* getOffsetInst() { return cast<IRIntLit>(getOperand(1)); } - UInt getOffset() { return UInt(GetIntVal(getOffsetInst())); } + UInt getOffset() { return UInt(getIntVal(getOffsetInst())); } IRIntLit* getSpaceInst() { @@ -491,7 +491,7 @@ struct IRVarOffsetAttr : public IRLayoutResourceInfoAttr UInt getSpace() { if(auto spaceInst = getSpaceInst()) - return UInt(GetIntVal(spaceInst)); + return UInt(getIntVal(spaceInst)); return 0; } }; @@ -502,7 +502,7 @@ struct IRTypeSizeAttr : public IRLayoutResourceInfoAttr IR_LEAF_ISA(TypeSizeAttr); IRIntLit* getSizeInst() { return cast<IRIntLit>(getOperand(1)); } - LayoutSize getSize() { return LayoutSize::fromRaw(LayoutSize::RawValue(GetIntVal(getSizeInst()))); } + LayoutSize getSize() { return LayoutSize::fromRaw(LayoutSize::RawValue(getIntVal(getSizeInst()))); } size_t getFiniteSize() { return getSize().getFiniteValue(); } }; @@ -764,7 +764,7 @@ struct IRMatrixTypeLayout : IRTypeLayout MatrixLayoutMode getMode() { - return MatrixLayoutMode(GetIntVal(cast<IRIntLit>(getOperand(0)))); + return MatrixLayoutMode(getIntVal(cast<IRIntLit>(getOperand(0)))); } struct Builder : Super::Builder @@ -880,7 +880,7 @@ struct IRTaggedUnionTypeLayout : IRTypeLayout /// Get the (byte) offset of the tagged union's tag (aka "discriminator") field LayoutSize getTagOffset() { - return LayoutSize::fromRaw(LayoutSize::RawValue(GetIntVal(cast<IRIntLit>(getOperand(0))))); + return LayoutSize::fromRaw(LayoutSize::RawValue(getIntVal(cast<IRIntLit>(getOperand(0))))); } /// Get all the attributes representing layouts for the difference cases @@ -962,7 +962,7 @@ struct IRStageAttr : IRAttr IR_LEAF_ISA(StageAttr); IRIntLit* getStageOperand() { return cast<IRIntLit>(getOperand(0)); } - Stage getStage() { return Stage(GetIntVal(getStageOperand())); } + Stage getStage() { return Stage(getIntVal(getStageOperand())); } }; /// Base type for attributes that associate a variable layout with a semantic name and index. @@ -974,7 +974,7 @@ struct IRSemanticAttr : IRAttr UnownedStringSlice getName() { return getNameOperand()->getStringSlice(); } IRIntLit* getIndexOperand() { return cast<IRIntLit>(getOperand(1)); } - UInt getIndex() { return UInt(GetIntVal(getIndexOperand())); } + UInt getIndex() { return UInt(getIntVal(getIndexOperand())); } }; /// Attribute that associates a variable with a system-value semantic name and index diff --git a/source/slang/slang-ir-type-set.cpp b/source/slang/slang-ir-type-set.cpp index e5271698c..047f9fb95 100644 --- a/source/slang/slang-ir-type-set.cpp +++ b/source/slang/slang-ir-type-set.cpp @@ -118,7 +118,7 @@ IRInst* IRTypeSet::cloneInst(IRInst* inst) case kIROp_VectorType: { auto vecType = static_cast<IRVectorType*>(inst); - const Index elementCount = Index(GetIntVal(vecType->getElementCount())); + const Index elementCount = Index(getIntVal(vecType->getElementCount())); if (elementCount <= 1) { @@ -129,8 +129,8 @@ IRInst* IRTypeSet::cloneInst(IRInst* inst) case kIROp_MatrixType: { auto matType = static_cast<IRMatrixType*>(inst); - const Index columnCount = Index(GetIntVal(matType->getColumnCount())); - const Index rowCount = Index(GetIntVal(matType->getRowCount())); + const Index columnCount = Index(getIntVal(matType->getColumnCount())); + const Index rowCount = Index(getIntVal(matType->getRowCount())); if (columnCount <= 1 && rowCount <= 1) { diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 57dac80b6..41d10b289 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -214,7 +214,7 @@ namespace Slang // IRConstant - IRIntegerValue GetIntVal(IRInst* inst) + IRIntegerValue getIntVal(IRInst* inst) { switch (inst->op) { diff --git a/source/slang/slang-ir.h b/source/slang/slang-ir.h index 9799201b3..dc0606644 100644 --- a/source/slang/slang-ir.h +++ b/source/slang/slang-ir.h @@ -714,7 +714,7 @@ struct IRBoolLit : IRConstant // Get the compile-time constant integer value of an instruction, // if it has one, and assert-fail otherwise. -IRIntegerValue GetIntVal(IRInst* inst); +IRIntegerValue getIntVal(IRInst* inst); struct IRStringLit : IRConstant { diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp index b174d068c..fae00c6a2 100644 --- a/source/slang/slang-lookup.cpp +++ b/source/slang/slang-lookup.cpp @@ -356,7 +356,7 @@ static void _lookUpMembersInSuperType( // The super-type in the constraint (e.g., `Foo` in `T : Foo`) // will tell us a type we should use for lookup. // - auto superType = GetSup(astBuilder, intermediateIsSuperConstraint); + auto superType = getSup(astBuilder, intermediateIsSuperConstraint); // // We will go ahead and perform lookup using `superType`, // after dealing with some details. @@ -422,7 +422,7 @@ static void _lookUpMembersInSuperTypeDeclImpl( // then the members it provides can only be discovered by looking // at the constraints that are placed on that type. - auto genericDeclRef = genericTypeParamDeclRef.GetParent().as<GenericDecl>(); + auto genericDeclRef = genericTypeParamDeclRef.getParent().as<GenericDecl>(); assert(genericDeclRef); for(auto constraintDeclRef : getMembersOfType<GenericTypeConstraintDecl>(genericDeclRef)) @@ -437,7 +437,7 @@ static void _lookUpMembersInSuperTypeDeclImpl( // We want constraints of the form `T : Foo` where `T` is the // generic parameter in question, and `Foo` is whatever we are // constraining it to. - auto subType = GetSub(astBuilder, constraintDeclRef); + auto subType = getSub(astBuilder, constraintDeclRef); auto subDeclRefType = as<DeclRefType>(subType); if(!subDeclRefType) continue; @@ -492,7 +492,7 @@ static void _lookUpMembersInSuperTypeDeclImpl( // directly with that type. // ensureDecl(request.semantics, aggTypeDeclRef.getDecl(), DeclCheckState::ReadyForLookup); - for(auto extDecl = GetCandidateExtensions(aggTypeDeclRef); extDecl; extDecl = extDecl->nextCandidateExtension) + for(auto extDecl = getCandidateExtensions(aggTypeDeclRef); extDecl; extDecl = extDecl->nextCandidateExtension) { // Note: In this case `extDecl` is an extension that was declared to apply // (conditionally) to `aggTypeDeclRef`, which is the decl-ref part of @@ -691,7 +691,7 @@ static void _lookUpInScopes( // declaration, then the `this` expression will have // a type that uses the "target type" of the `extension`. // - type = GetTargetType(astBuilder, extDeclRef); + type = getTargetType(astBuilder, extDeclRef); } else { diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index f612e4ade..bd05ae69a 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -1028,7 +1028,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower LoweredValInfo visitGenericParamIntVal(GenericParamIntVal* val) { return emitDeclRef(context, val->declRef, - lowerType(context, GetType(context->astBuilder, val->declRef))); + lowerType(context, getType(context->astBuilder, val->declRef))); } LoweredValInfo visitDeclaredSubtypeWitness(DeclaredSubtypeWitness* val) @@ -1179,14 +1179,14 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower // for emitting the signature of a `CallableDecl`, and we should // try to re-use that if at all possible. // - auto irParamType = lowerType(context, GetType(context->astBuilder, paramDeclRef)); + auto irParamType = lowerType(context, getType(context->astBuilder, paramDeclRef)); auto irParam = subBuilder->emitParam(irParamType); irParams.add(irParam); irParamTypes.add(irParamType); } - auto irResultType = lowerType(context, GetResultType(context->astBuilder, callableDeclRef)); + auto irResultType = lowerType(context, getResultType(context->astBuilder, callableDeclRef)); auto irFuncType = subBuilder->getFuncType( irParamTypes, @@ -1484,7 +1484,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower IRType* visitExtractExistentialType(ExtractExistentialType* type) { auto declRef = type->declRef; - auto existentialType = lowerType(context, GetType(context->astBuilder, declRef)); + auto existentialType = lowerType(context, getType(context->astBuilder, declRef)); IRInst* existentialVal = getSimpleVal(context, emitDeclRef(context, declRef, existentialType)); return getBuilder()->emitExtractExistentialType(existentialVal); } @@ -1492,7 +1492,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower LoweredValInfo visitExtractExistentialSubtypeWitness(ExtractExistentialSubtypeWitness* witness) { auto declRef = witness->declRef; - auto existentialType = lowerType(context, GetType(context->astBuilder, declRef)); + auto existentialType = lowerType(context, getType(context->astBuilder, declRef)); IRInst* existentialVal = getSimpleVal(context, emitDeclRef(context, declRef, existentialType)); return LoweredValInfo::simple(getBuilder()->emitExtractExistentialWitnessTable(existentialVal)); } @@ -1957,7 +1957,7 @@ RefPtr<Type> getThisParamTypeForContainer( } else if( auto extensionDeclRef = parentDeclRef.as<ExtensionDecl>() ) { - return GetTargetType(context->astBuilder, extensionDeclRef); + return getTargetType(context->astBuilder, extensionDeclRef); } return nullptr; @@ -1967,13 +1967,13 @@ RefPtr<Type> getThisParamTypeForCallable( IRGenContext* context, DeclRef<Decl> callableDeclRef) { - auto parentDeclRef = callableDeclRef.GetParent(); + auto parentDeclRef = callableDeclRef.getParent(); if(auto subscriptDeclRef = parentDeclRef.as<SubscriptDecl>()) - parentDeclRef = subscriptDeclRef.GetParent(); + parentDeclRef = subscriptDeclRef.getParent(); if(auto genericDeclRef = parentDeclRef.as<GenericDecl>()) - parentDeclRef = genericDeclRef.GetParent(); + parentDeclRef = genericDeclRef.getParent(); return getThisParamTypeForContainer(context, parentDeclRef); } @@ -2153,7 +2153,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> } else if (auto vectorType = as<VectorExpressionType>(type)) { - UInt elementCount = (UInt) GetIntVal(vectorType->elementCount); + UInt elementCount = (UInt) getIntVal(vectorType->elementCount); auto irDefaultValue = getSimpleVal(context, getDefaultVal(vectorType->elementType)); @@ -2167,7 +2167,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> } else if (auto matrixType = as<MatrixExpressionType>(type)) { - UInt rowCount = (UInt) GetIntVal(matrixType->getRowCount()); + UInt rowCount = (UInt) getIntVal(matrixType->getRowCount()); auto rowType = matrixType->getRowType(); @@ -2183,7 +2183,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> } else if (auto arrayType = as<ArrayExpressionType>(type)) { - UInt elementCount = (UInt) GetIntVal(arrayType->arrayLength); + UInt elementCount = (UInt) getIntVal(arrayType->arrayLength); auto irDefaultElement = getSimpleVal(context, getDefaultVal(arrayType->baseType)); @@ -2251,7 +2251,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> // fill in the appropriate field of the result if (auto arrayType = as<ArrayExpressionType>(type)) { - UInt elementCount = (UInt) GetIntVal(arrayType->arrayLength); + UInt elementCount = (UInt) getIntVal(arrayType->arrayLength); for (UInt ee = 0; ee < argCount; ++ee) { @@ -2273,7 +2273,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> } else if (auto vectorType = as<VectorExpressionType>(type)) { - UInt elementCount = (UInt) GetIntVal(vectorType->elementCount); + UInt elementCount = (UInt) getIntVal(vectorType->elementCount); for (UInt ee = 0; ee < argCount; ++ee) { @@ -2295,7 +2295,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> } else if (auto matrixType = as<MatrixExpressionType>(type)) { - UInt rowCount = (UInt) GetIntVal(matrixType->getRowCount()); + UInt rowCount = (UInt) getIntVal(matrixType->getRowCount()); for (UInt rr = 0; rr < argCount; ++rr) { @@ -2518,7 +2518,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> for (auto paramDeclRef : getMembersOfType<ParamDecl>(funcDeclRef)) { auto paramDecl = paramDeclRef.getDecl(); - IRType* paramType = lowerType(context, GetType(getASTBuilder(), paramDeclRef)); + IRType* paramType = lowerType(context, getType(getASTBuilder(), paramDeclRef)); auto paramDirection = getParameterDirection(paramDecl); UInt argIndex = argCounter++; @@ -2883,7 +2883,7 @@ struct ExprLoweringVisitorBase : ExprVisitor<Derived, LoweredValInfo> LoweredValInfo visitExtractExistentialValueExpr(ExtractExistentialValueExpr* expr) { - auto existentialType = lowerType(context, GetType(getASTBuilder(), expr->declRef)); + auto existentialType = lowerType(context, getType(getASTBuilder(), expr->declRef)); auto existentialVal = getSimpleVal(context, emitDeclRef(context, expr->declRef, existentialType)); auto openedType = lowerType(context, expr->type); @@ -3049,8 +3049,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // ordinary loop, with an `[unroll]` attribute on // it that we would respect. - auto rangeBeginVal = GetIntVal(stmt->rangeBeginVal); - auto rangeEndVal = GetIntVal(stmt->rangeEndVal); + auto rangeBeginVal = getIntVal(stmt->rangeBeginVal); + auto rangeEndVal = getIntVal(stmt->rangeEndVal); if (rangeBeginVal >= rangeEndVal) return; diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index 5e141228d..758e1d6f1 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -135,7 +135,7 @@ namespace Slang } else if( auto namedType = dynamicCast<NamedExpressionType>(type) ) { - emitType(context, GetType(context->astBuilder, namedType->declRef)); + emitType(context, getType(context->astBuilder, namedType->declRef)); } else if( auto declRefType = dynamicCast<DeclRefType>(type) ) { @@ -201,7 +201,7 @@ namespace Slang // "depth" (how many outer generics) and "index" (which // parameter are they at the specified depth). emitRaw(context, "K"); - emitName(context, genericParamIntVal->declRef.GetName()); + emitName(context, genericParamIntVal->declRef.getName()); } else if( auto constantIntVal = dynamicCast<ConstantIntVal>(val) ) { @@ -220,7 +220,7 @@ namespace Slang ManglingContext* context, DeclRef<Decl> declRef) { - auto parentDeclRef = declRef.GetParent(); + auto parentDeclRef = declRef.getParent(); auto parentGenericDeclRef = parentDeclRef.as<GenericDecl>(); if( parentDeclRef ) { @@ -251,7 +251,7 @@ namespace Slang if(auto inheritanceDeclRef = declRef.as<InheritanceDecl>()) { emit(context, "I"); - emitType(context, GetSup(context->astBuilder, inheritanceDeclRef)); + emitType(context, getSup(context->astBuilder, inheritanceDeclRef)); return; } @@ -264,11 +264,11 @@ namespace Slang // that is in the same module as the type it extends should // be treated as equivalent to the type itself. emit(context, "X"); - emitType(context, GetTargetType(context->astBuilder, extensionDeclRef)); + emitType(context, getTargetType(context->astBuilder, extensionDeclRef)); return; } - emitName(context, declRef.GetName()); + emitName(context, declRef.getName()); // Special case: accessors need some way to distinguish themselves // so that a getter/setter/ref-er don't all compile to the same name. @@ -339,7 +339,7 @@ namespace Slang else if(auto genericValueParamDecl = mm.as<GenericValueParamDecl>()) { emitRaw(context, "v"); - emitType(context, GetType(context->astBuilder, genericValueParamDecl)); + emitType(context, getType(context->astBuilder, genericValueParamDecl)); } else if(mm.as<GenericTypeConstraintDecl>()) { @@ -362,7 +362,7 @@ namespace Slang // if( auto callableDeclRef = declRef.as<CallableDecl>()) { - auto parameters = GetParameters(callableDeclRef); + auto parameters = getParameters(callableDeclRef); UInt parameterCount = parameters.getCount(); emitRaw(context, "p"); @@ -371,14 +371,14 @@ namespace Slang for(auto paramDeclRef : parameters) { - emitType(context, GetType(context->astBuilder, paramDeclRef)); + emitType(context, getType(context->astBuilder, paramDeclRef)); } // Don't print result type for an initializer/constructor, // since it is implicit in the qualified name. if (!callableDeclRef.is<ConstructorDecl>()) { - emitType(context, GetResultType(context->astBuilder, callableDeclRef)); + emitType(context, getResultType(context->astBuilder, callableDeclRef)); } } } diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index c4f7dc9d5..58ce76c45 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -707,7 +707,7 @@ static void collectGlobalScopeParameter( auto varDeclRef = shaderParamInfo.paramDeclRef; // We apply any substitutions for global generic parameters here. - auto type = GetType(astBuilder, varDeclRef)->substitute(astBuilder, globalGenericSubst).as<Type>(); + auto type = getType(astBuilder, varDeclRef)->substitute(astBuilder, globalGenericSubst).as<Type>(); // We use a single operation to both check whether the // variable represents a shader parameter, and to compute @@ -951,7 +951,7 @@ static void maybeDiagnoseMissingVulkanLayoutModifier( // oversight on their part. if( auto registerModifier = varDecl.getDecl()->findModifier<HLSLRegisterSemantic>() ) { - getSink(context)->diagnose(registerModifier, Diagnostics::registerModifierButNoVulkanLayout, varDecl.GetName()); + getSink(context)->diagnose(registerModifier, Diagnostics::registerModifierButNoVulkanLayout, varDecl.getName()); } } @@ -1007,7 +1007,7 @@ static void addExplicitParameterBindings_GLSL( } if( attr->binding != 0) { - getSink(context)->diagnose(attr, Diagnostics::wholeSpaceParameterRequiresZeroBinding, varDecl.GetName(), attr->binding); + getSink(context)->diagnose(attr, Diagnostics::wholeSpaceParameterRequiresZeroBinding, varDecl.getName(), attr->binding); } semanticInfo.index = attr->set; semanticInfo.space = 0; @@ -1852,7 +1852,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter( // A matrix is processed as if it was an array of rows else if( auto matrixType = as<MatrixExpressionType>(type) ) { - auto rowCount = GetIntVal(matrixType->getRowCount()); + auto rowCount = getIntVal(matrixType->getRowCount()); return processSimpleEntryPointParameter(context, matrixType, state, varLayout, (int) rowCount); } else if( auto arrayType = as<ArrayExpressionType>(type) ) @@ -1860,7 +1860,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter( // Note: Bad Things will happen if we have an array input // without a semantic already being enforced. - auto elementCount = (UInt) GetIntVal(arrayType->arrayLength); + auto elementCount = (UInt) getIntVal(arrayType->arrayLength); // We use the first element to derive the layout for the element type auto elementTypeLayout = processEntryPointVaryingParameter(context, arrayType->baseType, state, varLayout); @@ -1915,7 +1915,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter( // Decl* firstExplicit = nullptr; Decl* firstImplicit = nullptr; - for( auto field : GetFields(structDeclRef, MemberFilterStyle::Instance) ) + for( auto field : getFields(structDeclRef, MemberFilterStyle::Instance) ) { RefPtr<VarLayout> fieldVarLayout = new VarLayout(); fieldVarLayout->varDecl = field; @@ -1926,7 +1926,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter( auto fieldTypeLayout = processEntryPointVaryingParameterDecl( context, field.getDecl(), - GetType(context->getASTBuilder(), field), + getType(context->getASTBuilder(), field), state, fieldVarLayout); @@ -2043,7 +2043,7 @@ static RefPtr<TypeLayout> computeEntryPointParameterTypeLayout( RefPtr<VarLayout> paramVarLayout, EntryPointParameterState& state) { - auto paramType = GetType(context->getASTBuilder(), paramDeclRef); + auto paramType = getType(context->getASTBuilder(), paramDeclRef); SLANG_ASSERT(paramType); if( paramDeclRef.getDecl()->hasModifier<HLSLUniformModifier>() ) @@ -2581,7 +2581,7 @@ static RefPtr<EntryPointLayout> collectEntryPointParameters( // TODO: Ideally we should make the layout process more robust to empty/void // types and apply this logic unconditionally. // - auto resultType = GetResultType(astBuilder, entryPointFuncDeclRef); + auto resultType = getResultType(astBuilder, entryPointFuncDeclRef); SLANG_ASSERT(resultType); if( !resultType->equals(astBuilder->getVoidType()) ) diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp index 23d006b3f..23831d498 100644 --- a/source/slang/slang-reflection.cpp +++ b/source/slang/slang-reflection.cpp @@ -304,7 +304,7 @@ SLANG_API unsigned int spReflectionType_GetFieldCount(SlangReflectionType* inTyp auto declRef = declRefType->declRef; if( auto structDeclRef = declRef.as<StructDecl>()) { - return (unsigned int)GetFields(structDeclRef, MemberFilterStyle::Instance).getCount(); + return (unsigned int)getFields(structDeclRef, MemberFilterStyle::Instance).getCount(); } } @@ -323,7 +323,7 @@ SLANG_API SlangReflectionVariable* spReflectionType_GetFieldByIndex(SlangReflect auto declRef = declRefType->declRef; if( auto structDeclRef = declRef.as<StructDecl>()) { - auto fields = GetFields(structDeclRef, MemberFilterStyle::Instance); + auto fields = getFields(structDeclRef, MemberFilterStyle::Instance); auto fieldDeclRef = fields[index]; return (SlangReflectionVariable*) fieldDeclRef.getDecl(); } @@ -339,11 +339,11 @@ SLANG_API size_t spReflectionType_GetElementCount(SlangReflectionType* inType) if(auto arrayType = as<ArrayExpressionType>(type)) { - return arrayType->arrayLength ? (size_t) GetIntVal(arrayType->arrayLength) : 0; + return arrayType->arrayLength ? (size_t) getIntVal(arrayType->arrayLength) : 0; } else if( auto vectorType = as<VectorExpressionType>(type)) { - return (size_t) GetIntVal(vectorType->elementCount); + return (size_t) getIntVal(vectorType->elementCount); } return 0; @@ -381,7 +381,7 @@ SLANG_API unsigned int spReflectionType_GetRowCount(SlangReflectionType* inType) if(auto matrixType = as<MatrixExpressionType>(type)) { - return (unsigned int) GetIntVal(matrixType->getRowCount()); + return (unsigned int) getIntVal(matrixType->getRowCount()); } else if(auto vectorType = as<VectorExpressionType>(type)) { @@ -402,11 +402,11 @@ SLANG_API unsigned int spReflectionType_GetColumnCount(SlangReflectionType* inTy if(auto matrixType = as<MatrixExpressionType>(type)) { - return (unsigned int) GetIntVal(matrixType->getColumnCount()); + return (unsigned int) getIntVal(matrixType->getColumnCount()); } else if(auto vectorType = as<VectorExpressionType>(type)) { - return (unsigned int) GetIntVal(vectorType->elementCount); + return (unsigned int) getIntVal(vectorType->elementCount); } else if( auto basicType = as<BasicExpressionType>(type) ) { @@ -585,7 +585,7 @@ SLANG_API char const* spReflectionType_GetName(SlangReflectionType* inType) if(decl->hasModifier<ImplicitParameterGroupElementTypeModifier>()) return nullptr; - return getText(declRef.GetName()).begin(); + return getText(declRef.getName()).begin(); } return nullptr; @@ -1498,7 +1498,7 @@ SLANG_API SlangReflectionEntryPoint* spReflection_findEntryPointByName(SlangRefl // TODO: improve on naive linear search for(auto ep : program->entryPoints) { - if(ep->entryPoint.GetName()->text == name) + if(ep->entryPoint.getName()->text == name) { return convert(ep); } diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 54d27bd57..e7876fa04 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -926,7 +926,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt String NamedExpressionType::toString() { - return getText(declRef.GetName()); + return getText(declRef.getName()); } bool NamedExpressionType::equalsImpl(Type * /*type*/) @@ -938,7 +938,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt RefPtr<Type> NamedExpressionType::createCanonicalType() { if (!innerType) - innerType = GetType(m_astBuilder, declRef); + innerType = getType(m_astBuilder, declRef); return innerType->getCanonicalType(); } @@ -1233,7 +1233,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt String GenericParamIntVal::toString() { - return getText(declRef.GetName()); + return getText(declRef.getName()); } HashCode GenericParamIntVal::getHashCode() @@ -1891,7 +1891,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } // Convenience accessors for common properties of declarations - Name* DeclRefBase::GetName() const + Name* DeclRefBase::getName() const { return decl->nameAndLoc.name; } @@ -1901,7 +1901,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return decl->loc; } - DeclRefBase DeclRefBase::GetParent() const + DeclRefBase DeclRefBase::getParent() const { // Want access to the free function (the 'as' method by default gets priority) // Can access as method with this->as because it removes any ambiguity. @@ -1974,7 +1974,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // IntVal - IntegerLiteralValue GetIntVal(RefPtr<IntVal> val) + IntegerLiteralValue getIntVal(RefPtr<IntVal> val) { if (auto constantVal = as<ConstantIntVal>(val)) { @@ -2057,11 +2057,11 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt { RefPtr<FuncType> funcType = astBuilder->create<FuncType>(); - funcType->resultType = GetResultType(astBuilder, declRef); - for (auto paramDeclRef : GetParameters(declRef)) + funcType->resultType = getResultType(astBuilder, declRef); + for (auto paramDeclRef : getParameters(declRef)) { auto paramDecl = paramDeclRef.getDecl(); - auto paramType = GetType(astBuilder, paramDeclRef); + auto paramType = getType(astBuilder, paramDeclRef); if( paramDecl->findModifier<RefModifier>() ) { paramType = astBuilder->getRefType(paramType); diff --git a/source/slang/slang-syntax.h b/source/slang/slang-syntax.h index 266f27599..dff24435d 100644 --- a/source/slang/slang-syntax.h +++ b/source/slang/slang-syntax.h @@ -6,12 +6,12 @@ namespace Slang { - inline RefPtr<Type> GetSub(ASTBuilder* astBuilder, DeclRef<GenericTypeConstraintDecl> const& declRef) + inline RefPtr<Type> getSub(ASTBuilder* astBuilder, DeclRef<GenericTypeConstraintDecl> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->sub.Ptr()); } - inline RefPtr<Type> GetSup(ASTBuilder* astBuilder, DeclRef<TypeConstraintDecl> const& declRef) + inline RefPtr<Type> getSup(ASTBuilder* astBuilder, DeclRef<TypeConstraintDecl> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->getSup().type); } @@ -27,13 +27,13 @@ namespace Slang // - inline BaseType GetVectorBaseType(VectorExpressionType* vecType) + inline BaseType getVectorBaseType(VectorExpressionType* vecType) { auto basicExprType = as<BasicExpressionType>(vecType->elementType); return basicExprType->baseType; } - inline int GetVectorSize(VectorExpressionType* vecType) + inline int getVectorSize(VectorExpressionType* vecType) { auto constantVal = as<ConstantIntVal>(vecType->elementCount); if (constantVal) @@ -46,7 +46,7 @@ namespace Slang // Declarations // - inline ExtensionDecl* GetCandidateExtensions(DeclRef<AggTypeDecl> const& declRef) + inline ExtensionDecl* getCandidateExtensions(DeclRef<AggTypeDecl> const& declRef) { return declRef.getDecl()->candidateExtensions; } @@ -70,7 +70,7 @@ namespace Slang rs.add(d); if (auto aggDeclRef = declRef.as<AggTypeDecl>()) { - for (auto ext = GetCandidateExtensions(aggDeclRef); ext; ext = ext->nextCandidateExtension) + for (auto ext = getCandidateExtensions(aggDeclRef); ext; ext = ext->nextCandidateExtension) { auto extMembers = getMembersOfType<T>(DeclRef<ContainerDecl>(ext, declRef.substitutions), filterStyle); for (auto mbr : extMembers) @@ -95,7 +95,7 @@ namespace Slang /// Name* getReflectionName(VarDeclBase* varDecl); - inline RefPtr<Type> GetType(ASTBuilder* astBuilder, DeclRef<VarDeclBase> const& declRef) + inline RefPtr<Type> getType(ASTBuilder* astBuilder, DeclRef<VarDeclBase> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->type.Ptr()); } @@ -115,12 +115,12 @@ namespace Slang return declRef.substitute(astBuilder, declRef.getDecl()->tagExpr); } - inline RefPtr<Type> GetTargetType(ASTBuilder* astBuilder, DeclRef<ExtensionDecl> const& declRef) + inline RefPtr<Type> getTargetType(ASTBuilder* astBuilder, DeclRef<ExtensionDecl> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->targetType.Ptr()); } - inline FilteredMemberRefList<VarDecl> GetFields(DeclRef<StructDecl> const& declRef, MemberFilterStyle filterStyle) + inline FilteredMemberRefList<VarDecl> getFields(DeclRef<StructDecl> const& declRef, MemberFilterStyle filterStyle) { return getMembersOfType<VarDecl>(declRef, filterStyle); } @@ -132,22 +132,22 @@ namespace Slang return declRef.substitute(astBuilder, declRef.getDecl()->base.type); } - inline RefPtr<Type> GetType(ASTBuilder* astBuilder, DeclRef<TypeDefDecl> const& declRef) + inline RefPtr<Type> getType(ASTBuilder* astBuilder, DeclRef<TypeDefDecl> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->type.Ptr()); } - inline RefPtr<Type> GetResultType(ASTBuilder* astBuilder, DeclRef<CallableDecl> const& declRef) + inline RefPtr<Type> getResultType(ASTBuilder* astBuilder, DeclRef<CallableDecl> const& declRef) { return declRef.substitute(astBuilder, declRef.getDecl()->returnType.type.Ptr()); } - inline FilteredMemberRefList<ParamDecl> GetParameters(DeclRef<CallableDecl> const& declRef) + inline FilteredMemberRefList<ParamDecl> getParameters(DeclRef<CallableDecl> const& declRef) { return getMembersOfType<ParamDecl>(declRef); } - inline Decl* GetInner(DeclRef<GenericDecl> const& declRef) + inline Decl* getInner(DeclRef<GenericDecl> const& declRef) { // TODO: Should really return a `DeclRef<Decl>` for the inner // declaration, and not just a raw pointer @@ -192,11 +192,11 @@ namespace Slang template<typename T> void FilteredModifierList<T>::Iterator::operator++() { - current = Adjust(current->next.Ptr()); + current = adjust(current->next.Ptr()); } // template<typename T> - Modifier* FilteredModifierList<T>::Adjust(Modifier* modifier) + Modifier* FilteredModifierList<T>::adjust(Modifier* modifier) { Modifier* m = modifier; for (;;) diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 3f005f18e..f26b8bda4 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -3170,7 +3170,7 @@ static TypeLayoutResult _createTypeLayout( else if(auto vecType = as<VectorExpressionType>(type)) { auto elementType = vecType->elementType; - size_t elementCount = (size_t) GetIntVal(vecType->elementCount); + size_t elementCount = (size_t) getIntVal(vecType->elementCount); auto element = _createTypeLayout( context, @@ -3198,8 +3198,8 @@ static TypeLayoutResult _createTypeLayout( } else if(auto matType = as<MatrixExpressionType>(type)) { - size_t rowCount = (size_t) GetIntVal(matType->getRowCount()); - size_t colCount = (size_t) GetIntVal(matType->getColumnCount()); + size_t rowCount = (size_t) getIntVal(matType->getRowCount()); + size_t colCount = (size_t) getIntVal(matType->getColumnCount()); auto elementType = matType->getElementType(); auto elementResult = _createTypeLayout( @@ -3439,7 +3439,7 @@ static TypeLayoutResult _createTypeLayout( typeLayoutBuilder.beginLayout(type, rules); auto typeLayout = typeLayoutBuilder.getTypeLayout(); - for (auto field : GetFields(structDeclRef, MemberFilterStyle::Instance)) + for (auto field : getFields(structDeclRef, MemberFilterStyle::Instance)) { // The fields of a `struct` type may include existential (interface) // types (including as nested sub-fields), and any types present @@ -3463,7 +3463,7 @@ static TypeLayoutResult _createTypeLayout( TypeLayoutResult fieldResult = _createTypeLayout( fieldLayoutContext, - GetType(context.astBuilder, field).Ptr(), + getType(context.astBuilder, field).Ptr(), field.getDecl()); auto fieldTypeLayout = fieldResult.layout; @@ -3788,7 +3788,7 @@ RefPtr<TypeLayout> getSimpleVaryingParameterTypeLayout( else if(auto vecType = as<VectorExpressionType>(type)) { auto elementType = vecType->elementType; - size_t elementCount = (size_t) GetIntVal(vecType->elementCount); + size_t elementCount = (size_t) getIntVal(vecType->elementCount); BaseType elementBaseType = BaseType::Void; if( auto elementBasicType = as<BasicExpressionType>(elementType) ) @@ -3822,8 +3822,8 @@ RefPtr<TypeLayout> getSimpleVaryingParameterTypeLayout( } else if(auto matType = as<MatrixExpressionType>(type)) { - size_t rowCount = (size_t) GetIntVal(matType->getRowCount()); - size_t colCount = (size_t) GetIntVal(matType->getColumnCount()); + size_t rowCount = (size_t) getIntVal(matType->getRowCount()); + size_t colCount = (size_t) getIntVal(matType->getColumnCount()); auto elementType = matType->getElementType(); BaseType elementBaseType = BaseType::Void; |
