diff options
| author | lucy96chen <47800040+lucy96chen@users.noreply.github.com> | 2022-10-12 14:41:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-12 14:41:22 -0700 |
| commit | 53b180a9383668246a152af41aec8f6e565904a4 (patch) | |
| tree | c034dc6584dd7dd7b5451d9fd8b3972e6b5d0106 /source | |
| parent | f0cd62b37c5dfbbdb3fb205f1be2b8beba0dfed4 (diff) | |
Add specialization args test (#2444)
* Added specialization args test; small cleanup changes to slang-digest.h
* Moved slang::Digest inside namespace Slang
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/slang-digest.h | 8 | ||||
| -rw-r--r-- | source/slang/slang-hash-utils.h | 11 | ||||
| -rw-r--r-- | source/slang/slang.cpp | 9 |
3 files changed, 10 insertions, 18 deletions
diff --git a/source/core/slang-digest.h b/source/core/slang-digest.h index d1bc80b40..47c0cd8f7 100644 --- a/source/core/slang-digest.h +++ b/source/core/slang-digest.h @@ -4,6 +4,8 @@ namespace Slang { + using slang::Digest; + // Wrapper struct that holds objects necessary for hashing. struct DigestBuilder { @@ -19,9 +21,11 @@ namespace Slang hashGen.update(&context, item); } - void finalize(slang::Digest* outHash) + Digest finalize() { - hashGen.finalize(&context, outHash); + Digest hash; + hashGen.finalize(&context, &hash); + return hash; } private: diff --git a/source/slang/slang-hash-utils.h b/source/slang/slang-hash-utils.h index d0d610cb8..62232dd21 100644 --- a/source/slang/slang-hash-utils.h +++ b/source/slang/slang-hash-utils.h @@ -12,11 +12,7 @@ namespace Slang { DigestBuilder builder; builder.addToDigest(text); - - slang::Digest textHash; - builder.finalize(&textHash); - - return textHash; + return builder.finalize(); } // Combines the two provided hashes. @@ -25,10 +21,7 @@ namespace Slang DigestBuilder builder; builder.addToDigest(hashA); builder.addToDigest(hashB); - - slang::Digest combined; - builder.finalize(&combined); - return combined; + return builder.finalize(); } // Returns the stored hash in checksum as a String. diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index a6dcf8ab2..20cad2465 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -3482,19 +3482,14 @@ SLANG_NO_THROW void SLANG_MCALL ComponentType::computeDependencyBasedHash( auto entryPointNameOverride = getEntryPointNameOverride(entryPointIndex); builder.addToDigest(entryPointNameOverride); - slang::Digest hash; - builder.finalize(&hash); - *outHash = hash; + *outHash = builder.finalize(); } SLANG_NO_THROW void SLANG_MCALL ComponentType::computeASTBasedHash(slang::Digest* outHash) { DigestBuilder builder; updateASTBasedHash(builder); - - slang::Digest hash; - builder.finalize(&hash); - *outHash = hash; + *outHash = builder.finalize(); } SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointHostCallable( |
