summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-ast-base.h20
-rw-r--r--source/slang/slang-ast-decl.h2
-rw-r--r--source/slang/slang-ast-support-types.h30
-rw-r--r--source/slang/slang-ast-type.h58
-rw-r--r--source/slang/slang-ast-val.h16
-rw-r--r--source/slang/slang-check-decl.cpp2
-rw-r--r--source/slang/slang-check-impl.h8
-rw-r--r--source/slang/slang-check-overload.cpp2
-rw-r--r--source/slang/slang-check-stmt.cpp2
-rw-r--r--source/slang/slang-check-type.cpp2
-rw-r--r--source/slang/slang-check.cpp4
-rw-r--r--source/slang/slang-compiler.cpp2
-rw-r--r--source/slang/slang-emit-c-like.cpp2
-rw-r--r--source/slang/slang-emit-glsl.cpp3
-rw-r--r--source/slang/slang-emit-hlsl.cpp3
-rw-r--r--source/slang/slang-file-system.cpp4
-rw-r--r--source/slang/slang-hlsl-intrinsic-set.h4
-rw-r--r--source/slang/slang-ir-clone.cpp6
-rw-r--r--source/slang/slang-ir-clone.h4
-rw-r--r--source/slang/slang-ir-insts.h4
-rw-r--r--source/slang/slang-ir.cpp24
-rw-r--r--source/slang/slang-ir.h2
-rw-r--r--source/slang/slang-lookup.cpp2
-rw-r--r--source/slang/slang-lower-to-ir.cpp4
-rw-r--r--source/slang/slang-mangle.cpp4
-rw-r--r--source/slang/slang-reflection.cpp3
-rw-r--r--source/slang/slang-source-loc.h2
-rw-r--r--source/slang/slang-state-serialize.cpp16
-rw-r--r--source/slang/slang-syntax.cpp181
-rw-r--r--source/slang/slang.cpp4
30 files changed, 206 insertions, 214 deletions
diff --git a/source/slang/slang-ast-base.h b/source/slang/slang-ast-base.h
index 373f38018..ffa065323 100644
--- a/source/slang/slang-ast-base.h
+++ b/source/slang/slang-ast-base.h
@@ -89,7 +89,7 @@ class Val : public NodeBase
virtual bool equalsVal(Val* val) = 0;
virtual String toString() = 0;
- virtual int GetHashCode() = 0;
+ virtual HashCode getHashCode() = 0;
bool operator == (const Val & v)
{
return equalsVal(const_cast<Val*>(&v));
@@ -141,7 +141,7 @@ public:
protected:
virtual bool equalsImpl(Type* type) = 0;
- virtual RefPtr<Type> CreateCanonicalType() = 0;
+ virtual RefPtr<Type> createCanonicalType() = 0;
Type* canonicalType = nullptr;
SLANG_UNREFLECTED
@@ -167,7 +167,7 @@ class Substitutions: public RefObject
// Check if these are equivalent substitutions to another set
virtual bool equals(Substitutions* subst) = 0;
- virtual int GetHashCode() const = 0;
+ virtual HashCode getHashCode() const = 0;
};
class GenericSubstitution : public Substitutions
@@ -187,12 +187,12 @@ class GenericSubstitution : public Substitutions
// Check if these are equivalent substitutions to another set
virtual bool equals(Substitutions* subst) override;
- virtual int GetHashCode() const override
+ virtual HashCode getHashCode() const override
{
- int rs = 0;
+ HashCode rs = 0;
for (auto && v : args)
{
- rs ^= v->GetHashCode();
+ rs ^= v->getHashCode();
rs *= 16777619;
}
return rs;
@@ -217,7 +217,7 @@ class ThisTypeSubstitution : public Substitutions
// Check if these are equivalent substitutions to another set
virtual bool equals(Substitutions* subst) override;
- virtual int GetHashCode() const override;
+ virtual HashCode getHashCode() const override;
};
class GlobalGenericParamSubstitution : public Substitutions
@@ -244,12 +244,12 @@ class GlobalGenericParamSubstitution : public Substitutions
// Check if these are equivalent substitutions to another set
virtual bool equals(Substitutions* subst) override;
- virtual int GetHashCode() const override
+ virtual HashCode getHashCode() const override
{
- int rs = actualType->GetHashCode();
+ HashCode rs = actualType->getHashCode();
for (auto && a : constraintArgs)
{
- rs = combineHash(rs, a.val->GetHashCode());
+ rs = combineHash(rs, a.val->getHashCode());
}
return rs;
}
diff --git a/source/slang/slang-ast-decl.h b/source/slang/slang-ast-decl.h
index 1e7287e56..54e8ac18b 100644
--- a/source/slang/slang-ast-decl.h
+++ b/source/slang/slang-ast-decl.h
@@ -155,7 +155,7 @@ class EnumCaseDecl : public Decl
// type of the parent `enum`
TypeExp type;
- Type* getType() { return (Type*)type.type.Ptr(); }
+ Type* getType() { return type.type.Ptr(); }
// Tag value
RefPtr<Expr> tagExpr;
diff --git a/source/slang/slang-ast-support-types.h b/source/slang/slang-ast-support-types.h
index fdcc34ea2..af5689a5c 100644
--- a/source/slang/slang-ast-support-types.h
+++ b/source/slang/slang-ast-support-types.h
@@ -606,8 +606,8 @@ namespace Slang
: substitutions(subst)
{
}
- bool Equals(const SubstitutionSet& substSet) const;
- int GetHashCode() const;
+ bool equals(const SubstitutionSet& substSet) const;
+ HashCode getHashCode() const;
};
template<typename T>
@@ -663,10 +663,10 @@ namespace Slang
DeclRef<T> as() const;
// Check if this is an equivalent declaration reference to another
- bool Equals(DeclRefBase const& declRef) const;
+ bool equals(DeclRefBase const& declRef) const;
bool operator == (const DeclRefBase& other) const
{
- return Equals(other);
+ return equals(other);
}
// Convenience accessors for common properties of declarations
@@ -674,7 +674,7 @@ namespace Slang
SourceLoc getLoc() const;
DeclRefBase GetParent() const;
- int GetHashCode() const;
+ HashCode getHashCode() const;
// Debugging:
String toString() const;
@@ -961,6 +961,8 @@ namespace Slang
// We store both the original syntax and the resolved type here.
struct TypeExp
{
+ typedef TypeExp ThisType;
+
TypeExp() {}
TypeExp(TypeExp const& other)
: exp(other.exp)
@@ -980,18 +982,8 @@ namespace Slang
RefPtr<Expr> exp;
RefPtr<Type> type;
- bool Equals(Type* other);
-#if 0
- {
- return type->Equals(other);
- }
-#endif
- bool Equals(RefPtr<Type> other);
-#if 0
- {
- return type->Equals(other.Ptr());
- }
-#endif
+ bool equals(Type* other);
+
Type* Ptr() { return type.Ptr(); }
operator Type*()
{
@@ -999,7 +991,9 @@ namespace Slang
}
Type* operator->() { return Ptr(); }
- TypeExp Accept(SyntaxVisitor* visitor);
+ ThisType& operator=(const ThisType& rhs) = default;
+
+ //TypeExp accept(SyntaxVisitor* visitor);
/// A global immutable TypeExp, that has no type or exp set.
static const TypeExp empty;
diff --git a/source/slang/slang-ast-type.h b/source/slang/slang-ast-type.h
index ccb3a3e0e..a1ed29b8a 100644
--- a/source/slang/slang-ast-type.h
+++ b/source/slang/slang-ast-type.h
@@ -18,8 +18,8 @@ public:
protected:
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// The type of an initializer-list expression (before it has
@@ -32,8 +32,8 @@ class InitializerListType : public Type
protected:
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// The type of an expression that was erroneous
@@ -47,8 +47,8 @@ public:
protected:
virtual bool equalsImpl(Type * type) override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// A type that takes the form of a reference to some declaration
@@ -72,9 +72,9 @@ class DeclRefType : public Type
: declRef(declRef)
{}
protected:
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual RefPtr<Type> createCanonicalType() override;
};
// Base class for types that can be used in arithmetic expressions
@@ -101,7 +101,7 @@ class BasicExpressionType : public ArithmeticExpressionType
protected:
virtual BasicExpressionType* GetScalarType() override;
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual RefPtr<Type> createCanonicalType() override;
};
@@ -397,9 +397,9 @@ class ArrayExpressionType : public Type
protected:
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual RefPtr<Type> createCanonicalType() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
};
// The "type" of an expression that resolves to a type.
@@ -423,8 +423,8 @@ public:
protected:
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// A vector type, e.g., `vector<T,N>`
@@ -540,8 +540,8 @@ class NamedExpressionType : public Type
protected:
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// A function type is defined by its parameter types
@@ -570,8 +570,8 @@ class FuncType : public Type
protected:
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
virtual bool equalsImpl(Type * type) override;
- virtual RefPtr<Type> CreateCanonicalType() override;
- virtual int GetHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
+ virtual HashCode getHashCode() override;
};
// The "type" of an expression that names a generic declaration.
@@ -594,8 +594,8 @@ class GenericDeclRefType : public Type
protected:
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
};
// The "type" of a reference to a module or namespace
@@ -614,8 +614,8 @@ class NamespaceType : public Type
protected:
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
};
// The concrete type for a value wrapped in an existential, accessible
@@ -628,8 +628,8 @@ class ExtractExistentialType : public Type
virtual String toString() override;
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
@@ -647,8 +647,8 @@ class TaggedUnionType : public Type
virtual String toString() override;
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
@@ -661,8 +661,8 @@ class ExistentialSpecializedType : public Type
virtual String toString() override;
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
@@ -675,8 +675,8 @@ class ThisType : public Type
virtual String toString() override;
virtual bool equalsImpl(Type * type) override;
- virtual int GetHashCode() override;
- virtual RefPtr<Type> CreateCanonicalType() override;
+ virtual HashCode getHashCode() override;
+ virtual RefPtr<Type> createCanonicalType() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
diff --git a/source/slang/slang-ast-val.h b/source/slang/slang-ast-val.h
index dcfbb3833..a6425e060 100644
--- a/source/slang/slang-ast-val.h
+++ b/source/slang/slang-ast-val.h
@@ -29,7 +29,7 @@ class ConstantIntVal : public IntVal
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
};
// The logical "value" of a rererence to a generic value parameter
@@ -47,7 +47,7 @@ class GenericParamIntVal : public IntVal
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
@@ -65,7 +65,7 @@ class ErrorIntVal : public IntVal
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int* ioDiff) override;
};
@@ -127,7 +127,7 @@ class TypeEqualityWitness : public SubtypeWitness
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int * ioDiff) override;
};
@@ -141,7 +141,7 @@ class DeclaredSubtypeWitness : public SubtypeWitness
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int * ioDiff) override;
};
@@ -158,7 +158,7 @@ class TransitiveSubtypeWitness : public SubtypeWitness
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int * ioDiff) override;
};
@@ -173,7 +173,7 @@ class ExtractExistentialSubtypeWitness : public SubtypeWitness
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int * ioDiff) override;
};
@@ -192,7 +192,7 @@ class TaggedUnionSubtypeWitness : public SubtypeWitness
virtual bool equalsVal(Val* val) override;
virtual String toString() override;
- virtual int GetHashCode() override;
+ virtual HashCode getHashCode() override;
virtual RefPtr<Val> substituteImpl(SubstitutionSet subst, int * ioDiff) override;
};
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index e71ffc430..b69b3ad7d 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -803,7 +803,7 @@ namespace Slang
TypeExp typeExp = CheckUsableType(varDecl->type);
varDecl->type = typeExp;
- if (varDecl->type.Equals(getSession()->getVoidType()))
+ if (varDecl->type.equals(getSession()->getVoidType()))
{
getSink()->diagnose(varDecl, Diagnostics::invalidTypeVoid);
}
diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h
index 8432322bb..fb55e5bef 100644
--- a/source/slang/slang-check-impl.h
+++ b/source/slang/slang-check-impl.h
@@ -72,9 +72,9 @@ namespace Slang
bool isValid() const { return type1 != BasicTypeKey::Invalid && type2 != BasicTypeKey::Invalid; }
- int GetHashCode()
+ HashCode getHashCode()
{
- return int(type1) << 16 | int(type2);
+ return HashCode(int(type1) << 16 | int(type2));
}
};
@@ -86,9 +86,9 @@ namespace Slang
{
return operatorName == key.operatorName && args[0] == key.args[0] && args[1] == key.args[1];
}
- int GetHashCode()
+ HashCode getHashCode()
{
- return ((int)(UInt64)(void*)(operatorName) << 16) ^ (int(args[0]) << 8) ^ (int(args[1]));
+ return HashCode(((int)(UInt64)(void*)(operatorName) << 16) ^ (int(args[0]) << 8) ^ (int(args[1])));
}
bool fromOperatorExpr(OperatorExpr* opExpr)
{
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index 2d7c7635a..745597a76 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -664,7 +664,7 @@ namespace Slang
{
// HACK: if both items refer to the same declaration,
// then arbitrarily pick one.
- if(left.declRef.Equals(right.declRef))
+ if(left.declRef.equals(right.declRef))
return -1;
// There is a very general rule that we would like to enforce
diff --git a/source/slang/slang-check-stmt.cpp b/source/slang/slang-check-stmt.cpp
index 3de885a35..fa2eb59a0 100644
--- a/source/slang/slang-check-stmt.cpp
+++ b/source/slang/slang-check-stmt.cpp
@@ -250,7 +250,7 @@ namespace Slang
auto function = getParentFunc();
if (!stmt->expression)
{
- if (function && !function->returnType.Equals(getSession()->getVoidType()))
+ if (function && !function->returnType.equals(getSession()->getVoidType()))
{
getSink()->diagnose(stmt, Diagnostics::returnNeedsExpression);
}
diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp
index 45443630b..e6c924be8 100644
--- a/source/slang/slang-check-type.cpp
+++ b/source/slang/slang-check-type.cpp
@@ -323,7 +323,7 @@ namespace Slang
{
if(auto rightVar = as<GenericParamIntVal>(right))
{
- return leftVar->declRef.Equals(rightVar->declRef);
+ return leftVar->declRef.equals(rightVar->declRef);
}
}
diff --git a/source/slang/slang-check.cpp b/source/slang/slang-check.cpp
index 275818614..5b2b2b132 100644
--- a/source/slang/slang-check.cpp
+++ b/source/slang/slang-check.cpp
@@ -234,7 +234,7 @@ namespace Slang
{
visitor.dispatch(stmt);
}
- catch(AbortCompilationException&) { throw; }
+ catch(const AbortCompilationException&) { throw; }
catch(...)
{
getSink()->noteInternalErrorLoc(stmt->loc);
@@ -249,7 +249,7 @@ namespace Slang
{
visitor.dispatch(expr);
}
- catch(AbortCompilationException&) { throw; }
+ catch(const AbortCompilationException&) { throw; }
catch(...)
{
getSink()->noteInternalErrorLoc(expr->loc);
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 8a8017ef3..83f362ec7 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -2278,7 +2278,7 @@ SlangResult dissassembleDXILUsingDXC(
{
stream.write(m_containerBlob->getBufferPointer(), m_containerBlob->getBufferSize());
}
- catch (IOException&)
+ catch (const IOException&)
{
// Unable to write
return SLANG_FAIL;
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 9da7008b6..811036dc0 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -2259,7 +2259,7 @@ void CLikeSourceEmitter::emitInst(IRInst* inst)
}
// Don't emit any context message for an explicit `AbortCompilationException`
// because it should only happen when an error is already emitted.
- catch(AbortCompilationException&) { throw; }
+ catch(const AbortCompilationException&) { throw; }
catch(...)
{
noteInternalErrorLoc(inst->sourceLoc);
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 00ce929d9..ef7e557f6 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1358,7 +1358,8 @@ bool GLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
case kIROp_StringLit:
{
IRStringLit* lit = cast<IRStringLit>(inst);
- m_writer->emit(GetHashCode(lit->getStringSlice()));
+ const UnownedStringSlice slice = lit->getStringSlice();
+ m_writer->emit(int32_t(getStableHashCode32(slice.begin(), slice.getLength())));
return true;
}
case kIROp_GetStringHash:
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index e48a166c5..338e99e68 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -520,7 +520,8 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
case kIROp_StringLit:
{
IRStringLit* lit = cast<IRStringLit>(inst);
- m_writer->emit(GetHashCode(lit->getStringSlice()));
+ UnownedStringSlice slice = lit->getStringSlice();
+ m_writer->emit(int32_t(getStableHashCode32(slice.begin(), slice.getLength())));
return true;
}
case kIROp_GetStringHash:
diff --git a/source/slang/slang-file-system.cpp b/source/slang/slang-file-system.cpp
index 29db71459..ebe1eeb61 100644
--- a/source/slang/slang-file-system.cpp
+++ b/source/slang/slang-file-system.cpp
@@ -144,7 +144,7 @@ SLANG_NO_THROW SlangResult SLANG_MCALL OSFileSystemExt::saveFile(const char* pat
}
}
- catch (IOException&)
+ catch (const IOException&)
{
return SLANG_E_CANNOT_OPEN;
}
@@ -332,7 +332,7 @@ SlangResult CacheFileSystem::_calcUniqueIdentity(const String& path, String& out
}
// Calculate the hash on the contents
- const uint64_t hash = GetHashCode64((const char*)outFileContents->getBufferPointer(), outFileContents->getBufferSize());
+ const uint64_t hash = getHashCode64((const char*)outFileContents->getBufferPointer(), outFileContents->getBufferSize());
String hashString = Path::getFileName(path);
hashString = hashString.toLower();
diff --git a/source/slang/slang-hlsl-intrinsic-set.h b/source/slang/slang-hlsl-intrinsic-set.h
index ca3fced50..c19ab3a7c 100644
--- a/source/slang/slang-hlsl-intrinsic-set.h
+++ b/source/slang/slang-hlsl-intrinsic-set.h
@@ -119,7 +119,7 @@ struct HLSLIntrinsic
return isTypeScalar(returnType);
}
- int GetHashCode() const { return combineHash(int(op), combineHash(Slang::GetHashCode(returnType), Slang::GetHashCode(signatureType))); }
+ HashCode getHashCode() const { return combineHash(int(op), combineHash(Slang::getHashCode(returnType), Slang::getHashCode(signatureType))); }
static const Info& getInfo(Op op) { return s_operationInfos[Index(op)]; }
static const Info s_operationInfos[];
@@ -134,7 +134,7 @@ struct HLSLIntrinsicRef
{
typedef HLSLIntrinsicRef ThisType;
- int GetHashCode() const { return m_intrinsic->GetHashCode(); }
+ HashCode getHashCode() const { return m_intrinsic->getHashCode(); }
bool operator==(const ThisType& rhs) const { return m_intrinsic == rhs.m_intrinsic || (*m_intrinsic == *rhs.m_intrinsic); }
bool operator!=(const ThisType& rhs) const { return !(*this == rhs); }
diff --git a/source/slang/slang-ir-clone.cpp b/source/slang/slang-ir-clone.cpp
index 9f9349f99..8155a4d34 100644
--- a/source/slang/slang-ir-clone.cpp
+++ b/source/slang/slang-ir-clone.cpp
@@ -299,13 +299,13 @@ bool IRSimpleSpecializationKey::operator==(IRSimpleSpecializationKey const& othe
return true;
}
-int IRSimpleSpecializationKey::GetHashCode() const
+HashCode IRSimpleSpecializationKey::getHashCode() const
{
auto valCount = vals.getCount();
- int hash = Slang::GetHashCode(valCount);
+ HashCode hash = Slang::getHashCode(valCount);
for( Index ii = 0; ii < valCount; ++ii )
{
- hash = combineHash(hash, Slang::GetHashCode(vals[ii]));
+ hash = combineHash(hash, Slang::getHashCode(vals[ii]));
}
return hash;
}
diff --git a/source/slang/slang-ir-clone.h b/source/slang/slang-ir-clone.h
index d2d3b1f55..b483b5fcb 100644
--- a/source/slang/slang-ir-clone.h
+++ b/source/slang/slang-ir-clone.h
@@ -173,11 +173,11 @@ struct IRSimpleSpecializationKey
// In order to use this type as a `Dictionary` key we
// need it to support equality and hashing.
//
- // TODO: honestly we might consider having `GetHashCode`
+ // TODO: honestly we might consider having `getHashCode`
// and `operator==` defined for `List<T>`.
bool operator==(IRSimpleSpecializationKey const& other) const;
- int GetHashCode() const;
+ HashCode getHashCode() const;
};
}
diff --git a/source/slang/slang-ir-insts.h b/source/slang/slang-ir-insts.h
index 957a53a0e..881d7a93b 100644
--- a/source/slang/slang-ir-insts.h
+++ b/source/slang/slang-ir-insts.h
@@ -1479,7 +1479,7 @@ struct IRInstKey
{
IRInst* inst;
- int GetHashCode();
+ HashCode getHashCode();
};
bool operator==(IRInstKey const& left, IRInstKey const& right);
@@ -1489,7 +1489,7 @@ struct IRConstantKey
IRConstant* inst;
bool operator==(const IRConstantKey& rhs) const { return inst->equal(rhs.inst); }
- int GetHashCode() const { return inst->getHashCode(); }
+ HashCode getHashCode() const { return inst->getHashCode(); }
};
struct SharedIRBuilder
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 9fb966eba..0a52561c0 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -1651,17 +1651,17 @@ namespace Slang
return true;
}
- int IRInstKey::GetHashCode()
+ HashCode IRInstKey::getHashCode()
{
- auto code = Slang::GetHashCode(inst->op);
- code = combineHash(code, Slang::GetHashCode(inst->getFullType()));
- code = combineHash(code, Slang::GetHashCode(inst->getOperandCount()));
+ auto code = Slang::getHashCode(inst->op);
+ code = combineHash(code, Slang::getHashCode(inst->getFullType()));
+ code = combineHash(code, Slang::getHashCode(inst->getOperandCount()));
auto argCount = inst->getOperandCount();
auto args = inst->getOperands();
for( UInt aa = 0; aa < argCount; ++aa )
{
- code = combineHash(code, Slang::GetHashCode(args[aa].get()));
+ code = combineHash(code, Slang::getHashCode(args[aa].get()));
}
return code;
}
@@ -1760,10 +1760,10 @@ namespace Slang
return isValueEqual(rhs) && getFullType() == rhs->getFullType();
}
- int IRConstant::getHashCode()
+ HashCode IRConstant::getHashCode()
{
- auto code = Slang::GetHashCode(op);
- code = combineHash(code, Slang::GetHashCode(getFullType()));
+ auto code = Slang::getHashCode(op);
+ code = combineHash(code, Slang::getHashCode(getFullType()));
switch (op)
{
@@ -1773,16 +1773,16 @@ namespace Slang
{
SLANG_COMPILE_TIME_ASSERT(sizeof(IRFloatingPointValue) == sizeof(IRIntegerValue));
// ... we can just compare as bits
- return combineHash(code, Slang::GetHashCode(value.intVal));
+ return combineHash(code, Slang::getHashCode(value.intVal));
}
case kIROp_PtrLit:
{
- return combineHash(code, Slang::GetHashCode(value.ptrVal));
+ return combineHash(code, Slang::getHashCode(value.ptrVal));
}
case kIROp_StringLit:
{
const UnownedStringSlice slice = getStringSlice();
- return combineHash(code, Slang::GetHashCode(slice.begin(), slice.getLength()));
+ return combineHash(code, Slang::getHashCode(slice.begin(), slice.getLength()));
}
default:
{
@@ -4537,7 +4537,7 @@ namespace Slang
{
// TODO: This is contrived in that we want two types that are the same, but are different
// pointers to match here.
- // If we make GetHashCode for IRType* compatible with isTypeEqual, then we should probably use that.
+ // If we make getHashCode for IRType* compatible with isTypeEqual, then we should probably use that.
return static_cast<IRConstant*>(a)->isValueEqual(static_cast<IRConstant*>(b)) &&
isTypeEqual(a->getFullType(), b->getFullType());
}
diff --git a/source/slang/slang-ir.h b/source/slang/slang-ir.h
index f070f29c0..fbe05e8e8 100644
--- a/source/slang/slang-ir.h
+++ b/source/slang/slang-ir.h
@@ -689,7 +689,7 @@ struct IRConstant : IRInst
bool isValueEqual(IRConstant* rhs);
/// Get the hash
- int getHashCode();
+ HashCode getHashCode();
IR_PARENT_ISA(Constant)
diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp
index 70e6a23ce..1a1d2e621 100644
--- a/source/slang/slang-lookup.cpp
+++ b/source/slang/slang-lookup.cpp
@@ -439,7 +439,7 @@ static void _lookUpMembersInSuperTypeDeclImpl(
auto subDeclRefType = as<DeclRefType>(subType);
if(!subDeclRefType)
continue;
- if(!subDeclRefType->declRef.Equals(genericTypeParamDeclRef))
+ if(!subDeclRefType->declRef.equals(genericTypeParamDeclRef))
continue;
_lookUpMembersInSuperType(
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 4c33ab172..5b4694d36 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -3854,7 +3854,7 @@ void lowerStmt(
}
// Don't emit any context message for an explicit `AbortCompilationException`
// because it should only happen when an error is already emitted.
- catch(AbortCompilationException&) { throw; }
+ catch(const AbortCompilationException&) { throw; }
catch(...)
{
context->getSink()->noteInternalErrorLoc(stmt->loc);
@@ -6332,7 +6332,7 @@ LoweredValInfo lowerDecl(
}
// Don't emit any context message for an explicit `AbortCompilationException`
// because it should only happen when an error is already emitted.
- catch(AbortCompilationException&) { throw; }
+ catch(const AbortCompilationException&) { throw; }
catch(...)
{
context->getSink()->noteInternalErrorLoc(decl->loc);
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index 0d12e2f69..0ecc12b45 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -489,11 +489,11 @@ namespace Slang
String getHashedName(const UnownedStringSlice& mangledName)
{
- uint64_t hash = GetHashCode64(mangledName.begin(), mangledName.getLength());
+ HashCode64 hash = getStableHashCode64(mangledName.begin(), mangledName.getLength());
StringBuilder builder;
builder << "_Sh";
- builder.append(hash, 16);
+ builder.append(uint64_t(hash), 16);
return builder;
}
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 72a20e932..1316efa5d 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -1571,6 +1571,5 @@ SLANG_API const char* spReflection_getHashedString(
SLANG_API int spComputeStringHash(const char* chars, size_t count)
{
- UnownedStringSlice slice(chars, count);
- return GetHashCode(slice);
+ return (int)getStableHashCode32(chars, count);
}
diff --git a/source/slang/slang-source-loc.h b/source/slang/slang-source-loc.h
index db2dcc394..51d826108 100644
--- a/source/slang/slang-source-loc.h
+++ b/source/slang/slang-source-loc.h
@@ -79,6 +79,7 @@ struct PathInfo
class SourceLoc
{
public:
+ typedef SourceLoc ThisType;
typedef uint32_t RawValue;
private:
@@ -108,6 +109,7 @@ public:
{
return raw != 0;
}
+ SourceLoc& operator=(const ThisType& rhs) = default;
};
inline SourceLoc operator+(SourceLoc loc, Int offset)
diff --git a/source/slang/slang-state-serialize.cpp b/source/slang/slang-state-serialize.cpp
index abdaae7c6..3d98f182d 100644
--- a/source/slang/slang-state-serialize.cpp
+++ b/source/slang/slang-state-serialize.cpp
@@ -53,19 +53,19 @@ namespace Slang {
#define SLANG_STATE_TYPE_SIZE(x) uint32_t(sizeof(x)),
// A function to calculate the hash related in list in part to how the types used are sized. Can catch crude breaking binary differences.
-static uint32_t _calcTypeHash()
+static HashCode32 _calcTypeHash()
{
typedef StateSerializeUtil Util;
const uint32_t sizes[] =
{
SLANG_STATE_TYPES(SLANG_STATE_TYPE_SIZE)
};
- return uint32_t(GetHashCode((const char*)&sizes, sizeof(sizes)));
+ return getStableHashCode32((const char*)&sizes, sizeof(sizes));
}
-static uint32_t _getTypeHash()
+static HashCode32 _getTypeHash()
{
- static uint32_t s_hash = _calcTypeHash();
+ static HashCode32 s_hash = _calcTypeHash();
return s_hash;
}
@@ -1053,7 +1053,7 @@ struct LoadContext
Header header;
header.m_chunk.type = kSlangStateFourCC;
header.m_semanticVersion = g_semanticVersion;
- header.m_typeHash = _getTypeHash();
+ header.m_typeHash = uint32_t(_getTypeHash());
return RiffUtil::writeData(&header.m_chunk, sizeof(header),container.getData(), container.getDataCount(), stream);
}
@@ -1071,7 +1071,7 @@ struct LoadContext
{
stream = new FileStream(filename, FileMode::Open, FileAccess::Read, FileShare::ReadWrite);
}
- catch (IOException&)
+ catch (const IOException&)
{
return SLANG_FAIL;
}
@@ -1094,7 +1094,7 @@ struct LoadContext
return SLANG_FAIL;
}
- if (header.m_typeHash != _getTypeHash())
+ if (header.m_typeHash != uint32_t(_getTypeHash()))
{
return SLANG_FAIL;
}
@@ -1550,7 +1550,7 @@ static SlangResult _findFirstSourcePath(EndToEndCompileRequest* request, String&
outStream = new FileStream(builder, FileMode::CreateNew, FileAccess::Write, FileShare::WriteOnly);
return SLANG_OK;
}
- catch (IOException&)
+ catch (const IOException&)
{
}
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp
index de3b4e2d7..70b8a4239 100644
--- a/source/slang/slang-syntax.cpp
+++ b/source/slang/slang-syntax.cpp
@@ -59,7 +59,7 @@ bool BasicExpressionType::equalsImpl(Type * type)
return basicType && basicType->baseType == this->baseType;
}
-RefPtr<Type> BasicExpressionType::CreateCanonicalType()
+RefPtr<Type> BasicExpressionType::createCanonicalType()
{
// A basic type is already canonical, in our setup
return this;
@@ -208,16 +208,11 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
// TypeExp
- bool TypeExp::Equals(Type* other)
+ bool TypeExp::equals(Type* other)
{
return type->equals(other);
}
- bool TypeExp::Equals(RefPtr<Type> other)
- {
- return type->equals(other.Ptr());
- }
-
// BasicExpressionType
BasicExpressionType* BasicExpressionType::GetScalarType()
@@ -270,7 +265,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
if (!et->canonicalType)
{
// TODO(tfoley): worry about thread safety here?
- auto canType = et->CreateCanonicalType();
+ auto canType = et->createCanonicalType();
et->canonicalType = canType;
// TODO(js): That this detachs when canType == this is a little surprising. It would seem
@@ -471,7 +466,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return this;
}
- RefPtr<Type> ArrayExpressionType::CreateCanonicalType()
+ RefPtr<Type> ArrayExpressionType::createCanonicalType()
{
auto canonicalElementType = baseType->getCanonicalType();
auto canonicalArrayType = getArrayType(
@@ -479,12 +474,12 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
arrayLength);
return canonicalArrayType;
}
- int ArrayExpressionType::GetHashCode()
+ HashCode ArrayExpressionType::getHashCode()
{
if (arrayLength)
- return (baseType->GetHashCode() * 16777619) ^ arrayLength->GetHashCode();
+ return (baseType->getHashCode() * 16777619) ^ arrayLength->getHashCode();
else
- return baseType->GetHashCode();
+ return baseType->getHashCode();
}
Slang::String ArrayExpressionType::toString()
{
@@ -501,21 +496,21 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return declRef.toString();
}
- int DeclRefType::GetHashCode()
+ HashCode DeclRefType::getHashCode()
{
- return (declRef.GetHashCode() * 16777619) ^ (int)(typeid(this).hash_code());
+ return (declRef.getHashCode() * 16777619) ^ (HashCode)(typeid(this).hash_code());
}
bool DeclRefType::equalsImpl(Type * type)
{
if (auto declRefType = as<DeclRefType>(type))
{
- return declRef.Equals(declRefType->declRef);
+ return declRef.equals(declRefType->declRef);
}
return false;
}
- RefPtr<Type> DeclRefType::CreateCanonicalType()
+ RefPtr<Type> DeclRefType::createCanonicalType()
{
// A declaration reference is already canonical
return this;
@@ -1038,14 +1033,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return false;
}
- RefPtr<Type> OverloadGroupType::CreateCanonicalType()
+ RefPtr<Type> OverloadGroupType::createCanonicalType()
{
return this;
}
- int OverloadGroupType::GetHashCode()
+ HashCode OverloadGroupType::getHashCode()
{
- return (int)(int64_t)(void*)this;
+ return (HashCode)(size_t(this));
}
// InitializerListType
@@ -1060,14 +1055,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return false;
}
- RefPtr<Type> InitializerListType::CreateCanonicalType()
+ RefPtr<Type> InitializerListType::createCanonicalType()
{
return this;
}
- int InitializerListType::GetHashCode()
+ HashCode InitializerListType::getHashCode()
{
- return (int)(int64_t)(void*)this;
+ return (HashCode)(size_t(this));
}
// ErrorType
@@ -1084,7 +1079,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return false;
}
- RefPtr<Type> ErrorType::CreateCanonicalType()
+ RefPtr<Type> ErrorType::createCanonicalType()
{
return this;
}
@@ -1094,9 +1089,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return this;
}
- int ErrorType::GetHashCode()
+ HashCode ErrorType::getHashCode()
{
- return (int)(int64_t)(void*)this;
+ return HashCode(size_t(this));
}
@@ -1113,25 +1108,25 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
UNREACHABLE_RETURN(false);
}
- RefPtr<Type> NamedExpressionType::CreateCanonicalType()
+ RefPtr<Type> NamedExpressionType::createCanonicalType()
{
if (!innerType)
innerType = GetType(declRef);
return innerType->getCanonicalType();
}
- int NamedExpressionType::GetHashCode()
+ HashCode NamedExpressionType::getHashCode()
{
// Type equality is based on comparing canonical types,
// so the hash code for a type needs to come from the
// canonical version of the type. This really means
- // that `Type::GetHashCode()` should dispatch out to
- // something like `Type::GetHashCodeImpl()` on the
+ // that `Type::getHashCode()` should dispatch out to
+ // something like `Type::getHashCodeImpl()` on the
// canonical version of a type, but it is less invasive
// for now (and hopefully equivalent) to just have any
// named types automaticlaly route hash-code requests
// to their canonical type.
- return getCanonicalType()->GetHashCode();
+ return getCanonicalType()->getHashCode();
}
// FuncType
@@ -1205,7 +1200,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return substType;
}
- RefPtr<Type> FuncType::CreateCanonicalType()
+ RefPtr<Type> FuncType::createCanonicalType()
{
// result type
RefPtr<Type> canResultType = resultType->getCanonicalType();
@@ -1225,16 +1220,16 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return canType;
}
- int FuncType::GetHashCode()
+ HashCode FuncType::getHashCode()
{
- int hashCode = getResultType()->GetHashCode();
+ HashCode hashCode = getResultType()->getHashCode();
UInt paramCount = getParamCount();
- hashCode = combineHash(hashCode, Slang::GetHashCode(paramCount));
+ hashCode = combineHash(hashCode, Slang::getHashCode(paramCount));
for (UInt pp = 0; pp < paramCount; ++pp)
{
hashCode = combineHash(
hashCode,
- getParamType(pp)->GetHashCode());
+ getParamType(pp)->getHashCode());
}
return hashCode;
}
@@ -1257,13 +1252,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return false;
}
- RefPtr<Type> TypeType::CreateCanonicalType()
+ RefPtr<Type> TypeType::createCanonicalType()
{
auto canType = getTypeType(type->getCanonicalType());
return canType;
}
- int TypeType::GetHashCode()
+ HashCode TypeType::getHashCode()
{
SLANG_UNEXPECTED("unreachable");
UNREACHABLE_RETURN(0);
@@ -1281,17 +1276,17 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
{
if (auto genericDeclRefType = as<GenericDeclRefType>(type))
{
- return declRef.Equals(genericDeclRefType->declRef);
+ return declRef.equals(genericDeclRefType->declRef);
}
return false;
}
- int GenericDeclRefType::GetHashCode()
+ HashCode GenericDeclRefType::getHashCode()
{
- return declRef.GetHashCode();
+ return declRef.getHashCode();
}
- RefPtr<Type> GenericDeclRefType::CreateCanonicalType()
+ RefPtr<Type> GenericDeclRefType::createCanonicalType()
{
return this;
}
@@ -1310,17 +1305,17 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
{
if (auto namespaceType = as<NamespaceType>(type))
{
- return declRef.Equals(namespaceType->declRef);
+ return declRef.equals(namespaceType->declRef);
}
return false;
}
- int NamespaceType::GetHashCode()
+ HashCode NamespaceType::getHashCode()
{
- return declRef.GetHashCode();
+ return declRef.getHashCode();
}
- RefPtr<Type> NamespaceType::CreateCanonicalType()
+ RefPtr<Type> NamespaceType::createCanonicalType()
{
return this;
}
@@ -1425,7 +1420,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
{
if (auto genericParamVal = as<GenericParamIntVal>(val))
{
- return declRef.Equals(genericParamVal->declRef);
+ return declRef.equals(genericParamVal->declRef);
}
return false;
}
@@ -1435,9 +1430,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return getText(declRef.GetName());
}
- int GenericParamIntVal::GetHashCode()
+ HashCode GenericParamIntVal::getHashCode()
{
- return declRef.GetHashCode() ^ 0xFFFF;
+ return declRef.getHashCode() ^ HashCode(0xFFFF);
}
RefPtr<Val> GenericParamIntVal::substituteImpl(SubstitutionSet subst, int* ioDiff)
@@ -1498,9 +1493,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return "<error>";
}
- int ErrorIntVal::GetHashCode()
+ HashCode ErrorIntVal::getHashCode()
{
- return int(typeid(this).hash_code());
+ return HashCode(typeid(this).hash_code());
}
RefPtr<Val> ErrorIntVal::substituteImpl(SubstitutionSet subst, int* ioDiff)
@@ -1609,9 +1604,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return false;
}
- int ThisTypeSubstitution::GetHashCode() const
+ HashCode ThisTypeSubstitution::getHashCode() const
{
- return witness->GetHashCode();
+ return witness->getHashCode();
}
RefPtr<Substitutions> GlobalGenericParamSubstitution::applySubstitutionsShallow(SubstitutionSet substSet, RefPtr<Substitutions> substOuter, int* ioDiff)
@@ -2064,11 +2059,11 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
// Check if this is an equivalent declaration reference to another
- bool DeclRefBase::Equals(DeclRefBase const& declRef) const
+ bool DeclRefBase::equals(DeclRefBase const& declRef) const
{
if (decl != declRef.decl)
return false;
- if (!substitutions.Equals(declRef.substitutions))
+ if (!substitutions.equals(declRef.substitutions))
return false;
return true;
@@ -2136,9 +2131,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return DeclRefBase(parentDecl, substToApply);
}
- int DeclRefBase::GetHashCode() const
+ HashCode DeclRefBase::getHashCode() const
{
- return combineHash(PointerHash<1>::GetHashCode(decl), substitutions.GetHashCode());
+ return combineHash(PointerHash<1>::getHashCode(decl), substitutions.getHashCode());
}
// Val
@@ -2182,9 +2177,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return String(value);
}
- int ConstantIntVal::GetHashCode()
+ HashCode ConstantIntVal::getHashCode()
{
- return (int) value;
+ return (HashCode) value;
}
//
@@ -2387,9 +2382,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return "TypeEqualityWitness(" + sub->toString() + ")";
}
- int TypeEqualityWitness::GetHashCode()
+ HashCode TypeEqualityWitness::getHashCode()
{
- return sub->GetHashCode();
+ return sub->getHashCode();
}
bool DeclaredSubtypeWitness::equalsVal(Val* val)
@@ -2400,7 +2395,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return sub->equals(otherWitness->sub)
&& sup->equals(otherWitness->sup)
- && declRef.Equals(otherWitness->declRef);
+ && declRef.equals(otherWitness->declRef);
}
RefPtr<ThisTypeSubstitution> findThisTypeSubstitution(
@@ -2554,9 +2549,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return sb.ProduceString();
}
- int DeclaredSubtypeWitness::GetHashCode()
+ HashCode DeclaredSubtypeWitness::getHashCode()
{
- return declRef.GetHashCode();
+ return declRef.getHashCode();
}
// TransitiveSubtypeWitness
@@ -2570,7 +2565,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return sub->equals(otherWitness->sub)
&& sup->equals(otherWitness->sup)
&& subToMid->equalsVal(otherWitness->subToMid)
- && midToSup.Equals(otherWitness->midToSup);
+ && midToSup.equals(otherWitness->midToSup);
}
RefPtr<Val> TransitiveSubtypeWitness::substituteImpl(SubstitutionSet subst, int * ioDiff)
@@ -2628,12 +2623,12 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return sb.ProduceString();
}
- int TransitiveSubtypeWitness::GetHashCode()
+ HashCode TransitiveSubtypeWitness::getHashCode()
{
- auto hash = sub->GetHashCode();
- hash = combineHash(hash, sup->GetHashCode());
- hash = combineHash(hash, subToMid->GetHashCode());
- hash = combineHash(hash, midToSup.GetHashCode());
+ auto hash = sub->getHashCode();
+ hash = combineHash(hash, sup->getHashCode());
+ hash = combineHash(hash, subToMid->getHashCode());
+ hash = combineHash(hash, midToSup.getHashCode());
return hash;
}
@@ -2650,7 +2645,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return name->text;
}
- bool SubstitutionSet::Equals(const SubstitutionSet& substSet) const
+ bool SubstitutionSet::equals(const SubstitutionSet& substSet) const
{
if (substitutions == substSet.substitutions)
{
@@ -2663,11 +2658,11 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return substitutions->equals(substSet.substitutions);
}
- int SubstitutionSet::GetHashCode() const
+ HashCode SubstitutionSet::getHashCode() const
{
- int rs = 0;
+ HashCode rs = 0;
if (substitutions)
- rs = combineHash(rs, substitutions->GetHashCode());
+ rs = combineHash(rs, substitutions->getHashCode());
return rs;
}
@@ -2685,17 +2680,17 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
{
if( auto extractExistential = as<ExtractExistentialType>(type) )
{
- return declRef.Equals(extractExistential->declRef);
+ return declRef.equals(extractExistential->declRef);
}
return false;
}
- int ExtractExistentialType::GetHashCode()
+ HashCode ExtractExistentialType::getHashCode()
{
- return declRef.GetHashCode();
+ return declRef.getHashCode();
}
- RefPtr<Type> ExtractExistentialType::CreateCanonicalType()
+ RefPtr<Type> ExtractExistentialType::createCanonicalType()
{
return this;
}
@@ -2720,7 +2715,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
{
if( auto extractWitness = as<ExtractExistentialSubtypeWitness>(val) )
{
- return declRef.Equals(extractWitness->declRef);
+ return declRef.equals(extractWitness->declRef);
}
return false;
}
@@ -2734,9 +2729,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return result;
}
- int ExtractExistentialSubtypeWitness::GetHashCode()
+ HashCode ExtractExistentialSubtypeWitness::getHashCode()
{
- return declRef.GetHashCode();
+ return declRef.getHashCode();
}
RefPtr<Val> ExtractExistentialSubtypeWitness::substituteImpl(SubstitutionSet subst, int* ioDiff)
@@ -2797,17 +2792,17 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt
return true;
}
- int TaggedUnionType::GetHashCode()
+ HashCode TaggedUnionType::getHashCode()
{
- int hashCode = 0;
+ HashCode hashCode = 0;
for( auto caseType : caseTypes )
{
- hashCode = combineHash(hashCode, caseType->GetHashCode());
+ hashCode = combineHash(hashCode, caseType->getHashCode());
}
return hashCode;
}
- RefPtr<Type> TaggedUnionType::CreateCanonicalType()
+ RefPtr<Type> TaggedUnionType::createCanonicalType()
{
RefPtr<TaggedUnionType> canType = new TaggedUnionType();
canType->setSession(getSession());
@@ -2880,12 +2875,12 @@ String TaggedUnionSubtypeWitness::toString()
return result;
}
-int TaggedUnionSubtypeWitness::GetHashCode()
+HashCode TaggedUnionSubtypeWitness::getHashCode()
{
- int hash = 0;
+ HashCode hash = 0;
for( auto caseWitness : caseWitnesses )
{
- hash = combineHash(hash, caseWitness->GetHashCode());
+ hash = combineHash(hash, caseWitness->getHashCode());
}
return hash;
}
@@ -3004,7 +2999,7 @@ bool ExistentialSpecializedType::equalsImpl(Type * type)
return true;
}
-int ExistentialSpecializedType::GetHashCode()
+HashCode ExistentialSpecializedType::getHashCode()
{
Hasher hasher;
hasher.hashObject(baseType);
@@ -3030,7 +3025,7 @@ RefPtr<Val> getCanonicalValue(Val* val)
return val;
}
-RefPtr<Type> ExistentialSpecializedType::CreateCanonicalType()
+RefPtr<Type> ExistentialSpecializedType::createCanonicalType()
{
RefPtr<ExistentialSpecializedType> canType = new ExistentialSpecializedType();
canType->setSession(getSession());
@@ -3097,20 +3092,20 @@ bool ThisType::equalsImpl(Type * type)
if(!other)
return false;
- if(!interfaceDeclRef.Equals(other->interfaceDeclRef))
+ if(!interfaceDeclRef.equals(other->interfaceDeclRef))
return false;
return true;
}
-int ThisType::GetHashCode()
+HashCode ThisType::getHashCode()
{
return combineHash(
HashCode(typeid(*this).hash_code()),
- interfaceDeclRef.GetHashCode());
+ interfaceDeclRef.getHashCode());
}
-RefPtr<Type> ThisType::CreateCanonicalType()
+RefPtr<Type> ThisType::createCanonicalType()
{
RefPtr<ThisType> canType = new ThisType();
canType->setSession(getSession());
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 82bc5e478..2c698eeaf 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -3255,13 +3255,13 @@ SLANG_API SlangResult spCompile(
{
res = req->executeActions();
}
- catch (AbortCompilationException&)
+ catch (const AbortCompilationException&)
{
// This situation indicates a fatal (but not necessarily internal) error
// that forced compilation to terminate. There should already have been
// a diagnostic produced, so we don't need to add one here.
}
- catch (Exception& e)
+ catch (const Exception& e)
{
// The compiler failed due to an internal error that was detected.
// We will print out information on the exception to help out the user