diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-04-25 10:43:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-25 10:43:29 -0400 |
| commit | 7b7c095b37e85ca3a8f55eff1c3d9643d467b8e0 (patch) | |
| tree | 9c71955dbc956b0058b19818ca127c8132cda512 | |
| parent | 284cee1f246c072f190c87c8fb60c1d2181e458f (diff) | |
Dictionary using lowerCamel (#2835)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP lowerCamel Dictionary.
* WIP more lowerCamel fixes for Dictionary.
* Add/Remove/Clear
* GetValue/Contains
* Fix tabs in dictionary.
Count -> getCount
* Fix fields with caps.
* Key -> key
Value -> value
Use m_ for members where appropriate.
Use lowerCamel in linked list.
* Some small fixes/improvements to Dictionary.
* Kick CI.
171 files changed, 1939 insertions, 1939 deletions
diff --git a/source/compiler-core/slang-artifact-associated-impl.cpp b/source/compiler-core/slang-artifact-associated-impl.cpp index 770c2601f..f6f64e294 100644 --- a/source/compiler-core/slang-artifact-associated-impl.cpp +++ b/source/compiler-core/slang-artifact-associated-impl.cpp @@ -76,7 +76,7 @@ void* ArtifactDiagnostics::castAs(const Guid& guid) void ArtifactDiagnostics::reset() { m_diagnostics.clear(); - m_raw.Clear(); + m_raw.clear(); m_result = SLANG_OK; m_allocator.deallocateAll(); @@ -95,7 +95,7 @@ void ArtifactDiagnostics::add(const Diagnostic& inDiagnostic) void ArtifactDiagnostics::setRaw(const CharSlice& slice) { - m_raw.Clear(); + m_raw.clear(); m_raw << asStringSlice(slice); } diff --git a/source/compiler-core/slang-artifact-container-util.cpp b/source/compiler-core/slang-artifact-container-util.cpp index 94ea792c2..1c9bb5a69 100644 --- a/source/compiler-core/slang-artifact-container-util.cpp +++ b/source/compiler-core/slang-artifact-container-util.cpp @@ -411,7 +411,7 @@ SlangResult FileSystemContents::find(ISlangFileSystemExt* fileSystem, const Unow if (entry.isDirectory()) { // Clear the current path - currentPath.Clear(); + currentPath.clear(); appendPath(i, currentPath); diff --git a/source/compiler-core/slang-artifact-desc-util.cpp b/source/compiler-core/slang-artifact-desc-util.cpp index e10ceee07..140ac780d 100644 --- a/source/compiler-core/slang-artifact-desc-util.cpp +++ b/source/compiler-core/slang-artifact-desc-util.cpp @@ -876,7 +876,7 @@ SlangResult ArtifactDescUtil::appendDefaultExtension(const ArtifactDesc& desc, S /* static */SlangResult ArtifactDescUtil::calcPathForDesc(const ArtifactDesc& desc, const UnownedStringSlice& basePath, StringBuilder& outPath) { - outPath.Clear(); + outPath.clear(); // Append the directory Index pos = Path::findLastSeparatorIndex(basePath); diff --git a/source/compiler-core/slang-artifact-util.cpp b/source/compiler-core/slang-artifact-util.cpp index 7420f6843..e03f02e1e 100644 --- a/source/compiler-core/slang-artifact-util.cpp +++ b/source/compiler-core/slang-artifact-util.cpp @@ -165,7 +165,7 @@ static SlangResult _calcInferred(IArtifact* artifact, const UnownedStringSlice& ext = toSlice("unknown"); } - outPath.Clear(); + outPath.clear(); outPath.append(basePath); if (ext.getLength()) { diff --git a/source/compiler-core/slang-diagnostic-sink.cpp b/source/compiler-core/slang-diagnostic-sink.cpp index fa638316c..49aed3000 100644 --- a/source/compiler-core/slang-diagnostic-sink.cpp +++ b/source/compiler-core/slang-diagnostic-sink.cpp @@ -295,7 +295,7 @@ static void _sourceLocationNoteDiagnostic(DiagnosticSink* sink, SourceView* sour // Now make all spaces const Index length = caretLine.getLength(); - caretLine.Clear(); + caretLine.clear(); caretLine.appendRepeatedChar(' ', length); Index caretIndex = caretLine.getLength(); @@ -506,7 +506,7 @@ void DiagnosticSink::reset() m_errorCount = 0; m_internalErrorLocsNoted = 0; - outputBuffer.Clear(); + outputBuffer.clear(); } @@ -584,7 +584,7 @@ Severity DiagnosticSink::getEffectiveMessageSeverity(DiagnosticInfo const& info) { Severity effectiveSeverity = info.severity; - Severity* pSeverityOverride = m_severityOverrides.TryGetValue(info.id); + Severity* pSeverityOverride = m_severityOverrides.tryGetValue(info.id); // See if there is an override if (pSeverityOverride) @@ -676,7 +676,7 @@ void DiagnosticSink::overrideDiagnosticSeverity(int diagnosticId, Severity overr // If the override is the same as the default, we can just remove the override if (info->severity == overrideSeverity) { - m_severityOverrides.Remove(diagnosticId); + m_severityOverrides.remove(diagnosticId); return; } } @@ -689,14 +689,14 @@ void DiagnosticSink::overrideDiagnosticSeverity(int diagnosticId, Severity overr Index DiagnosticsLookup::_findDiagnosticIndexByExactName(const UnownedStringSlice& slice) const { - const Index* indexPtr = m_nameMap.TryGetValue(slice); + const Index* indexPtr = m_nameMap.tryGetValue(slice); return indexPtr ? *indexPtr : -1; } void DiagnosticsLookup::_addName(const char* name, Index diagnosticIndex) { UnownedStringSlice nameSlice(name); - m_nameMap.Add(nameSlice, diagnosticIndex); + m_nameMap.add(nameSlice, diagnosticIndex); } void DiagnosticsLookup::addAlias(const char* name, const char* diagnosticName) @@ -711,13 +711,13 @@ void DiagnosticsLookup::addAlias(const char* name, const char* diagnosticName) const DiagnosticInfo* DiagnosticsLookup::getDiagnosticById(Int id) const { - const auto indexPtr = m_idMap.TryGetValue(id); + const auto indexPtr = m_idMap.tryGetValue(id); return indexPtr ? m_diagnostics[*indexPtr] : nullptr; } const DiagnosticInfo* DiagnosticsLookup::findDiagnosticByExactName(const UnownedStringSlice& slice) const { - const Index* indexPtr = m_nameMap.TryGetValue(slice); + const Index* indexPtr = m_nameMap.tryGetValue(slice); return indexPtr ? m_diagnostics[*indexPtr] : nullptr; } @@ -746,7 +746,7 @@ Index DiagnosticsLookup::add(const DiagnosticInfo* info) m_diagnostics.add(info); _addName(info->name, diagnosticIndex); - m_idMap.AddIfNotExists(info->id, diagnosticIndex); + m_idMap.addIfNotExists(info->id, diagnosticIndex); return diagnosticIndex; } diff --git a/source/compiler-core/slang-doc-extractor.cpp b/source/compiler-core/slang-doc-extractor.cpp index 9885e29e1..c2d36ee89 100644 --- a/source/compiler-core/slang-doc-extractor.cpp +++ b/source/compiler-core/slang-doc-extractor.cpp @@ -233,7 +233,7 @@ SlangResult DocMarkupExtractor::_extractMarkup(const FindInfo& info, const Found for (Index i = 0; i < linesCount; ++i) { UnownedStringSlice line = lines[i]; - unindentedLine.Clear(); + unindentedLine.clear(); if (i == 0) { diff --git a/source/compiler-core/slang-json-rpc-connection.cpp b/source/compiler-core/slang-json-rpc-connection.cpp index 6d687d8ca..c4413d306 100644 --- a/source/compiler-core/slang-json-rpc-connection.cpp +++ b/source/compiler-core/slang-json-rpc-connection.cpp @@ -156,7 +156,7 @@ SlangResult JSONRPCConnection::toNativeArgsOrSendError(const JSONValue& srcArgs, SlangResult JSONRPCConnection::toNativeOrSendError(const JSONValue& value, const RttiInfo* info, void* dst, const JSONValue& id) { - m_diagnosticSink.outputBuffer.Clear(); + m_diagnosticSink.outputBuffer.clear(); JSONToNativeConverter converter(&m_container, &m_typeMap, &m_diagnosticSink); @@ -271,7 +271,7 @@ SlangResult JSONRPCConnection::getMessage(const RttiInfo* rttiInfo, void* out) return SLANG_FAIL; } - m_diagnosticSink.outputBuffer.Clear(); + m_diagnosticSink.outputBuffer.clear(); JSONToNativeConverter converter(&m_container, &m_typeMap, &m_diagnosticSink); // Get the RPC response @@ -305,7 +305,7 @@ SlangResult JSONRPCConnection::getRPC(const RttiInfo* rttiInfo, void* out) return SLANG_FAIL; } - m_diagnosticSink.outputBuffer.Clear(); + m_diagnosticSink.outputBuffer.clear(); JSONToNativeConverter converter(&m_container, &m_typeMap, &m_diagnosticSink); // Convert the result in the response diff --git a/source/compiler-core/slang-json-value.cpp b/source/compiler-core/slang-json-value.cpp index 9edb81b67..7a2375f2e 100644 --- a/source/compiler-core/slang-json-value.cpp +++ b/source/compiler-core/slang-json-value.cpp @@ -600,7 +600,7 @@ UnownedStringSlice JSONContainer::getTransientString(const JSONValue& in) if (handler->isUnescapingNeeeded(unquoted)) { - m_buf.Clear(); + m_buf.clear(); handler->appendUnescaped(unquoted, m_buf); return m_buf.getUnownedSlice(); } @@ -1425,7 +1425,7 @@ void JSONBuilder::endArray(SourceLoc loc) void JSONBuilder::addQuotedKey(const UnownedStringSlice& key, SourceLoc loc) { // We need to decode - m_work.Clear(); + m_work.clear(); StringEscapeHandler* handler = StringEscapeUtil::getHandler(StringEscapeUtil::Style::JSON); StringEscapeUtil::appendUnquoted(handler, key, m_work); addUnquotedKey(m_work.getUnownedSlice(), loc); diff --git a/source/compiler-core/slang-name.cpp b/source/compiler-core/slang-name.cpp index b6035982b..cc2033339 100644 --- a/source/compiler-core/slang-name.cpp +++ b/source/compiler-core/slang-name.cpp @@ -22,19 +22,19 @@ const char* getCstr(Name* name) Name* NamePool::getName(String const& text) { RefPtr<Name> name; - if (rootPool->names.TryGetValue(text, name)) + if (rootPool->names.tryGetValue(text, name)) return name; name = new Name(); name->text = text; - rootPool->names.Add(text, name); + rootPool->names.add(text, name); return name; } Name* NamePool::tryGetName(String const& text) { RefPtr<Name> name; - if (rootPool->names.TryGetValue(text, name)) + if (rootPool->names.tryGetValue(text, name)) return name; return nullptr; } diff --git a/source/compiler-core/slang-slice-allocator.cpp b/source/compiler-core/slang-slice-allocator.cpp index 738bdf303..49fd6a571 100644 --- a/source/compiler-core/slang-slice-allocator.cpp +++ b/source/compiler-core/slang-slice-allocator.cpp @@ -75,7 +75,7 @@ namespace Slang { const auto size = blob->getBufferSize(); auto chars = (const char*)blob->getBufferPointer(); - storage.Clear(); + storage.clear(); storage.append(UnownedStringSlice(chars, size)); return TerminatedCharSlice(storage.getBuffer(), Count(size)); diff --git a/source/compiler-core/slang-source-loc.cpp b/source/compiler-core/slang-source-loc.cpp index 3d992ee8d..8710cf91f 100644 --- a/source/compiler-core/slang-source-loc.cpp +++ b/source/compiler-core/slang-source-loc.cpp @@ -628,7 +628,7 @@ void SourceManager::_resetSource() m_sourceViews.clear(); m_sourceFiles.clear(); - m_sourceFileMap.Clear(); + m_sourceFileMap.clear(); } @@ -816,7 +816,7 @@ SourceFile* SourceManager::findSourceFileByPath(const String& name) const SourceFile* SourceManager::findSourceFile(const String& uniqueIdentity) const { - SourceFile*const* filePtr = m_sourceFileMap.TryGetValue(uniqueIdentity); + SourceFile*const* filePtr = m_sourceFileMap.tryGetValue(uniqueIdentity); return (filePtr) ? *filePtr : nullptr; } @@ -867,7 +867,7 @@ SourceFile* SourceManager::findSourceFileByContent(const char* text) const void SourceManager::addSourceFile(const String& uniqueIdentity, SourceFile* sourceFile) { SLANG_ASSERT(!findSourceFileRecursively(uniqueIdentity)); - m_sourceFileMap.Add(uniqueIdentity, sourceFile); + m_sourceFileMap.add(uniqueIdentity, sourceFile); } HumaneSourceLoc SourceManager::getHumaneLoc(SourceLoc loc, SourceLocType type) diff --git a/source/core/slang-dictionary.h b/source/core/slang-dictionary.h index 0839a649c..0350a99d2 100644 --- a/source/core/slang-dictionary.h +++ b/source/core/slang-dictionary.h @@ -11,678 +11,670 @@ namespace Slang { - template<typename TKey, typename TValue> - class KeyValuePair - { - public: - TKey Key; - TValue Value; - KeyValuePair() - {} - KeyValuePair(const TKey & key, const TValue & value) - { - Key = key; - Value = value; - } - KeyValuePair(TKey && key, TValue && value) - { - Key = _Move(key); - Value = _Move(value); - } - KeyValuePair(TKey && key, const TValue & value) - { - Key = _Move(key); - Value = value; - } - KeyValuePair(const KeyValuePair<TKey, TValue> & _that) - { - Key = _that.Key; - Value = _that.Value; - } - KeyValuePair(KeyValuePair<TKey, TValue> && _that) - { - operator=(_Move(_that)); - } - KeyValuePair & operator=(KeyValuePair<TKey, TValue> && that) - { - Key = _Move(that.Key); - Value = _Move(that.Value); - return *this; - } - KeyValuePair & operator=(const KeyValuePair<TKey, TValue> & that) - { - Key = that.Key; - Value = that.Value; - return *this; - } - HashCode getHashCode() - { + template<typename TKey, typename TValue> + class KeyValuePair + { + public: + TKey key; + TValue value; + KeyValuePair() + {} + KeyValuePair(const TKey& inKey, const TValue& inValue) + { + key = inKey; + value = inValue; + } + KeyValuePair(TKey&& inKey, TValue&& inValue) + { + key = _Move(inKey); + value = _Move(inValue); + } + KeyValuePair(TKey&& inKey, const TValue& inValue) + { + key = _Move(inKey); + value = inValue; + } + KeyValuePair(const KeyValuePair<TKey, TValue>& that) + { + key = that.key; + value = that.value; + } + KeyValuePair(KeyValuePair<TKey, TValue>&& that) + { + operator=(_Move(that)); + } + KeyValuePair& operator=(KeyValuePair<TKey, TValue>&& that) + { + key = _Move(that.key); + value = _Move(that.value); + return *this; + } + KeyValuePair& operator=(const KeyValuePair<TKey, TValue>& that) + { + key = that.key; + value = that.value; + return *this; + } + HashCode getHashCode() + { return combineHash( - Slang::getHashCode(Key), - Slang::getHashCode(Value)); - } + Slang::getHashCode(key), + Slang::getHashCode(value)); + } bool operator==(const KeyValuePair<TKey, TValue>& that) const { - return (Key == that.Key) && (Value == that.Value); + return (key == that.key) && (value == that.value); } - }; + }; - template<typename TKey, typename TValue> - inline KeyValuePair<TKey, TValue> KVPair(const TKey & k, const TValue & v) - { - return KeyValuePair<TKey, TValue>(k, v); - } + template<typename TKey, typename TValue> + inline KeyValuePair<TKey, TValue> KVPair(const TKey& k, const TValue& v) + { + return KeyValuePair<TKey, TValue>(k, v); + } - const float MaxLoadFactor = 0.7f; + const float kMaxLoadFactor = 0.7f; - template<typename TKey, typename TValue> - class Dictionary - { - friend class Iterator; - friend class ItemProxy; + template<typename TKey, typename TValue> + class Dictionary + { + friend class Iterator; + friend class ItemProxy; public: typedef TValue ValueType; typedef TKey KeyType; - typedef Dictionary ThisType; - private: - inline int GetProbeOffset(int /*probeId*/) const - { - // linear probing - return 1; - } - private: - int bucketSizeMinusOne; - int _count; - UIntSet marks; - KeyValuePair<TKey, TValue>* hashMap; - void Free() - { - if (hashMap) - delete[] hashMap; - hashMap = 0; - } - inline bool IsDeleted(int pos) const - { - return marks.contains((pos << 1) + 1); - } - inline bool IsEmpty(int pos) const - { - return !marks.contains((pos << 1)); - } - inline void SetDeleted(int pos, bool val) - { - if (val) - marks.add((pos << 1) + 1); - else - marks.remove((pos << 1) + 1); - } - inline void SetEmpty(int pos, bool val) - { - if (val) - marks.remove((pos << 1)); - else - marks.add((pos << 1)); - } - struct FindPositionResult - { - int ObjectPosition; - int InsertionPosition; - FindPositionResult() - { - ObjectPosition = -1; - InsertionPosition = -1; - } - FindPositionResult(int objPos, int insertPos) - { - ObjectPosition = objPos; - InsertionPosition = insertPos; - } + typedef Dictionary ThisType; + private: + inline int getProbeOffset(int /*probeId*/) const + { + // linear probing + return 1; + } + private: + int m_bucketCountMinusOne; + int m_count; + UIntSet m_marks; + KeyValuePair<TKey, TValue>* m_hashMap; + void deallocateAll() + { + if (m_hashMap) + delete[] m_hashMap; + m_hashMap = nullptr; + } + inline bool isDeleted(int pos) const + { + return m_marks.contains((pos << 1) + 1); + } + inline bool isEmpty(int pos) const + { + return !m_marks.contains((pos << 1)); + } + inline void setDeleted(int pos, bool val) + { + if (val) + m_marks.add((pos << 1) + 1); + else + m_marks.remove((pos << 1) + 1); + } + inline void setEmpty(int pos, bool val) + { + if (val) + m_marks.remove((pos << 1)); + else + m_marks.add((pos << 1)); + } + struct FindPositionResult + { + int objectPosition; + int insertionPosition; - }; + FindPositionResult() + { + objectPosition = -1; + insertionPosition = -1; + } + FindPositionResult(int objPos, int insertPos) + { + objectPosition = objPos; + insertionPosition = insertPos; + } + }; template<typename KeyType> - inline int GetHashPos(KeyType& key) const + inline int getHashPos(KeyType& key) const { - SLANG_ASSERT(bucketSizeMinusOne > 0); + SLANG_ASSERT(m_bucketCountMinusOne > 0); const unsigned int hash = (unsigned int)getHashCode(key); - return (hash * 2654435761u) % (unsigned int)(bucketSizeMinusOne); - } + return (hash * 2654435761u) % (unsigned int)(m_bucketCountMinusOne); + } template<typename KeyType> - FindPositionResult FindPosition(const KeyType& key) const - { - int hashPos = GetHashPos(const_cast<KeyType&>(key)); - int insertPos = -1; - int numProbes = 0; - while (numProbes <= bucketSizeMinusOne) - { - if (IsEmpty(hashPos)) - { - if (insertPos == -1) - return FindPositionResult(-1, hashPos); - else - return FindPositionResult(-1, insertPos); - } - else if (IsDeleted(hashPos)) - { - if (insertPos == -1) - insertPos = hashPos; - } - else if (hashMap[hashPos].Key == key) - { - return FindPositionResult(hashPos, -1); - } - numProbes++; - hashPos = (hashPos + GetProbeOffset(numProbes)) & bucketSizeMinusOne; - } - if (insertPos != -1) - return FindPositionResult(-1, insertPos); - SLANG_ASSERT_FAILURE("Hash map is full. This indicates an error in Key::Equal or Key::getHashCode."); - } - TValue & _Insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) - { - hashMap[pos] = _Move(kvPair); - SetEmpty(pos, false); - SetDeleted(pos, false); - return hashMap[pos].Value; - } - void Rehash() - { - if (bucketSizeMinusOne == -1 || _count >= int(MaxLoadFactor * bucketSizeMinusOne)) - { - int newSize = (bucketSizeMinusOne + 1) * 2; - if (newSize == 0) - { - newSize = 16; - } - Dictionary<TKey, TValue> newDict; - newDict.bucketSizeMinusOne = newSize - 1; - newDict.hashMap = new KeyValuePair<TKey, TValue>[newSize]; - newDict.marks.resizeAndClear(newSize * 2); - if (hashMap) - { - for (auto & kvPair : *this) - { - newDict.Add(_Move(kvPair)); - } - } - *this = _Move(newDict); - } - } + FindPositionResult findPosition(const KeyType& key) const + { + int hashPos = getHashPos(const_cast<KeyType&>(key)); + int insertPos = -1; + int numProbes = 0; + while (numProbes <= m_bucketCountMinusOne) + { + if (isEmpty(hashPos)) + { + if (insertPos == -1) + return FindPositionResult(-1, hashPos); + else + return FindPositionResult(-1, insertPos); + } + else if (isDeleted(hashPos)) + { + if (insertPos == -1) + insertPos = hashPos; + } + else if (m_hashMap[hashPos].key == key) + { + return FindPositionResult(hashPos, -1); + } + numProbes++; + hashPos = (hashPos + getProbeOffset(numProbes)) & m_bucketCountMinusOne; + } + if (insertPos != -1) + return FindPositionResult(-1, insertPos); + SLANG_ASSERT_FAILURE("Hash map is full. This indicates an error in Key::Equal or Key::getHashCode."); + } + TValue& _insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) + { + m_hashMap[pos] = _Move(kvPair); + setEmpty(pos, false); + setDeleted(pos, false); + return m_hashMap[pos].value; + } + void maybeRehash() + { + if (m_bucketCountMinusOne == -1 || m_count >= int(kMaxLoadFactor * m_bucketCountMinusOne)) + { + int newSize = (m_bucketCountMinusOne + 1) * 2; + if (newSize == 0) + { + newSize = 16; + } + Dictionary<TKey, TValue> newDict; + newDict.m_bucketCountMinusOne = newSize - 1; + newDict.m_hashMap = new KeyValuePair<TKey, TValue>[newSize]; + newDict.m_marks.resizeAndClear(newSize * 2); + if (m_hashMap) + { + for (auto& kvPair : *this) + { + newDict.add(_Move(kvPair)); + } + } + *this = _Move(newDict); + } + } - bool AddIfNotExists(KeyValuePair<TKey, TValue>&& kvPair) - { - Rehash(); - auto pos = FindPosition(kvPair.Key); - if (pos.ObjectPosition != -1) - return false; - else if (pos.InsertionPosition != -1) - { - _count++; - _Insert(_Move(kvPair), pos.InsertionPosition); - return true; - } - else - SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); - } - void Add(KeyValuePair<TKey, TValue>&& kvPair) - { - if (!AddIfNotExists(_Move(kvPair))) + bool addIfNotExists(KeyValuePair<TKey, TValue>&& kvPair) + { + maybeRehash(); + auto pos = findPosition(kvPair.key); + if (pos.objectPosition != -1) + return false; + else if (pos.insertionPosition != -1) + { + m_count++; + _insert(_Move(kvPair), pos.insertionPosition); + return true; + } + else + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); + } + void add(KeyValuePair<TKey, TValue>&& kvPair) + { + if (!addIfNotExists(_Move(kvPair))) SLANG_ASSERT_FAILURE("The key already exists in Dictionary."); - } - TValue& Set(KeyValuePair<TKey, TValue>&& kvPair) - { - Rehash(); - auto pos = FindPosition(kvPair.Key); - if (pos.ObjectPosition != -1) - return _Insert(_Move(kvPair), pos.ObjectPosition); - else if (pos.InsertionPosition != -1) - { - _count++; - return _Insert(_Move(kvPair), pos.InsertionPosition); - } - else + } + TValue& set(KeyValuePair<TKey, TValue>&& kvPair) + { + maybeRehash(); + auto pos = findPosition(kvPair.key); + if (pos.objectPosition != -1) + return _insert(_Move(kvPair), pos.objectPosition); + else if (pos.insertionPosition != -1) + { + m_count++; + return _insert(_Move(kvPair), pos.insertionPosition); + } + else SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); - } - public: - class Iterator - { - private: - const Dictionary<TKey, TValue> * dict; - int pos; - public: - KeyValuePair<TKey, TValue> & operator *() const - { - return dict->hashMap[pos]; - } - KeyValuePair<TKey, TValue> * operator ->() const - { - return dict->hashMap + pos; - } - Iterator & operator ++() - { - if (pos > dict->bucketSizeMinusOne) - return *this; - pos++; - while (pos <= dict->bucketSizeMinusOne && (dict->IsDeleted(pos) || dict->IsEmpty(pos))) - { - pos++; - } - return *this; - } - Iterator operator ++(int) - { - Iterator rs = *this; - operator++(); - return rs; - } - bool operator != (const Iterator & _that) const - { - return pos != _that.pos || dict != _that.dict; - } - bool operator == (const Iterator & _that) const - { - return pos == _that.pos && dict == _that.dict; - } - Iterator(const Dictionary<TKey, TValue> * _dict, int _pos) - { - this->dict = _dict; - this->pos = _pos; - } - Iterator() - { - this->dict = 0; - this->pos = 0; - } - }; - - Iterator begin() const - { - int pos = 0; - while (pos < bucketSizeMinusOne + 1) - { - if (IsEmpty(pos) || IsDeleted(pos)) - pos++; - else - break; - } - return Iterator(this, pos); - } - Iterator end() const - { - return Iterator(this, bucketSizeMinusOne + 1); - } - public: - void Add(const TKey & key, const TValue & value) - { - Add(KeyValuePair<TKey, TValue>(key, value)); - } - void Add(TKey && key, TValue && value) - { - Add(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); - } - bool AddIfNotExists(const TKey & key, const TValue & value) - { - return AddIfNotExists(KeyValuePair<TKey, TValue>(key, value)); - } - bool AddIfNotExists(TKey && key, TValue && value) - { - return AddIfNotExists(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); - } - void Remove(const TKey & key) - { - if (_count == 0) - return; - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) - { - SetDeleted(pos.ObjectPosition, true); - _count--; - } - } - void Clear() - { - _count = 0; + } + public: + class Iterator + { + private: + const Dictionary<TKey, TValue>* dict; + int pos; + public: + KeyValuePair<TKey, TValue>& operator*() const + { + return dict->m_hashMap[pos]; + } + KeyValuePair<TKey, TValue>* operator->() const + { + return dict->m_hashMap + pos; + } + Iterator& operator++() + { + if (pos > dict->m_bucketCountMinusOne) + return *this; + pos++; + while (pos <= dict->m_bucketCountMinusOne && (dict->isDeleted(pos) || dict->isEmpty(pos))) + { + pos++; + } + return *this; + } + Iterator operator++(int) + { + Iterator rs = *this; + operator++(); + return rs; + } + bool operator!=(const Iterator& that) const + { + return pos != that.pos || dict != that.dict; + } + bool operator==(const Iterator& that) const + { + return pos == that.pos && dict == that.dict; + } + Iterator(const Dictionary<TKey, TValue>* inDict, int inPos) + { + this->dict = inDict; + this->pos = inPos; + } + Iterator() + { + this->dict = nullptr; + this->pos = 0; + } + }; - marks.clear(); - } + Iterator begin() const + { + int pos = 0; + while (pos < m_bucketCountMinusOne + 1) + { + if (isEmpty(pos) || isDeleted(pos)) + pos++; + else + break; + } + return Iterator(this, pos); + } + Iterator end() const + { + return Iterator(this, m_bucketCountMinusOne + 1); + } + public: + void add(const TKey& key, const TValue& value) + { + add(KeyValuePair<TKey, TValue>(key, value)); + } + void add(TKey&& key, TValue&& value) + { + add(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); + } + bool addIfNotExists(const TKey& key, const TValue& value) + { + return addIfNotExists(KeyValuePair<TKey, TValue>(key, value)); + } + bool addIfNotExists(TKey&& key, TValue&& value) + { + return addIfNotExists(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); + } + void remove(const TKey& key) + { + if (m_count == 0) + return; + auto pos = findPosition(key); + if (pos.objectPosition != -1) + { + setDeleted(pos.objectPosition, true); + m_count--; + } + } + void clear() + { + m_count = 0; + m_marks.clear(); + } - TValue* TryGetValueOrAdd(const TKey& key, const TValue& value) + TValue* tryGetValueOrAdd(const TKey& key, const TValue& value) { - Rehash(); - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) + maybeRehash(); + auto pos = findPosition(key); + if (pos.objectPosition != -1) { - return &hashMap[pos.ObjectPosition].Value; + return &m_hashMap[pos.objectPosition].value; } - else if (pos.InsertionPosition != -1) + else if (pos.insertionPosition != -1) { // Make pair KeyValuePair<TKey, TValue> kvPair(_Move(key), _Move(value)); - _count++; - _Insert(_Move(kvPair), pos.InsertionPosition); + m_count++; + _insert(_Move(kvPair), pos.insertionPosition); return nullptr; } else SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } - /// This differs from TryGetValueOrAdd, in that it always returns the Value held in the Dictionary. + /// This differs from tryGetValueOrAdd, in that it always returns the Value held in the Dictionary. /// If there isn't already an entry for 'key', a value is added with defaultValue. - TValue& GetOrAddValue(const TKey& key, const TValue& defaultValue) + TValue& getOrAddValue(const TKey& key, const TValue& defaultValue) { - Rehash(); - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) + maybeRehash(); + auto pos = findPosition(key); + if (pos.objectPosition != -1) { - return hashMap[pos.ObjectPosition].Value; + return m_hashMap[pos.objectPosition].value; } - else if (pos.InsertionPosition != -1) + else if (pos.insertionPosition != -1) { // Make pair KeyValuePair<TKey, TValue> kvPair(_Move(key), _Move(defaultValue)); - _count++; - return _Insert(_Move(kvPair), pos.InsertionPosition); + m_count++; + return _insert(_Move(kvPair), pos.insertionPosition); } else SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } - void Set(const TKey& key, const TValue& value) - { - if (auto ptr = TryGetValueOrAdd(key, value)) - { - *ptr = value; - } - } + void set(const TKey& key, const TValue& value) + { + if (auto ptr = tryGetValueOrAdd(key, value)) + { + *ptr = value; + } + } template<typename KeyType> - bool ContainsKey(const KeyType& key) const - { - if (bucketSizeMinusOne == -1) - return false; - auto pos = FindPosition(key); - return pos.ObjectPosition != -1; - } + bool containsKey(const KeyType& key) const + { + if (m_bucketCountMinusOne == -1) + return false; + auto pos = findPosition(key); + return pos.objectPosition != -1; + } template<typename KeyType> - bool TryGetValue(const KeyType& key, TValue& value) const - { - if (bucketSizeMinusOne == -1) - return false; - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) - { - value = hashMap[pos.ObjectPosition].Value; - return true; - } - return false; - } + bool tryGetValue(const KeyType& key, TValue& value) const + { + if (m_bucketCountMinusOne == -1) + return false; + auto pos = findPosition(key); + if (pos.objectPosition != -1) + { + value = m_hashMap[pos.objectPosition].value; + return true; + } + return false; + } template<typename KeyType> - TValue* TryGetValue(const KeyType& key) const - { - if (bucketSizeMinusOne == -1) - return nullptr; - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) - { - return &hashMap[pos.ObjectPosition].Value; - } - return nullptr; - } + TValue* tryGetValue(const KeyType& key) const + { + if (m_bucketCountMinusOne == -1) + return nullptr; + auto pos = findPosition(key); + if (pos.objectPosition != -1) + { + return &m_hashMap[pos.objectPosition].value; + } + return nullptr; + } - class ItemProxy - { - private: - const Dictionary<TKey, TValue> * dict; - TKey key; - public: - ItemProxy(const TKey& _key, const Dictionary<TKey, TValue>* _dict) - { - this->dict = _dict; - this->key = _key; - } - ItemProxy(TKey&& _key, const Dictionary<TKey, TValue>* _dict) - { - this->dict = _dict; - this->key = _Move(_key); - } - TValue & GetValue() const - { - auto pos = dict->FindPosition(key); - if (pos.ObjectPosition != -1) - { - return dict->hashMap[pos.ObjectPosition].Value; - } - else + class ItemProxy + { + private: + const Dictionary<TKey, TValue>* dict; + TKey key; + public: + ItemProxy(const TKey& _key, const Dictionary<TKey, TValue>* _dict) + { + this->dict = _dict; + this->key = _key; + } + ItemProxy(TKey&& _key, const Dictionary<TKey, TValue>* _dict) + { + this->dict = _dict; + this->key = _Move(_key); + } + TValue& getValue() const + { + auto pos = dict->findPosition(key); + if (pos.objectPosition != -1) + { + return dict->m_hashMap[pos.objectPosition].value; + } + else SLANG_ASSERT_FAILURE("The key does not exist in dictionary."); - } - inline TValue & operator()() const - { - return GetValue(); - } - operator TValue&() const - { - return GetValue(); - } - TValue & operator = (const TValue & val) const - { - return ((Dictionary<TKey, TValue>*)dict)->Set(KeyValuePair<TKey, TValue>(_Move(key), val)); - } - TValue & operator = (TValue && val) const - { - return ((Dictionary<TKey, TValue>*)dict)->Set(KeyValuePair<TKey, TValue>(_Move(key), _Move(val))); - } - }; - ItemProxy operator [](const TKey & key) const - { - return ItemProxy(key, this); - } - ItemProxy operator [](TKey && key) const - { - return ItemProxy(_Move(key), this); - } - int Count() const - { - return _count; - } + } + inline TValue& operator()() const + { + return getValue(); + } + operator TValue&() const + { + return getValue(); + } + TValue& operator=(const TValue& val) const + { + return ((Dictionary<TKey, TValue>*)dict)->set(KeyValuePair<TKey, TValue>(_Move(key), val)); + } + TValue& operator=(TValue&& val) const + { + return ((Dictionary<TKey, TValue>*)dict)->set(KeyValuePair<TKey, TValue>(_Move(key), _Move(val))); + } + }; + ItemProxy operator[](const TKey& key) const + { + return ItemProxy(key, this); + } + ItemProxy operator[](TKey&& key) const + { + return ItemProxy(_Move(key), this); + } + int getCount() const + { + return m_count; + } - /// Swap this with rhs - void swapWith(ThisType& rhs); + /// Swap this with rhs + void swapWith(ThisType& rhs); - private: - template<typename... Args> - void Init(const KeyValuePair<TKey, TValue> & kvPair, Args... args) - { - Add(kvPair); - Init(args...); - } - public: - Dictionary() - { - bucketSizeMinusOne = -1; - _count = 0; - hashMap = nullptr; - } - template<typename Arg, typename... Args> - Dictionary(Arg arg, Args... args) - { - Init(arg, args...); - } - Dictionary(const Dictionary<TKey, TValue>& other) - : bucketSizeMinusOne(-1), _count(0), hashMap(nullptr) - { - *this = other; - } - Dictionary(Dictionary<TKey, TValue>&& other) - : bucketSizeMinusOne(-1), _count(0), hashMap(nullptr) - { - *this = (_Move(other)); - } - Dictionary<TKey, TValue>& operator = (const Dictionary<TKey, TValue>& other) - { - if (this == &other) - return *this; - Free(); - bucketSizeMinusOne = other.bucketSizeMinusOne; - _count = other._count; - hashMap = new KeyValuePair<TKey, TValue>[other.bucketSizeMinusOne + 1]; - marks = other.marks; - for (int i = 0; i <= bucketSizeMinusOne; i++) - hashMap[i] = other.hashMap[i]; - return *this; - } - Dictionary<TKey, TValue> & operator = (Dictionary<TKey, TValue>&& other) - { - if (this == &other) - return *this; - Free(); - bucketSizeMinusOne = other.bucketSizeMinusOne; - _count = other._count; - hashMap = other.hashMap; - marks = _Move(other.marks); - other.hashMap = 0; - other._count = 0; - other.bucketSizeMinusOne = -1; - return *this; - } - ~Dictionary() - { - Free(); - } - }; + private: + template<typename... Args> + void init(const KeyValuePair<TKey, TValue>& kvPair, Args... args) + { + add(kvPair); + init(args...); + } + public: + Dictionary() + { + m_bucketCountMinusOne = -1; + m_count = 0; + m_hashMap = nullptr; + } + template<typename Arg, typename... Args> + Dictionary(Arg arg, Args... args) + { + init(arg, args...); + } + Dictionary(const Dictionary<TKey, TValue>& other) + : m_bucketCountMinusOne(-1), m_count(0), m_hashMap(nullptr) + { + *this = other; + } + Dictionary(Dictionary<TKey, TValue>&& other) + : m_bucketCountMinusOne(-1), m_count(0), m_hashMap(nullptr) + { + *this = (_Move(other)); + } + Dictionary<TKey, TValue>& operator=(const Dictionary<TKey, TValue>& other) + { + if (this == &other) + return *this; + deallocateAll(); + m_bucketCountMinusOne = other.m_bucketCountMinusOne; + m_count = other.m_count; + m_hashMap = new KeyValuePair<TKey, TValue>[other.m_bucketCountMinusOne + 1]; + m_marks = other.m_marks; + for (int i = 0; i <= m_bucketCountMinusOne; i++) + m_hashMap[i] = other.m_hashMap[i]; + return *this; + } + Dictionary<TKey, TValue>& operator=(Dictionary<TKey, TValue>&& other) + { + if (this == &other) + return *this; + deallocateAll(); + m_bucketCountMinusOne = other.m_bucketCountMinusOne; + m_count = other.m_count; + m_hashMap = other.m_hashMap; + m_marks = _Move(other.m_marks); + other.m_hashMap = nullptr; + other.m_count = 0; + other.m_bucketCountMinusOne = -1; + return *this; + } + ~Dictionary() + { + deallocateAll(); + } + }; - // --------------------------------------------------------- - template<typename TKey, typename TValue> - void Dictionary<TKey, TValue>::swapWith(ThisType& rhs) - { - Swap(bucketSizeMinusOne, rhs.bucketSizeMinusOne); - Swap(_count, rhs._count); - marks.swapWith(rhs.marks); - Swap(hashMap, rhs.hashMap); - } + // --------------------------------------------------------- + template<typename TKey, typename TValue> + void Dictionary<TKey, TValue>::swapWith(ThisType& rhs) + { + Swap(m_bucketCountMinusOne, rhs.m_bucketCountMinusOne); + Swap(m_count, rhs.m_count); + m_marks.swapWith(rhs.m_marks); + Swap(m_hashMap, rhs.m_hashMap); + } - class _DummyClass - {}; + /* We may want to rename this, as strictly speaking _Caps names are reserved */ + class _DummyClass + {}; - template<typename T, typename DictionaryType> - class HashSetBase - { - protected: - DictionaryType dict; - private: - template<typename... Args> - void Init(const T & v, Args... args) - { - Add(v); - Init(args...); - } - public: - HashSetBase() - {} - template<typename Arg, typename... Args> - HashSetBase(Arg arg, Args... args) - { - Init(arg, args...); - } - HashSetBase(const HashSetBase & set) - { - operator=(set); - } - HashSetBase(HashSetBase && set) - { - operator=(_Move(set)); - } - HashSetBase & operator = (const HashSetBase & set) - { - dict = set.dict; - return *this; - } - HashSetBase & operator = (HashSetBase && set) - { - dict = _Move(set.dict); - return *this; - } - public: - class Iterator - { - private: - typename DictionaryType::Iterator iter; - public: - Iterator() = default; - T & operator *() const - { - return (*iter).Key; - } - T * operator ->() const - { - return &(*iter).Key; - } - Iterator & operator ++() - { - ++iter; - return *this; - } - Iterator operator ++(int) - { - Iterator rs = *this; - operator++(); - return rs; - } - bool operator != (const Iterator & _that) const - { - return iter != _that.iter; - } - bool operator == (const Iterator & _that) const - { - return iter == _that.iter; - } - Iterator(const typename DictionaryType::Iterator & _iter) - { - this->iter = _iter; - } - }; - Iterator begin() const - { - return Iterator(dict.begin()); - } - Iterator end() const - { - return Iterator(dict.end()); - } - public: - int Count() const - { - return dict.Count(); - } - void Clear() - { - dict.Clear(); - } - bool Add(const T& obj) - { - return dict.AddIfNotExists(obj, _DummyClass()); - } - bool Add(T && obj) - { - return dict.AddIfNotExists(_Move(obj), _DummyClass()); - } + template<typename T, typename DictionaryType> + class HashSetBase + { + protected: + DictionaryType dict; + private: + template<typename... Args> + void init(const T& v, Args... args) + { + add(v); + init(args...); + } + public: + HashSetBase() + {} + template<typename Arg, typename... Args> + HashSetBase(Arg arg, Args... args) + { + init(arg, args...); + } + HashSetBase(const HashSetBase& set) + { + operator=(set); + } + HashSetBase(HashSetBase&& set) + { + operator=(_Move(set)); + } + HashSetBase& operator=(const HashSetBase& set) + { + dict = set.dict; + return *this; + } + HashSetBase& operator=(HashSetBase&& set) + { + dict = _Move(set.dict); + return *this; + } + public: + class Iterator + { + private: + typename DictionaryType::Iterator iter; + public: + Iterator() = default; + T& operator*() const + { + return (*iter).key; + } + T* operator->() const + { + return &(*iter).key; + } + Iterator& operator++() + { + ++iter; + return *this; + } + Iterator operator++(int) + { + Iterator rs = *this; + operator++(); + return rs; + } + bool operator!=(const Iterator& that) const + { + return iter != that.iter; + } + bool operator==(const Iterator& that) const + { + return iter == that.iter; + } + Iterator(const typename DictionaryType::Iterator& _iter) + { + this->iter = _iter; + } + }; + Iterator begin() const + { + return Iterator(dict.begin()); + } + Iterator end() const + { + return Iterator(dict.end()); + } + public: + int getCount() const + { + return dict.getCount(); + } + void clear() + { + dict.clear(); + } bool add(const T& obj) { - return dict.AddIfNotExists(obj, _DummyClass()); + return dict.addIfNotExists(obj, _DummyClass()); } bool add(T&& obj) { - return dict.AddIfNotExists(_Move(obj), _DummyClass()); - } - void Remove(const T & obj) - { - dict.Remove(obj); - } - bool Contains(const T & obj) const - { - return dict.ContainsKey(obj); - } - }; - template <typename T> - class HashSet : public HashSetBase<T, Dictionary<T, _DummyClass>> - {}; + return dict.addIfNotExists(_Move(obj), _DummyClass()); + } + void remove(const T& obj) + { + dict.remove(obj); + } + bool contains(const T& obj) const + { + return dict.containsKey(obj); + } + }; + template <typename T> + class HashSet : public HashSetBase<T, Dictionary<T, _DummyClass>> + {}; template <typename TKey, typename TValue> class OrderedDictionary @@ -691,158 +683,158 @@ namespace Slang friend class ItemProxy; private: - inline int GetProbeOffset(int /*probeIdx*/) const + inline int getProbeOffset(int /*probeIdx*/) const { // quadratic probing return 1; } private: - int bucketSizeMinusOne; - int _count; - UIntSet marks; + int m_bucketCountMinusOne; + int m_count; + UIntSet m_marks; - LinkedList<KeyValuePair<TKey, TValue>> kvPairs; - LinkedNode<KeyValuePair<TKey, TValue>>** hashMap; - void Free() + LinkedList<KeyValuePair<TKey, TValue>> m_kvPairs; + LinkedNode<KeyValuePair<TKey, TValue>>** m_hashMap; + void deallocateAll() { - if (hashMap) - delete[] hashMap; - hashMap = 0; - kvPairs.Clear(); + if (m_hashMap) + delete[] m_hashMap; + m_hashMap = nullptr; + m_kvPairs.clear(); } - inline bool IsDeleted(int pos) const { return marks.contains((pos << 1) + 1); } - inline bool IsEmpty(int pos) const { return !marks.contains((pos << 1)); } - inline void SetDeleted(int pos, bool val) + inline bool isDeleted(int pos) const { return m_marks.contains((pos << 1) + 1); } + inline bool isEmpty(int pos) const { return !m_marks.contains((pos << 1)); } + inline void setDeleted(int pos, bool val) { if (val) - marks.add((pos << 1) + 1); + m_marks.add((pos << 1) + 1); else - marks.remove((pos << 1) + 1); + m_marks.remove((pos << 1) + 1); } - inline void SetEmpty(int pos, bool val) + inline void setEmpty(int pos, bool val) { if (val) - marks.remove((pos << 1)); + m_marks.remove((pos << 1)); else - marks.add((pos << 1)); + m_marks.add((pos << 1)); } struct FindPositionResult { - int ObjectPosition; - int InsertionPosition; + int objectPosition; + int insertionPosition; FindPositionResult() { - ObjectPosition = -1; - InsertionPosition = -1; + objectPosition = -1; + insertionPosition = -1; } FindPositionResult(int objPos, int insertPos) { - ObjectPosition = objPos; - InsertionPosition = insertPos; + objectPosition = objPos; + insertionPosition = insertPos; } }; - template <typename T> inline int GetHashPos(T& key) const + template <typename T> inline int getHashPos(T& key) const { const unsigned int hash = (unsigned int)getHashCode(key); - return ((unsigned int)(hash * 2654435761)) % bucketSizeMinusOne; + return ((unsigned int)(hash * 2654435761)) % m_bucketCountMinusOne; } - template <typename T> FindPositionResult FindPosition(const T& key) const + template <typename T> FindPositionResult findPosition(const T& key) const { - int hashPos = GetHashPos((T&)key); + int hashPos = getHashPos((T&)key); int insertPos = -1; int numProbes = 0; - while (numProbes <= bucketSizeMinusOne) + while (numProbes <= m_bucketCountMinusOne) { - if (IsEmpty(hashPos)) + if (isEmpty(hashPos)) { if (insertPos == -1) return FindPositionResult(-1, hashPos); else return FindPositionResult(-1, insertPos); } - else if (IsDeleted(hashPos)) + else if (isDeleted(hashPos)) { if (insertPos == -1) insertPos = hashPos; } - else if (hashMap[hashPos]->Value.Key == key) + else if (m_hashMap[hashPos]->value.key == key) { return FindPositionResult(hashPos, -1); } numProbes++; - hashPos = (hashPos + GetProbeOffset(numProbes)) & bucketSizeMinusOne; + hashPos = (hashPos + getProbeOffset(numProbes)) & m_bucketCountMinusOne; } if (insertPos != -1) return FindPositionResult(-1, insertPos); SLANG_ASSERT_FAILURE("Hash map is full. This indicates an error in Key::Equal or Key::GetHashCode."); } - TValue& _Insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) + TValue& _insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) { - auto node = kvPairs.AddLast(); - node->Value = _Move(kvPair); - hashMap[pos] = node; - SetEmpty(pos, false); - SetDeleted(pos, false); - return node->Value.Value; + auto node = m_kvPairs.addLast(); + node->value = _Move(kvPair); + m_hashMap[pos] = node; + setEmpty(pos, false); + setDeleted(pos, false); + return node->value.value; } - void Rehash() + void maybeRehash() { - if (bucketSizeMinusOne == -1 || _count / (float)bucketSizeMinusOne >= MaxLoadFactor) + if (m_bucketCountMinusOne == -1 || m_count / (float)m_bucketCountMinusOne >= kMaxLoadFactor) { - int newSize = (bucketSizeMinusOne + 1) * 2; + int newSize = (m_bucketCountMinusOne + 1) * 2; if (newSize == 0) { newSize = 16; } OrderedDictionary<TKey, TValue> newDict; - newDict.bucketSizeMinusOne = newSize - 1; - newDict.hashMap = new LinkedNode<KeyValuePair<TKey, TValue>>*[newSize]; - newDict.marks.resizeAndClear(newSize * 2); - if (hashMap) + newDict.m_bucketCountMinusOne = newSize - 1; + newDict.m_hashMap = new LinkedNode<KeyValuePair<TKey, TValue>>*[newSize]; + newDict.m_marks.resizeAndClear(newSize * 2); + if (m_hashMap) { for (auto& kvPair : *this) { - newDict.Add(_Move(kvPair)); + newDict.add(_Move(kvPair)); } } *this = _Move(newDict); } } - bool AddIfNotExists(KeyValuePair<TKey, TValue>&& kvPair) + bool addIfNotExists(KeyValuePair<TKey, TValue>&& kvPair) { - Rehash(); - auto pos = FindPosition(kvPair.Key); - if (pos.ObjectPosition != -1) + maybeRehash(); + auto pos = findPosition(kvPair.key); + if (pos.objectPosition != -1) return false; - else if (pos.InsertionPosition != -1) + else if (pos.insertionPosition != -1) { - _count++; - _Insert(_Move(kvPair), pos.InsertionPosition); + m_count++; + _insert(_Move(kvPair), pos.insertionPosition); return true; } else SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } - void Add(KeyValuePair<TKey, TValue>&& kvPair) + void add(KeyValuePair<TKey, TValue>&& kvPair) { - if (!AddIfNotExists(_Move(kvPair))) + if (!addIfNotExists(_Move(kvPair))) SLANG_ASSERT_FAILURE("The key already exists in Dictionary."); } - TValue& Set(KeyValuePair<TKey, TValue>&& kvPair) + TValue& set(KeyValuePair<TKey, TValue>&& kvPair) { - Rehash(); - auto pos = FindPosition(kvPair.Key); - if (pos.ObjectPosition != -1) + maybeRehash(); + auto pos = findPosition(kvPair.key); + if (pos.objectPosition != -1) { - hashMap[pos.ObjectPosition]->Delete(); - return _Insert(_Move(kvPair), pos.ObjectPosition); + m_hashMap[pos.objectPosition]->removeAndDelete(); + return _insert(_Move(kvPair), pos.objectPosition); } - else if (pos.InsertionPosition != -1) + else if (pos.insertionPosition != -1) { - _count++; - return _Insert(_Move(kvPair), pos.InsertionPosition); + m_count++; + return _insert(_Move(kvPair), pos.insertionPosition); } else SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); @@ -853,76 +845,76 @@ namespace Slang typename LinkedList<KeyValuePair<TKey, TValue>>::Iterator begin() const { - return kvPairs.begin(); + return m_kvPairs.begin(); } typename LinkedList<KeyValuePair<TKey, TValue>>::Iterator end() const { - return kvPairs.end(); + return m_kvPairs.end(); } public: - void Add(const TKey& key, const TValue& value) + void add(const TKey& key, const TValue& value) { - Add(KeyValuePair<TKey, TValue>(key, value)); + add(KeyValuePair<TKey, TValue>(key, value)); } - void Add(TKey&& key, TValue&& value) + void add(TKey&& key, TValue&& value) { - Add(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); + add(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); } - bool AddIfNotExists(const TKey& key, const TValue& value) + bool addIfNotExists(const TKey& key, const TValue& value) { - return AddIfNotExists(KeyValuePair<TKey, TValue>(key, value)); + return addIfNotExists(KeyValuePair<TKey, TValue>(key, value)); } - bool AddIfNotExists(TKey&& key, TValue&& value) + bool addIfNotExists(TKey&& key, TValue&& value) { - return AddIfNotExists(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); + return addIfNotExists(KeyValuePair<TKey, TValue>(_Move(key), _Move(value))); } - void Remove(const TKey& key) + void remove(const TKey& key) { - if (_count > 0) + if (m_count > 0) { - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) + auto pos = findPosition(key); + if (pos.objectPosition != -1) { - kvPairs.Delete(hashMap[pos.ObjectPosition]); - hashMap[pos.ObjectPosition] = 0; - SetDeleted(pos.ObjectPosition, true); - _count--; + m_kvPairs.removeAndDelete(m_hashMap[pos.objectPosition]); + m_hashMap[pos.objectPosition] = 0; + setDeleted(pos.objectPosition, true); + m_count--; } } } - void Clear() + void clear() { - _count = 0; - kvPairs.Clear(); - marks.clear(); + m_count = 0; + m_kvPairs.clear(); + m_marks.clear(); } - template <typename T> bool ContainsKey(const T& key) const + template <typename T> bool containsKey(const T& key) const { - if (bucketSizeMinusOne == -1) + if (m_bucketCountMinusOne == -1) return false; - auto pos = FindPosition(key); - return pos.ObjectPosition != -1; + auto pos = findPosition(key); + return pos.objectPosition != -1; } - template <typename T> TValue* TryGetValue(const T& key) const + template <typename T> TValue* tryGetValue(const T& key) const { - if (bucketSizeMinusOne == -1) + if (m_bucketCountMinusOne == -1) return nullptr; - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) + auto pos = findPosition(key); + if (pos.objectPosition != -1) { - return &(hashMap[pos.ObjectPosition]->Value.Value); + return &(m_hashMap[pos.objectPosition]->value.value); } return nullptr; } - template <typename T> bool TryGetValue(const T& key, TValue& value) const + template <typename T> bool tryGetValue(const T& key, TValue& value) const { - if (bucketSizeMinusOne == -1) + if (m_bucketCountMinusOne == -1) return false; - auto pos = FindPosition(key); - if (pos.ObjectPosition != -1) + auto pos = findPosition(key); + if (pos.objectPosition != -1) { - value = hashMap[pos.ObjectPosition]->Value.Value; + value = m_hashMap[pos.objectPosition]->value.value; return true; } return false; @@ -944,67 +936,68 @@ namespace Slang this->dict = _dict; this->key = _Move(_key); } - TValue& GetValue() const + TValue& getValue() const { - auto pos = dict->FindPosition(key); - if (pos.ObjectPosition != -1) + auto pos = dict->findPosition(key); + if (pos.objectPosition != -1) { - return dict->hashMap[pos.ObjectPosition]->Value.Value; + return dict->m_hashMap[pos.objectPosition]->value.value; } else { SLANG_ASSERT_FAILURE("The key does not exists in dictionary."); } } - inline TValue& operator()() const { return GetValue(); } - operator TValue&() const { return GetValue(); } + inline TValue& operator()() const { return getValue(); } + operator TValue&() const { return getValue(); } TValue& operator=(const TValue& val) { return ((OrderedDictionary<TKey, TValue>*)dict) - ->Set(KeyValuePair<TKey, TValue>(_Move(key), val)); + ->set(KeyValuePair<TKey, TValue>(_Move(key), val)); } TValue& operator=(TValue&& val) { return ((OrderedDictionary<TKey, TValue>*)dict) - ->Set(KeyValuePair<TKey, TValue>(_Move(key), _Move(val))); + ->set(KeyValuePair<TKey, TValue>(_Move(key), _Move(val))); } }; ItemProxy operator[](const TKey& key) const { return ItemProxy(key, this); } ItemProxy operator[](TKey&& key) const { return ItemProxy(_Move(key), this); } - int Count() const { return _count; } - KeyValuePair<TKey, TValue>& First() const { return kvPairs.First(); } - KeyValuePair<TKey, TValue>& Last() const { return kvPairs.Last(); } + + int getCount() const { return m_count; } + KeyValuePair<TKey, TValue>& getFirst() const { return m_kvPairs.getFirst(); } + KeyValuePair<TKey, TValue>& getLast() const { return m_kvPairs.getLast(); } private: template <typename... Args> - void Init(const KeyValuePair<TKey, TValue>& kvPair, Args... args) + void init(const KeyValuePair<TKey, TValue>& kvPair, Args... args) { - Add(kvPair); - Init(args...); + add(kvPair); + init(args...); } public: OrderedDictionary() { - bucketSizeMinusOne = -1; - _count = 0; - hashMap = 0; + m_bucketCountMinusOne = -1; + m_count = 0; + m_hashMap = 0; } template <typename Arg, typename... Args> OrderedDictionary(Arg arg, Args... args) { - Init(arg, args...); + init(arg, args...); } OrderedDictionary(const OrderedDictionary<TKey, TValue>& other) - : bucketSizeMinusOne(-1) - , _count(0) - , hashMap(0) + : m_bucketCountMinusOne(-1) + , m_count(0) + , m_hashMap(0) { *this = other; } OrderedDictionary(OrderedDictionary<TKey, TValue>&& other) - : bucketSizeMinusOne(-1) - , _count(0) - , hashMap(0) + : m_bucketCountMinusOne(-1) + , m_count(0) + , m_hashMap(0) { *this = (_Move(other)); } @@ -1013,9 +1006,9 @@ namespace Slang { if (this == &other) return *this; - Clear(); + clear(); for (auto& item : other) - Add(item.Key, item.Value); + add(item.key, item.value); return *this; } OrderedDictionary<TKey, TValue>& @@ -1023,18 +1016,18 @@ namespace Slang { if (this == &other) return *this; - Free(); - bucketSizeMinusOne = other.bucketSizeMinusOne; - _count = other._count; - hashMap = other.hashMap; - marks = _Move(other.marks); - other.hashMap = 0; - other._count = 0; - other.bucketSizeMinusOne = -1; - kvPairs = _Move(other.kvPairs); + deallocateAll(); + m_bucketCountMinusOne = other.m_bucketCountMinusOne; + m_count = other.m_count; + m_hashMap = other.m_hashMap; + m_marks = _Move(other.m_marks); + other.m_hashMap = 0; + other.m_count = 0; + other.m_bucketCountMinusOne = -1; + m_kvPairs = _Move(other.m_kvPairs); return *this; } - ~OrderedDictionary() { Free(); } + ~OrderedDictionary() { deallocateAll(); } }; template <typename T> class OrderedHashSet : public HashSetBase<T, OrderedDictionary<T, _DummyClass>> @@ -1042,11 +1035,11 @@ namespace Slang public: T& getLast() { - return this->dict.Last().Key; + return this->dict.getLast().key; } void removeLast() { - this->Remove(getLast()); + this->remove(getLast()); } }; } diff --git a/source/core/slang-file-system.cpp b/source/core/slang-file-system.cpp index db75e5365..e6d84cac1 100644 --- a/source/core/slang-file-system.cpp +++ b/source/core/slang-file-system.cpp @@ -199,7 +199,7 @@ SlangResult OSFileSystem::enumeratePathContents(const char* path, FileSystemCont { void accept(Path::Type type, const UnownedStringSlice& filename) SLANG_OVERRIDE { - m_buffer.Clear(); + m_buffer.clear(); m_buffer.append(filename); SlangPathType pathType; @@ -321,7 +321,7 @@ CacheFileSystem::~CacheFileSystem() { for (const auto& pair : m_uniqueIdentityMap) { - PathInfo* pathInfo = pair.Value; + PathInfo* pathInfo = pair.value; delete pathInfo; } } @@ -376,12 +376,12 @@ void CacheFileSystem::clearCache() { for (const auto& pair : m_uniqueIdentityMap) { - PathInfo* pathInfo = pair.Value; + PathInfo* pathInfo = pair.value; delete pathInfo; } - m_uniqueIdentityMap.Clear(); - m_pathMap.Clear(); + m_uniqueIdentityMap.clear(); + m_pathMap.clear(); if (m_fileSystemExt) { @@ -438,7 +438,7 @@ SlangResult CacheFileSystem::enumeratePathContents(const char* path, FileSystemC { // NOTE! The currentPath can be a *non* simplified path (the m_pathMap is the cache of paths simplified and other to a file/directory) // Also note that there will always be the simplified version of the path in cache. - const String& currentPath = pair.Key; + const String& currentPath = pair.key; // If it doesn't start with simplified path, then it can't be a hit if (!currentPath.startsWith(simplifiedPath)) @@ -468,7 +468,7 @@ SlangResult CacheFileSystem::enumeratePathContents(const char* path, FileSystemC // Let's check that fact... SLANG_ASSERT(foundPath[remaining.getLength()] == 0); - PathInfo* pathInfo = pair.Value; + PathInfo* pathInfo = pair.value; SlangPathType pathType; if (SLANG_FAILED(_getPathType(pathInfo, currentPath.getBuffer(), &pathType))) @@ -581,11 +581,11 @@ CacheFileSystem::PathInfo* CacheFileSystem::_resolveUniqueIdentityCacheInfo(cons // Now try looking up by uniqueIdentity path. If not found, add a new result PathInfo* pathInfo = nullptr; - if (!m_uniqueIdentityMap.TryGetValue(uniqueIdentity, pathInfo)) + if (!m_uniqueIdentityMap.tryGetValue(uniqueIdentity, pathInfo)) { // Create with found uniqueIdentity pathInfo = new PathInfo(uniqueIdentity); - m_uniqueIdentityMap.Add(uniqueIdentity, pathInfo); + m_uniqueIdentityMap.add(uniqueIdentity, pathInfo); } // At this point they must have same uniqueIdentity @@ -623,7 +623,7 @@ CacheFileSystem::PathInfo* CacheFileSystem::_resolvePathCacheInfo(const String& { // Lookup in path cache PathInfo* pathInfo; - if (m_pathMap.TryGetValue(path, pathInfo)) + if (m_pathMap.tryGetValue(path, pathInfo)) { // Found so done return pathInfo; @@ -632,7 +632,7 @@ CacheFileSystem::PathInfo* CacheFileSystem::_resolvePathCacheInfo(const String& // Try getting or creating taking into account possible path simplification pathInfo = _resolveSimplifiedPathCacheInfo(path); // Always add the result to the path cache (even if null) - m_pathMap.Add(path, pathInfo); + m_pathMap.add(path, pathInfo); return pathInfo; } diff --git a/source/core/slang-implicit-directory-collector.cpp b/source/core/slang-implicit-directory-collector.cpp index 994ebd4d7..169deeb30 100644 --- a/source/core/slang-implicit-directory-collector.cpp +++ b/source/core/slang-implicit-directory-collector.cpp @@ -77,8 +77,8 @@ SlangResult ImplicitDirectoryCollector::enumerate(FileSystemContentsCallBack cal { const auto& pair = m_map.getAt(i); - UnownedStringSlice path = pair.Key; - SlangPathType pathType = SlangPathType(pair.Value); + UnownedStringSlice path = pair.key; + SlangPathType pathType = SlangPathType(pair.value); // Note *is* 0 terminated in the pool // Let's check tho diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index 30ba41d0f..50e98c60c 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -324,7 +324,7 @@ namespace Slang /* static */void Path::combineIntoBuilder(const UnownedStringSlice& path1, const UnownedStringSlice& path2, StringBuilder& outBuilder) { - outBuilder.Clear(); + outBuilder.clear(); outBuilder.Append(path1); append(outBuilder, path2); } @@ -519,7 +519,7 @@ namespace Slang /* static */void Path::join(const UnownedStringSlice* slices, Index count, StringBuilder& out) { - out.Clear(); + out.clear(); if (count == 0) { diff --git a/source/core/slang-linked-list.h b/source/core/slang-linked-list.h index 38da2ccce..41709c9d0 100644 --- a/source/core/slang-linked-list.h +++ b/source/core/slang-linked-list.h @@ -21,17 +21,17 @@ private: LinkedList<T>* list; public: - T Value; + T value; LinkedNode(LinkedList<T>* lnk) : list(lnk) { }; - LinkedNode<T>* GetPrevious() { return prev; }; - LinkedNode<T>* GetNext() { return next; }; - LinkedNode<T>* InsertAfter(const T& nData) + LinkedNode<T>* getPrevious() { return prev; }; + LinkedNode<T>* getNext() { return next; }; + LinkedNode<T>* insertAfter(const T& nData) { LinkedNode<T>* n = new LinkedNode<T>(list); - n->Value = nData; + n->value = nData; n->prev = this; n->next = this->next; LinkedNode<T>* npp = n->next; @@ -45,10 +45,10 @@ public: list->count++; return n; }; - LinkedNode<T>* InsertBefore(const T& nData) + LinkedNode<T>* insertBefore(const T& nData) { LinkedNode<T>* n = new LinkedNode<T>(list); - n->Value = nData; + n->value = nData; n->prev = prev; n->next = this; prev = n; @@ -60,7 +60,7 @@ public: list->count++; return n; }; - void Delete() + void removeAndDelete() { if (prev) prev->next = next; @@ -84,38 +84,38 @@ template <typename T> class LinkedList template <typename T1> friend class LinkedNode; private: - LinkedNode<T>*head, *tail; + LinkedNode<T>* head, *tail; int count; public: class Iterator { public: - LinkedNode<T>*Current, *Next; - void SetCurrent(LinkedNode<T>* cur) + LinkedNode<T>* current, *next; + void setCurrent(LinkedNode<T>* cur) { - Current = cur; - if (Current) - Next = Current->GetNext(); + current = cur; + if (current) + next = current->getNext(); else - Next = 0; + next = 0; } - Iterator() { Current = Next = 0; } - Iterator(LinkedNode<T>* cur) { SetCurrent(cur); } - T& operator*() const { return Current->Value; } + Iterator() { current = next = nullptr; } + Iterator(LinkedNode<T>* cur) { setCurrent(cur); } + T& operator*() const { return current->value; } Iterator& operator++() { - SetCurrent(Next); + setCurrent(next); return *this; } Iterator operator++(int) { Iterator rs = *this; - SetCurrent(Next); + setCurrent(next); return rs; } - bool operator!=(const Iterator& iter) const { return Current != iter.Current; } - bool operator==(const Iterator& iter) const { return Current == iter.Current; } + bool operator!=(const Iterator& iter) const { return current != iter.current; } + bool operator==(const Iterator& iter) const { return current == iter.current; } }; Iterator begin() const { return Iterator(head); } Iterator end() const { return Iterator(0); } @@ -126,7 +126,7 @@ public: , tail(0) , count(0) {} - ~LinkedList() { Clear(); } + ~LinkedList() { clear(); } LinkedList(const LinkedList<T>& link) : head(0) , tail(0) @@ -144,39 +144,39 @@ public: LinkedList<T>& operator=(LinkedList<T>&& link) { if (head != 0) - Clear(); + clear(); head = link.head; tail = link.tail; count = link.count; link.head = 0; link.tail = 0; link.count = 0; - for (auto node = head; node; node = node->GetNext()) + for (auto node = head; node; node = node->getNext()) node->list = this; return *this; } LinkedList<T>& operator=(const LinkedList<T>& link) { - if (head != 0) - Clear(); + if (head != nullptr) + clear(); auto p = link.head; while (p) { - AddLast(p->Value); - p = p->GetNext(); + addLast(p->value); + p = p->getNext(); } return *this; } - template <typename IteratorFunc> void ForEach(const IteratorFunc& f) + template <typename IteratorFunc> void forEach(const IteratorFunc& f) { auto p = head; while (p) { - f(p->Value); - p = p->GetNext(); + f(p->value); + p = p->getNext(); } } - LinkedNode<T>* GetNode(int x) + LinkedNode<T>* getNode(int x) { LinkedNode<T>* pCur = head; for (int i = 0; i < x; i++) @@ -188,33 +188,33 @@ public: } return pCur; }; - LinkedNode<T>* Find(const T& fData) + LinkedNode<T>* find(const T& fData) { for (LinkedNode<T>* pCur = head; pCur; pCur = pCur->next) { - if (pCur->Value == fData) + if (pCur->value == fData) return pCur; } - return 0; + return nullptr; }; - LinkedNode<T>* FirstNode() const { return head; }; - T& First() const + LinkedNode<T>* getFirstNode() const { return head; }; + T& getFirst() const { if (!head) SLANG_UNEXPECTED("LinkedList: index out of range."); - return head->Value; + return head->value; } - T& Last() const + T& getLast() const { if (!tail) SLANG_UNEXPECTED("LinkedList: index out of range."); - return tail->Value; + return tail->value; } - LinkedNode<T>* LastNode() const { return tail; }; - LinkedNode<T>* AddLast(const T& nData) + LinkedNode<T>* getLastNode() const { return tail; }; + LinkedNode<T>* addLast(const T& nData) { LinkedNode<T>* n = new LinkedNode<T>(this); - n->Value = nData; + n->value = nData; n->prev = tail; if (tail) tail->next = n; @@ -226,7 +226,7 @@ public: return n; }; // Insert a blank node - LinkedNode<T>* AddLast() + LinkedNode<T>* addLast() { LinkedNode<T>* n = new LinkedNode<T>(this); n->prev = tail; @@ -239,15 +239,15 @@ public: count++; return n; }; - LinkedNode<T>* AddFirst(const T& nData) + LinkedNode<T>* addFirst(const T& nData) { LinkedNode<T>* n = new LinkedNode<T>(this); - n->Value = nData; - AddFirst(n); + n->value = nData; + addFirst(n); count++; return n; }; - void AddFirst(LinkedNode<T>* n) + void addFirst(LinkedNode<T>* n) { n->prev = 0; n->next = head; @@ -257,7 +257,7 @@ public: if (!tail) tail = n; } - void RemoveFromList(LinkedNode<T>* n) + void removeFromList(LinkedNode<T>* n) { LinkedNode<T>*n1, *n2 = 0; n1 = n->prev; @@ -273,7 +273,7 @@ public: n->prev = nullptr; n->next = nullptr; } - void Delete(LinkedNode<T>* n, int Count = 1) + void removeAndDelete(LinkedNode<T>* n, int Count = 1) { LinkedNode<T>*cur, *next; cur = n; @@ -281,7 +281,7 @@ public: for (int i = 0; i < Count; i++) { next = cur->next; - RemoveFromList(cur); + removeFromList(cur); delete cur; cur = next; numDeleted++; @@ -290,7 +290,7 @@ public: } count -= numDeleted; } - void Clear() + void clear() { for (LinkedNode<T>* n = head; n;) { @@ -302,17 +302,17 @@ public: tail = 0; count = 0; } - List<T> ToList() const + List<T> toList() const { List<T> rs; rs.Reserve(count); for (auto& item : *this) { - rs.Add(item); + rs.add(item); } return rs; } - int Count() { return count; } + int getCount() { return count; } }; } // namespace Slang #endif diff --git a/source/core/slang-memory-file-system.cpp b/source/core/slang-memory-file-system.cpp index a6bc05f24..eabd13072 100644 --- a/source/core/slang-memory-file-system.cpp +++ b/source/core/slang-memory-file-system.cpp @@ -55,7 +55,7 @@ MemoryFileSystem::Entry* MemoryFileSystem::_getEntryFromCanonicalPath(const Stri } else { - return m_entries.TryGetValue(canonicalPath); + return m_entries.tryGetValue(canonicalPath); } } @@ -173,7 +173,7 @@ SlangResult MemoryFileSystem::enumeratePathContents(const char* path, FileSystem // If it is a directory, we need to see if there is anything in it for (const auto& pair : m_entries) { - const Entry* childEntry = &pair.Value; + const Entry* childEntry = &pair.value; collector.addPath(childEntry->m_type, childEntry->m_canonicalPath.getUnownedSlice()); } @@ -250,7 +250,7 @@ SlangResult MemoryFileSystem::_requireFile(const char* path, Entry** outEntry) { Entry entry; entry.initFile(canonicalPath); - m_entries.Add(canonicalPath, entry); + m_entries.add(canonicalPath, entry); foundEntry = _getEntryFromCanonicalPath(canonicalPath); } @@ -277,7 +277,7 @@ SlangResult MemoryFileSystem::remove(const char* path) // If it is a directory, we need to see if there is anything in it for (const auto& pair : m_entries) { - const Entry* childEntry = &pair.Value; + const Entry* childEntry = &pair.value; collector.addPath(childEntry->m_type, childEntry->m_canonicalPath.getUnownedSlice()); if (collector.hasContent()) { @@ -289,7 +289,7 @@ SlangResult MemoryFileSystem::remove(const char* path) // Reset so doesn't hold references/keep memory in scope entry->reset(); - m_entries.Remove(canonicalPath); + m_entries.remove(canonicalPath); return SLANG_OK; } @@ -308,7 +308,7 @@ SlangResult MemoryFileSystem::createDirectory(const char* path) Entry entry; entry.initDirectory(canonicalPath); - m_entries.Add(canonicalPath, entry); + m_entries.add(canonicalPath, entry); return SLANG_OK; } diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index 9185559a2..f28a25f7f 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -69,7 +69,7 @@ SLANG_COMPILE_TIME_ASSERT(E_OUTOFMEMORY == SLANG_E_OUT_OF_MEMORY); String pathString = String::fromWString(path); // We don't want the instance name, just the path to it - out.Clear(); + out.clear(); out.append(Path::getParentDirectory(pathString)); return out.getLength() > 0 ? SLANG_OK : SLANG_FAIL; diff --git a/source/core/slang-riff-file-system.cpp b/source/core/slang-riff-file-system.cpp index 6fe8b0952..9db330956 100644 --- a/source/core/slang-riff-file-system.cpp +++ b/source/core/slang-riff-file-system.cpp @@ -213,7 +213,7 @@ SlangResult RiffFileSystem::loadArchive(const void* archive, size_t archiveSizeI } // Add to the list of entries - m_entries.Add(dstEntry.m_canonicalPath, dstEntry); + m_entries.add(dstEntry.m_canonicalPath, dstEntry); } } @@ -237,7 +237,7 @@ SlangResult RiffFileSystem::storeArchive(bool blobOwnsContent, ISlangBlob** outB for (const auto& pair : m_entries) { - const Entry* srcEntry = &pair.Value; + const Entry* srcEntry = &pair.value; // Ignore the root entry if (srcEntry->m_canonicalPath == toSlice(".")) diff --git a/source/core/slang-rtti-info.cpp b/source/core/slang-rtti-info.cpp index c35444d03..9e0a3796a 100644 --- a/source/core/slang-rtti-info.cpp +++ b/source/core/slang-rtti-info.cpp @@ -197,7 +197,7 @@ StructRttiInfo StructRttiBuilder::make() RttiTypeFuncs RttiTypeFuncsMap::getFuncsForType(const RttiInfo* rttiInfo) { - if (auto funcsPtr = m_map.TryGetValue(rttiInfo)) + if (auto funcsPtr = m_map.tryGetValue(rttiInfo)) { return *funcsPtr; } @@ -207,13 +207,13 @@ RttiTypeFuncs RttiTypeFuncsMap::getFuncsForType(const RttiInfo* rttiInfo) const auto funcs = RttiUtil::getDefaultTypeFuncs(rttiInfo); // Add to the map - m_map.Add(rttiInfo, funcs); + m_map.add(rttiInfo, funcs); return funcs; } void RttiTypeFuncsMap::add(const RttiInfo* rttiInfo, const RttiTypeFuncs& funcs) { - if (auto funcsPtr = m_map.TryGetValueOrAdd(rttiInfo, funcs)) + if (auto funcsPtr = m_map.tryGetValueOrAdd(rttiInfo, funcs)) { // If there are funcs set, they aren't valid otherwise this would be // replacing, so assert on that scenario. diff --git a/source/core/slang-rtti-util.cpp b/source/core/slang-rtti-util.cpp index 9d02ec23b..65ddf8554 100644 --- a/source/core/slang-rtti-util.cpp +++ b/source/core/slang-rtti-util.cpp @@ -23,6 +23,7 @@ struct ListFuncs new (dst + i) Type; } } + static void copyArray(RttiTypeFuncsMap* typeMap, const RttiInfo* rttiInfo, void* inDst, const void* inSrc, Index count) { SLANG_ASSERT(rttiInfo->m_kind == RttiInfo::Kind::List); @@ -455,7 +456,7 @@ static bool _isStructDefault(const StructRttiInfo* type, const void* src) case RttiInfo::Kind::Dictionary: { const auto& v = *(const Dictionary<Byte, Byte>*)src; - return v.Count() == 0; + return v.getCount() == 0; } case RttiInfo::Kind::Other: { diff --git a/source/core/slang-string-slice-index-map.h b/source/core/slang-string-slice-index-map.h index 5aef62253..c57e0f570 100644 --- a/source/core/slang-string-slice-index-map.h +++ b/source/core/slang-string-slice-index-map.h @@ -68,8 +68,8 @@ Index StringSliceIndexMap::getValue(const UnownedStringSlice& key) KeyValuePair<UnownedStringSlice, Index> StringSliceIndexMap::getAt(CountIndex countIndex) const { KeyValuePair<UnownedStringSlice, Index> pair; - pair.Key = m_pool.getSlice(StringSlicePool::Handle(countIndex)); - pair.Value = m_indexMap[countIndex]; + pair.key = m_pool.getSlice(StringSlicePool::Handle(countIndex)); + pair.value = m_indexMap[countIndex]; return pair; } diff --git a/source/core/slang-string-slice-pool.cpp b/source/core/slang-string-slice-pool.cpp index 5c4c7f61f..692bc2b9a 100644 --- a/source/core/slang-string-slice-pool.cpp +++ b/source/core/slang-string-slice-pool.cpp @@ -70,7 +70,7 @@ void StringSlicePool::_set(const ThisType& rhs) m_slices[i] = dstSlice; // Add to the map - m_map.Add(dstSlice, Handle(i)); + m_map.add(dstSlice, Handle(i)); // Skip to next slices storage dst += sliceSize + 1; @@ -109,7 +109,7 @@ bool StringSlicePool::operator==(const ThisType& rhs) const void StringSlicePool::clear() { - m_map.Clear(); + m_map.clear(); m_arena.deallocateAll(); switch (m_style) @@ -123,7 +123,7 @@ void StringSlicePool::clear() m_slices[1] = UnownedStringSlice::fromLiteral(""); // Add the empty entry - m_map.Add(m_slices[1], kEmptyHandle); + m_map.add(m_slices[1], kEmptyHandle); break; } case Style::Empty: @@ -145,7 +145,7 @@ void StringSlicePool::swapWith(ThisType& rhs) StringSlicePool::Handle StringSlicePool::add(const Slice& slice) { - const Handle* handlePtr = m_map.TryGetValue(slice); + const Handle* handlePtr = m_map.tryGetValue(slice); if (handlePtr) { return *handlePtr; @@ -157,13 +157,13 @@ StringSlicePool::Handle StringSlicePool::add(const Slice& slice) const auto index = m_slices.getCount(); m_slices.add(scopePath); - m_map.Add(scopePath, Handle(index)); + m_map.add(scopePath, Handle(index)); return Handle(index); } bool StringSlicePool::findOrAdd(const Slice& slice, Handle& outHandle) { - const Handle* handlePtr = m_map.TryGetValue(slice); + const Handle* handlePtr = m_map.tryGetValue(slice); if (handlePtr) { outHandle = *handlePtr; @@ -177,7 +177,7 @@ bool StringSlicePool::findOrAdd(const Slice& slice, Handle& outHandle) // Add using the arenas copy Handle newHandle = Handle(m_slices.getCount()); - m_map.Add(scopeSlice, newHandle); + m_map.add(scopeSlice, newHandle); // Add to slices list m_slices.add(scopeSlice); @@ -226,7 +226,7 @@ StringSlicePool::Handle StringSlicePool::add(const char* chars) Index StringSlicePool::findIndex(const Slice& slice) const { - const Handle* handlePtr = m_map.TryGetValue(slice); + const Handle* handlePtr = m_map.tryGetValue(slice); return handlePtr ? Index(*handlePtr) : -1; } diff --git a/source/core/slang-string.h b/source/core/slang-string.h index ecdba46be..533d30827 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -1059,7 +1059,7 @@ namespace Slang #endif friend std::ostream& operator<< (std::ostream& stream, const String& s); - void Clear() + void clear() { m_buffer.setNull(); } diff --git a/source/core/slang-token-reader.cpp b/source/core/slang-token-reader.cpp index 5acc1736c..be2461796 100644 --- a/source/core/slang-token-reader.cpp +++ b/source/core/slang-token-reader.cpp @@ -338,7 +338,7 @@ namespace Misc { derivative = LexDerivative::None; tokenList.add(Token(type, tokenBuilder.ToString(), tokenLine, tokenCol, int(pos), file, tokenFlags)); tokenFlags = 0; - tokenBuilder.Clear(); + tokenBuilder.clear(); }; auto ProcessTransferChar = [&](char nextChar) { @@ -462,17 +462,17 @@ namespace Misc { { line = 0; col = 0; - tokenBuilder.Clear(); + tokenBuilder.clear(); } else if (tokenStr == "#line") { derivative = LexDerivative::Line; - tokenBuilder.Clear(); + tokenBuilder.clear(); } else if (tokenStr == "#file") { derivative = LexDerivative::File; - tokenBuilder.Clear(); + tokenBuilder.clear(); line = 0; col = 0; } @@ -492,7 +492,7 @@ namespace Misc { { //do token analyze ParseOperators(tokenBuilder.ToString(), tokenList, tokenFlags, tokenLine, tokenCol, (int)(pos - tokenBuilder.getLength()), file); - tokenBuilder.Clear(); + tokenBuilder.clear(); state = State::Start; } break; @@ -539,7 +539,7 @@ namespace Misc { derivative = LexDerivative::None; line = StringToInt(tokenBuilder.ToString()) - 1; col = 0; - tokenBuilder.Clear(); + tokenBuilder.clear(); } else { @@ -616,7 +616,7 @@ namespace Misc { { derivative = LexDerivative::None; file = tokenBuilder.ToString(); - tokenBuilder.Clear(); + tokenBuilder.clear(); } else { diff --git a/source/core/slang-token-reader.h b/source/core/slang-token-reader.h index 26539732c..4f0f9791a 100644 --- a/source/core/slang-token-reader.h +++ b/source/core/slang-token-reader.h @@ -284,7 +284,7 @@ namespace Misc { auto str = sb.ToString(); if (str.getLength() != 0) result.add(str); - sb.Clear(); + sb.clear(); } else sb << text[i]; diff --git a/source/slang-rt/slang-rt.cpp b/source/slang-rt/slang-rt.cpp index 75997aeaa..9a2041b86 100644 --- a/source/slang-rt/slang-rt.cpp +++ b/source/slang-rt/slang-rt.cpp @@ -23,7 +23,7 @@ extern "C" SLANG_RT_API void* SLANG_MCALL _slang_rt_load_dll(Slang::String modulePath) { ComPtr<ISlangSharedLibrary> lib; - if (!slangRT_loadedLibraries.TryGetValue(modulePath, lib)) + if (!slangRT_loadedLibraries.tryGetValue(modulePath, lib)) { if (DefaultSharedLibraryLoader::getSingleton()->loadSharedLibrary( modulePath.getBuffer(), lib.writeRef()) != SLANG_OK) diff --git a/source/slang/slang-ast-base.h b/source/slang/slang-ast-base.h index 1b8b221ef..5e3773189 100644 --- a/source/slang/slang-ast-base.h +++ b/source/slang/slang-ast-base.h @@ -176,11 +176,11 @@ struct ValSet HashSet<ValItem> set; bool add(Val* val) { - return set.Add(ValItem(val)); + return set.add(ValItem(val)); } bool contains(Val* val) { - return set.Contains(ValItem(val)); + return set.contains(ValItem(val)); } }; diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index 03725901e..3ab2de3d6 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -42,9 +42,9 @@ void SharedASTBuilder::init(Session* session) const ReflectClassInfo* info = ASTClassInfo::getInfo(ASTNodeType(i)); if (info) { - m_sliceToTypeMap.Add(UnownedStringSlice(info->m_name), info); + m_sliceToTypeMap.add(UnownedStringSlice(info->m_name), info); Name* name = m_namePool->getName(String(info->m_name)); - m_nameToTypeMap.Add(name, info); + m_nameToTypeMap.add(name, info); } } } @@ -52,13 +52,13 @@ void SharedASTBuilder::init(Session* session) const ReflectClassInfo* SharedASTBuilder::findClassInfo(const UnownedStringSlice& slice) { const ReflectClassInfo* typeInfo; - return m_sliceToTypeMap.TryGetValue(slice, typeInfo) ? typeInfo : nullptr; + return m_sliceToTypeMap.tryGetValue(slice, typeInfo) ? typeInfo : nullptr; } SyntaxClass<NodeBase> SharedASTBuilder::findSyntaxClass(const UnownedStringSlice& slice) { const ReflectClassInfo* typeInfo; - if (m_sliceToTypeMap.TryGetValue(slice, typeInfo)) + if (m_sliceToTypeMap.tryGetValue(slice, typeInfo)) { return SyntaxClass<NodeBase>(typeInfo); } @@ -68,13 +68,13 @@ SyntaxClass<NodeBase> SharedASTBuilder::findSyntaxClass(const UnownedStringSlice const ReflectClassInfo* SharedASTBuilder::findClassInfo(Name* name) { const ReflectClassInfo* typeInfo; - return m_nameToTypeMap.TryGetValue(name, typeInfo) ? typeInfo : nullptr; + return m_nameToTypeMap.tryGetValue(name, typeInfo) ? typeInfo : nullptr; } SyntaxClass<NodeBase> SharedASTBuilder::findSyntaxClass(Name* name) { const ReflectClassInfo* typeInfo; - if (m_nameToTypeMap.TryGetValue(name, typeInfo)) + if (m_nameToTypeMap.tryGetValue(name, typeInfo)) { return SyntaxClass<NodeBase>(typeInfo); } @@ -191,14 +191,14 @@ void SharedASTBuilder::registerMagicDecl(Decl* decl, MagicTypeModifier* modifier Decl* SharedASTBuilder::findMagicDecl(const String& name) { - return m_magicDecls[name].GetValue(); + return m_magicDecls[name].getValue(); } Decl* SharedASTBuilder::tryFindMagicDecl(const String& name) { - if (m_magicDecls.ContainsKey(name)) + if (m_magicDecls.containsKey(name)) { - return m_magicDecls[name].GetValue(); + return m_magicDecls[name].getValue(); } else { diff --git a/source/slang/slang-ast-builder.h b/source/slang/slang-ast-builder.h index c5e9e5429..c39293914 100644 --- a/source/slang/slang-ast-builder.h +++ b/source/slang/slang-ast-builder.h @@ -52,7 +52,7 @@ public: Decl* findBuiltinRequirementDecl(BuiltinRequirementKind kind) { - return m_builtinRequirementDecls[kind].GetValue(); + return m_builtinRequirementDecls[kind].getValue(); } /// A name pool that can be used for lookup for findClassInfo etc. It is the same pool as the Session. @@ -139,11 +139,11 @@ public: template<typename NodeCreateFunc> NodeBase* _getOrCreateImpl(NodeDesc const& desc, NodeCreateFunc createFunc) { - if (auto found = m_cachedNodes.TryGetValue(desc)) + if (auto found = m_cachedNodes.tryGetValue(desc)) return *found; auto node = createFunc(); - m_cachedNodes.Add(desc, node); + m_cachedNodes.add(desc, node); return node; } diff --git a/source/slang/slang-ast-decl.cpp b/source/slang/slang-ast-decl.cpp index 9931bbcaf..261378b9a 100644 --- a/source/slang/slang-ast-decl.cpp +++ b/source/slang/slang-ast-decl.cpp @@ -56,7 +56,7 @@ void ContainerDecl::buildMemberDictionary() if (dictionaryLastCount < 0) { dictionaryLastCount = 0; - memberDictionary.Clear(); + memberDictionary.clear(); transparentMembers.clear(); } @@ -92,7 +92,7 @@ void ContainerDecl::buildMemberDictionary() m->nextInContainerWithSameName = nullptr; Decl* next = nullptr; - if (memberDictionary.TryGetValue(name, next)) + if (memberDictionary.tryGetValue(name, next)) m->nextInContainerWithSameName = next; memberDictionary[name] = m; diff --git a/source/slang/slang-ast-dump.cpp b/source/slang/slang-ast-dump.cpp index fc3c015e0..242d67017 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -27,7 +27,7 @@ struct ASTDumpContext { if (m_context->m_scopeWriteCount == 0) { - m_context->m_buf.Clear(); + m_context->m_buf.clear(); } m_context->m_scopeWriteCount++; } @@ -276,7 +276,7 @@ struct ASTDumpContext Index getObjectIndex(const ReflectClassInfo& typeInfo, NodeBase* obj) { - Index* indexPtr = m_objectMap.TryGetValueOrAdd(obj, m_objects.getCount()); + Index* indexPtr = m_objectMap.tryGetValueOrAdd(obj, m_objects.getCount()); if (indexPtr) { return *indexPtr; @@ -394,8 +394,8 @@ struct ASTDumpContext for (auto iter : dict) { - const auto& key = iter.Key; - const auto& value = iter.Value; + const auto& key = iter.key; + const auto& value = iter.value; dump(key); m_writer->emit(" : "); @@ -416,8 +416,8 @@ struct ASTDumpContext for (auto iter : dict) { - const auto& key = iter.Key; - const auto& value = iter.Value; + const auto& key = iter.key; + const auto& value = iter.value; dump(key); m_writer->emit(" : "); @@ -446,14 +446,14 @@ struct ASTDumpContext void dump(TextureFlavor texFlavor) { - m_buf.Clear(); + m_buf.clear(); m_buf << "TextureFlavor{" << Index(texFlavor.flavor) << "}"; m_writer->emit(m_buf); } void dump(FeedbackType::Kind kind) { - m_buf.Clear(); + m_buf.clear(); const char* name = nullptr; switch (kind) { diff --git a/source/slang/slang-ast-print.h b/source/slang/slang-ast-print.h index 0ed3db06b..b7c9df3ba 100644 --- a/source/slang/slang-ast-print.h +++ b/source/slang/slang-ast-print.h @@ -100,7 +100,7 @@ public: Index getOffset() const { return m_builder.getLength(); } /// Reset the state - void reset() { m_builder.Clear(); } + void reset() { m_builder.clear(); } /// Get the current string String getString() { return m_builder.ProduceString(); } diff --git a/source/slang/slang-ast-support-types.cpp b/source/slang/slang-ast-support-types.cpp index 3feed7541..6e3c326fb 100644 --- a/source/slang/slang-ast-support-types.cpp +++ b/source/slang/slang-ast-support-types.cpp @@ -46,7 +46,7 @@ Expr* getInnerMostExprFromHigherOrderExpr(Expr* expr, FunctionDifferentiableLeve outLevel = FunctionDifferentiableLevel::Backward; else if (as<ForwardDifferentiateExpr>(expr) && outLevel == FunctionDifferentiableLevel::None) outLevel = FunctionDifferentiableLevel::Forward; - if (workListSet.Add(higherOrder)) + if (workListSet.add(higherOrder)) { expr = higherOrder->baseFunction; } diff --git a/source/slang/slang-capability.cpp b/source/slang/slang-capability.cpp index 235e211e5..770685247 100644 --- a/source/slang/slang-capability.cpp +++ b/source/slang/slang-capability.cpp @@ -222,7 +222,7 @@ static void _addAtomsRec( // if(atomInfo.flavor != CapabilityAtomFlavor::Alias) { - ioExpandedAtoms.Add(atom); + ioExpandedAtoms.add(atom); } // Next we add all the atoms transitively implied by `atom`. @@ -291,7 +291,7 @@ void CapabilitySet::calcCompactedAtoms(List<CapabilityAtom>& outAtoms) const if(baseAtom == CapabilityAtom::Invalid) break; - redundantAtomsSet.Add(baseAtom); + redundantAtomsSet.add(baseAtom); } } @@ -302,7 +302,7 @@ void CapabilitySet::calcCompactedAtoms(List<CapabilityAtom>& outAtoms) const outAtoms.clear(); for( auto atom : m_expandedAtoms ) { - if(!redundantAtomsSet.Contains(atom)) + if(!redundantAtomsSet.contains(atom)) { outAtoms.add(atom); } diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp index 7c4560b5b..7011e535a 100644 --- a/source/slang/slang-check-conversion.cpp +++ b/source/slang/slang-check-conversion.cpp @@ -1153,7 +1153,7 @@ namespace Slang if( cacheKey.isValid()) { - if (typeCheckingCache->conversionCostCache.TryGetValue(cacheKey, cost)) + if (typeCheckingCache->conversionCostCache.tryGetValue(cacheKey, cost)) { if (outCost) *outCost = cost; diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 9b94ba492..0901d2026 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -629,7 +629,7 @@ namespace Slang Substitutions* outerSubst) { GenericSubstitution* cachedResult = nullptr; - if (astBuilder->m_genericDefaultSubst.TryGetValue(genericDecl, cachedResult)) + if (astBuilder->m_genericDefaultSubst.tryGetValue(genericDecl, cachedResult)) { if (cachedResult->outer == outerSubst) return cachedResult; @@ -1452,7 +1452,7 @@ namespace Slang ASTSynthesizer synth(m_astBuilder, getNamePool()); Decl* existingDecl = nullptr; AggTypeDecl* aggTypeDecl = nullptr; - if (context->parentDecl->getMemberDictionary().TryGetValue(requirementDeclRef.getName(), existingDecl)) + if (context->parentDecl->getMemberDictionary().tryGetValue(requirementDeclRef.getName(), existingDecl)) { // Remove the `ToBeSynthesizedModifier`. if (as<ToBeSynthesizedModifier>(existingDecl->modifiers.first)) @@ -1757,7 +1757,7 @@ namespace Slang return; RequirementWitness witnessValue; auto requirementDecl = m_astBuilder->getSharedASTBuilder()->findBuiltinRequirementDecl(BuiltinRequirementKind::DifferentialType); - if (!inheritanceDecl->witnessTable->requirementDictionary.TryGetValue(requirementDecl, witnessValue)) + if (!inheritanceDecl->witnessTable->requirementDictionary.tryGetValue(requirementDecl, witnessValue)) return; // A type used as differential type must have itself as its own differential type. @@ -2097,7 +2097,7 @@ namespace Slang // record it into the actual witness table yet, in case // a later accessor comes along that doesn't find a match. // - mapRequiredToSatisfyingAccessorDeclRef.Add(requiredAccessorDeclRef, satisfyingAccessorDeclRef); + mapRequiredToSatisfyingAccessorDeclRef.add(requiredAccessorDeclRef, satisfyingAccessorDeclRef); found = true; break; } @@ -2112,8 +2112,8 @@ namespace Slang for( auto p : mapRequiredToSatisfyingAccessorDeclRef ) { witnessTable->add( - p.Key, - RequirementWitness(p.Value)); + p.key, + RequirementWitness(p.value)); } // // Note: the property declaration itself isn't something that @@ -3249,7 +3249,7 @@ namespace Slang // to leave the witness table in a state where a requirement is // "partially satisfied." // - mapRequiredAccessorToSynAccessor.Add(requiredAccessorDeclRef, synAccessorDecl); + mapRequiredAccessorToSynAccessor.add(requiredAccessorDeclRef, synAccessorDecl); } synPropertyDecl->parentDecl = context->parentDecl; @@ -3264,7 +3264,7 @@ namespace Slang // for(auto p : mapRequiredAccessorToSynAccessor) { - witnessTable->add(p.Key, RequirementWitness(makeDeclRef(p.Value))); + witnessTable->add(p.key, RequirementWitness(makeDeclRef(p.value))); } witnessTable->add(requiredMemberDeclRef, RequirementWitness(makeDeclRef(synPropertyDecl))); @@ -3413,10 +3413,10 @@ namespace Slang bool hasDifferentialAssocType = false; for (auto existingEntry : witnessTable->requirementDictionary) { - if (auto builtinReqAttr = existingEntry.Key->findModifier<BuiltinRequirementModifier>()) + if (auto builtinReqAttr = existingEntry.key->findModifier<BuiltinRequirementModifier>()) { if (builtinReqAttr->kind == BuiltinRequirementKind::DifferentialType && - existingEntry.Value.getFlavor() != RequirementWitness::Flavor::none) + existingEntry.value.getFlavor() != RequirementWitness::Flavor::none) { hasDifferentialAssocType = true; } @@ -3534,7 +3534,7 @@ namespace Slang // witness in the table for the requirement, so // that we can bail out early. // - if(witnessTable->requirementDictionary.ContainsKey(requiredMemberDeclRef.getDecl())) + if(witnessTable->requirementDictionary.containsKey(requiredMemberDeclRef.getDecl())) { return true; } @@ -3699,7 +3699,7 @@ namespace Slang // Has somebody already checked this conformance, // and/or is in the middle of checking it? RefPtr<WitnessTable> witnessTable; - if(context->mapInterfaceToWitnessTable.TryGetValue(superInterfaceDeclRef, witnessTable)) + if(context->mapInterfaceToWitnessTable.tryGetValue(superInterfaceDeclRef, witnessTable)) return witnessTable; // We need to check the declaration of the interface @@ -3722,7 +3722,7 @@ namespace Slang witnessTable->baseType = DeclRefType::create(m_astBuilder, superInterfaceDeclRef); witnessTable->witnessedType = subType; } - context->mapInterfaceToWitnessTable.Add(superInterfaceDeclRef, witnessTable); + context->mapInterfaceToWitnessTable.add(superInterfaceDeclRef, witnessTable); if(!checkInterfaceConformance(context, subType, superInterfaceType, inheritanceDecl, superInterfaceDeclRef, subTypeConformsToSuperInterfaceWitnes, witnessTable)) return nullptr; @@ -5111,14 +5111,14 @@ namespace Slang } Name* targetName = specializedModifier->targetToken.getName(); - ioDict.AddIfNotExists(targetName, decl); + ioDict.addIfNotExists(targetName, decl); } else { for (auto modifier : decl->getModifiersOfType<TargetIntrinsicModifier>()) { Name* targetName = modifier->targetToken.getName(); - ioDict.AddIfNotExists(targetName, decl); + ioDict.addIfNotExists(targetName, decl); } auto funcDecl = as<FunctionDeclBase>(decl); @@ -5126,7 +5126,7 @@ namespace Slang { // Should only be one body if it isn't specialized for target. // Use nullptr for this scenario - ioDict.AddIfNotExists(nullptr, decl); + ioDict.addIfNotExists(nullptr, decl); } } } @@ -5324,8 +5324,8 @@ namespace Slang bool hasConflict = false; for (auto& pair : newTargets) { - Name* target = pair.Key; - auto found = currentTargets.TryGetValue(target); + Name* target = pair.key; + auto found = currentTargets.tryGetValue(target); if (found) { // Redefinition @@ -6326,12 +6326,12 @@ namespace Slang // skip the step where we modify the current scope. auto& importedModulesList = getShared()->importedModulesList; auto& importedModulesSet = getShared()->importedModulesSet; - if (importedModulesSet.Contains(moduleDecl)) + if (importedModulesSet.contains(moduleDecl)) { return; } importedModulesList.add(moduleDecl); - importedModulesSet.Add(moduleDecl); + importedModulesSet.add(moduleDecl); // Create a new sub-scope to wire the module // into our lookup chain. @@ -6454,10 +6454,10 @@ namespace Slang Dictionary<AggTypeDecl*, RefPtr<CandidateExtensionList>>& mapTypeToCandidateExtensions) { RefPtr<CandidateExtensionList> entry; - if( !mapTypeToCandidateExtensions.TryGetValue(typeDecl, entry) ) + if( !mapTypeToCandidateExtensions.tryGetValue(typeDecl, entry) ) { entry = new CandidateExtensionList(); - mapTypeToCandidateExtensions.Add(typeDecl, entry); + mapTypeToCandidateExtensions.add(typeDecl, entry); } return entry->candidateExtensions; } @@ -6567,15 +6567,15 @@ namespace Slang // `import`. // m_candidateExtensionListsBuilt = false; - m_mapTypeDeclToCandidateExtensions.Clear(); + m_mapTypeDeclToCandidateExtensions.clear(); } void SharedSemanticsContext::_addCandidateExtensionsFromModule(ModuleDecl* moduleDecl) { for( auto& entry : moduleDecl->mapTypeToCandidateExtensions ) { - auto& list = _getCandidateExtensionList(entry.Key, m_mapTypeDeclToCandidateExtensions); - list.addRange(entry.Value->candidateExtensions); + auto& list = _getCandidateExtensionList(entry.key, m_mapTypeDeclToCandidateExtensions); + list.addRange(entry.value->candidateExtensions); } } @@ -6589,10 +6589,10 @@ namespace Slang OrderedDictionary<Decl*, RefPtr<DeclAssociationList>>& mapDeclToDeclarations) { RefPtr<DeclAssociationList> entry; - if (!mapDeclToDeclarations.TryGetValue(decl, entry)) + if (!mapDeclToDeclarations.tryGetValue(decl, entry)) { entry = new DeclAssociationList(); - mapDeclToDeclarations.Add(decl, entry); + mapDeclToDeclarations.add(decl, entry); } return entry->associations; } @@ -6601,8 +6601,8 @@ namespace Slang { for (auto& entry : moduleDecl->mapDeclToAssociatedDecls) { - auto& list = _getDeclAssociationList(entry.Key, m_mapDeclToAssociatedDecls); - list.addRange(entry.Value->associations); + auto& list = _getDeclAssociationList(entry.key, m_mapDeclToAssociatedDecls); + list.addRange(entry.value->associations); } } @@ -6615,7 +6615,7 @@ namespace Slang _getDeclAssociationList(original, moduleDecl->mapDeclToAssociatedDecls).add(assoc); m_associatedDeclListsBuilt = false; - m_mapDeclToAssociatedDecls.Clear(); + m_mapDeclToAssociatedDecls.clear(); } List<RefPtr<DeclAssociation>> const& SharedSemanticsContext::getAssociatedDeclsForDecl(Decl* decl) @@ -6857,7 +6857,7 @@ namespace Slang genericTypeConstraintDecl.getDecl()->sub.type->astNodeType == ASTNodeType::DeclRefType); auto typeParamDecl = as<DeclRefType>(genericTypeConstraintDecl.getDecl()->sub.type)->declRef.getDecl(); - List<Type*>* constraintTypes = genericConstraints.TryGetValue(typeParamDecl); + List<Type*>* constraintTypes = genericConstraints.tryGetValue(typeParamDecl); assert(constraintTypes); constraintTypes->add(genericTypeConstraintDecl.getDecl()->getSup().type); } @@ -6866,12 +6866,12 @@ namespace Slang for (auto& constraints : genericConstraints) { List<Type*> typeList; - for (auto type : constraints.Value) + for (auto type : constraints.value) { _getCanonicalConstraintTypes(typeList, type); } // TODO: we also need to sort the types within the list for each generic type param. - result[constraints.Key] = typeList; + result[constraints.key] = typeList; } return result; } diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 119077eca..7a2c78c71 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -989,7 +989,7 @@ namespace Slang SLANG_RELEASE_ASSERT(m_parentDifferentiableAttr); if (witness) { - m_parentDifferentiableAttr->m_mapTypeToIDifferentiableWitness.AddIfNotExists(type->declRef, witness); + m_parentDifferentiableAttr->m_mapTypeToIDifferentiableWitness.addIfNotExists(type->declRef, witness); } } diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index d544ce5a1..1914e84c2 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -1660,7 +1660,7 @@ namespace Slang if (key.fromOperatorExpr(opExpr)) { OverloadCandidate candidate; - if (typeCheckingCache->resolvedOperatorOverloadCache.TryGetValue(key, candidate)) + if (typeCheckingCache->resolvedOperatorOverloadCache.tryGetValue(key, candidate)) { context.bestCandidateStorage = candidate; context.bestCandidate = &context.bestCandidateStorage; diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp index 46e39e4c0..ce9715d4c 100644 --- a/source/slang/slang-check-shader.cpp +++ b/source/slang/slang-check-shader.cpp @@ -239,7 +239,7 @@ namespace Slang // We will look up any global-scope declarations in the translation // unit that match the name of our entry point. Decl* firstDeclWithName = nullptr; - if (!translationUnitSyntax->getMemberDictionary().TryGetValue(name, firstDeclWithName)) + if (!translationUnitSyntax->getMemberDictionary().tryGetValue(name, firstDeclWithName)) { // If there doesn't appear to be any such declaration, then we are done. @@ -454,7 +454,7 @@ namespace Slang // We will look up any global-scope declarations in the translation // unit that match the name of our entry point. Decl* firstDeclWithName = nullptr; - if( !translationUnitSyntax->getMemberDictionary().TryGetValue(entryPointName, firstDeclWithName)) + if( !translationUnitSyntax->getMemberDictionary().tryGetValue(entryPointName, firstDeclWithName)) { // If there doesn't appear to be any such declaration, then // we need to diagnose it as an error, and then bail out. @@ -671,9 +671,9 @@ namespace Slang // from this module to another module. // auto importedModule = getModule(importDecl->importedModuleDecl); - if(!requiredModuleSet.Contains(importedModule)) + if(!requiredModuleSet.contains(importedModule)) { - requiredModuleSet.Add(importedModule); + requiredModuleSet.add(importedModule); m_requirements.add(importedModule); } } diff --git a/source/slang/slang-check-stmt.cpp b/source/slang/slang-check-stmt.cpp index b2830febe..5f246cc15 100644 --- a/source/slang/slang-check-stmt.cpp +++ b/source/slang/slang-check-stmt.cpp @@ -590,7 +590,7 @@ namespace Slang litExpr->type.type = m_astBuilder->getIntType(); litExpr->token.setName(getNamePool()->getName(String(iterations))); maxItersAttr->args.add(litExpr); - maxItersAttr->intArgVals.Add(0, m_astBuilder->getIntVal(m_astBuilder->getIntType(), iterations)); + maxItersAttr->intArgVals.add(0, m_astBuilder->getIntVal(m_astBuilder->getIntType(), iterations)); maxItersAttr->value = (int32_t)iterations; maxItersAttr->inductionVar = initialVar; addModifier(stmt, maxItersAttr); diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 825849b7f..28ffee152 100644 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -268,7 +268,7 @@ namespace Slang auto declModule = getModule(declaredWitness->declRef.getDecl()); m_moduleDependencyList.addDependency(declModule); m_fileDependencyList.addDependency(declModule); - if (m_requirementSet.Add(declModule)) + if (m_requirementSet.add(declModule)) { m_requirements.add(declModule); } @@ -1049,11 +1049,11 @@ namespace Slang // If it's pass through we accumulate the preprocessor definitions. for (auto& define : translationUnit->compileRequest->preprocessorDefinitions) { - preprocessorDefinitions.Add(define.Key, define.Value); + preprocessorDefinitions.add(define.key, define.value); } for (auto& define : translationUnit->preprocessorDefinitions) { - preprocessorDefinitions.Add(define.Key, define.Value); + preprocessorDefinitions.add(define.key, define.value); } { @@ -1134,7 +1134,7 @@ namespace Slang auto linkage = getLinkage(); for (auto& define : linkage->preprocessorDefinitions) { - preprocessorDefinitions.Add(define.Key, define.Value); + preprocessorDefinitions.add(define.key, define.value); } } @@ -1374,7 +1374,7 @@ namespace Slang // Add the specified defines (as calculated earlier - they will only be set if this is a pass through else will be empty) { - const auto count = preprocessorDefinitions.Count(); + const auto count = preprocessorDefinitions.getCount(); auto dst = allocator.getArena().allocateArray<DownstreamCompileOptions::Define>(count); Index i = 0; @@ -1383,8 +1383,8 @@ namespace Slang { auto& define = dst[i]; - define.nameWithSig = allocator.allocate(def.Key); - define.value = allocator.allocate(def.Value); + define.nameWithSig = allocator.allocate(def.key); + define.value = allocator.allocate(def.value); ++i; } @@ -1422,7 +1422,7 @@ namespace Slang { const auto& diagnostic = *diagnostics->getAt(i); - builder.Clear(); + builder.clear(); const Severity severity = _getDiagnosticSeverity(diagnostic.severity); @@ -1620,7 +1620,7 @@ namespace Slang String EndToEndCompileRequest::_getWholeProgramPath(TargetRequest* targetReq) { RefPtr<EndToEndCompileRequest::TargetInfo> targetInfo; - if (m_targetInfos.TryGetValue(targetReq, targetInfo)) + if (m_targetInfos.tryGetValue(targetReq, targetInfo)) { return targetInfo->wholeTargetOutputPath; } @@ -1635,10 +1635,10 @@ namespace Slang // get paths specified via command-line options. // RefPtr<EndToEndCompileRequest::TargetInfo> targetInfo; - if (m_targetInfos.TryGetValue(targetReq, targetInfo)) + if (m_targetInfos.tryGetValue(targetReq, targetInfo)) { String outputPath; - if (targetInfo->entryPointOutputPaths.TryGetValue(entryPointIndex, outputPath)) + if (targetInfo->entryPointOutputPaths.tryGetValue(entryPointIndex, outputPath)) { return outputPath; } @@ -2020,7 +2020,7 @@ namespace Slang int dependencyCount = compileRequest->getDependencyFileCount(); for (int dependencyIndex = 0; dependencyIndex < dependencyCount; ++dependencyIndex) { - builder.Clear(); + builder.clear(); _escapeDependencyString(compileRequest->getDependencyFilePath(dependencyIndex), builder); _writeString(stream, builder.begin()); _writeString(stream, (dependencyIndex + 1 < dependencyCount) ? " " : "\n"); @@ -2045,7 +2045,7 @@ namespace Slang if (targetReq->isWholeProgramRequest()) { RefPtr<EndToEndCompileRequest::TargetInfo> targetInfo; - if (compileRequest->m_targetInfos.TryGetValue(targetReq, targetInfo)) + if (compileRequest->m_targetInfos.tryGetValue(targetReq, targetInfo)) { _writeDependencyStatement(stream, compileRequest, targetInfo->wholeTargetOutputPath); } @@ -2056,10 +2056,10 @@ namespace Slang for (Index entryPointIndex = 0; entryPointIndex < entryPointCount; ++entryPointIndex) { RefPtr<EndToEndCompileRequest::TargetInfo> targetInfo; - if (compileRequest->m_targetInfos.TryGetValue(targetReq, targetInfo)) + if (compileRequest->m_targetInfos.tryGetValue(targetReq, targetInfo)) { String outputPath; - if (targetInfo->entryPointOutputPaths.TryGetValue(entryPointIndex, outputPath)) + if (targetInfo->entryPointOutputPaths.tryGetValue(entryPointIndex, outputPath)) { _writeDependencyStatement(stream, compileRequest, outputPath); } diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index d0827e2e6..83acbdd9d 100755 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -2856,21 +2856,21 @@ namespace Slang void removeTransition(CodeGenTarget source, CodeGenTarget target) { - m_map.Remove(Pair{ source, target }); + m_map.remove(Pair{ source, target }); } void addTransition(CodeGenTarget source, CodeGenTarget target, PassThroughMode compiler) { SLANG_ASSERT(source != target); - m_map.Set(Pair{ source, target }, compiler); + m_map.set(Pair{ source, target }, compiler); } bool hasTransition(CodeGenTarget source, CodeGenTarget target) const { - return m_map.ContainsKey(Pair{ source, target }); + return m_map.containsKey(Pair{ source, target }); } PassThroughMode getTransition(CodeGenTarget source, CodeGenTarget target) const { const Pair pair{ source, target }; - auto value = m_map.TryGetValue(pair); + auto value = m_map.tryGetValue(pair); return value ? *value : PassThroughMode::None; } diff --git a/source/slang/slang-doc-ast.h b/source/slang/slang-doc-ast.h index 1013e5518..df8f201f7 100644 --- a/source/slang/slang-doc-ast.h +++ b/source/slang/slang-doc-ast.h @@ -41,7 +41,7 @@ protected: SLANG_INLINE ASTMarkup::Entry& ASTMarkup::addEntry(NodeBase* base) { const Index count = m_entries.getCount(); - const Index index = m_entryMap.GetOrAddValue(base, count); + const Index index = m_entryMap.getOrAddValue(base, count); if (index == count) { @@ -55,7 +55,7 @@ SLANG_INLINE ASTMarkup::Entry& ASTMarkup::addEntry(NodeBase* base) // --------------------------------------------------------------------------- SLANG_INLINE ASTMarkup::Entry* ASTMarkup::getEntry(NodeBase* base) { - Index* indexPtr = m_entryMap.TryGetValue(base); + Index* indexPtr = m_entryMap.tryGetValue(base); return (indexPtr) ? &m_entries[*indexPtr] : nullptr; } diff --git a/source/slang/slang-doc-markdown-writer.cpp b/source/slang/slang-doc-markdown-writer.cpp index ffc00fa85..fb3087d50 100644 --- a/source/slang/slang-doc-markdown-writer.cpp +++ b/source/slang/slang-doc-markdown-writer.cpp @@ -123,7 +123,7 @@ String DocMarkdownWriter::_getName(Decl* decl) String DocMarkdownWriter::_getName(InheritanceDecl* decl) { StringBuilder buf; - buf.Clear(); + buf.clear(); buf << decl->base; return buf.ProduceString(); } @@ -338,7 +338,7 @@ void DocMarkdownWriter::writeSignature(CallableDecl* callableDecl) for (Index i = 0; i < paramCount; ++i) { const auto& param = signature.params[i]; - line.Clear(); + line.clear(); // If we want to tab these over... we'll need to know how must space I have line << " " << printer.getPartSlice(param.first); @@ -381,7 +381,7 @@ List<DocMarkdownWriter::NameAndText> DocMarkdownWriter::_getUniqueParams(const L continue; } - Index index = nameDict.GetOrAddValue(name, out.getCount()); + Index index = nameDict.getOrAddValue(name, out.getCount()); if (index >= out.getCount()) { @@ -499,7 +499,7 @@ static void _addRequirements(Decl* decl, List<DocMarkdownWriter::Requirement>& i if (auto spirvRequiredModifier = decl->findModifier<RequiredSPIRVVersionModifier>()) { - buf.Clear(); + buf.clear(); buf << "SPIR-V "; spirvRequiredModifier->version.append(buf); _addRequirement(CodeGenTarget::GLSL, buf, ioReqs); @@ -507,14 +507,14 @@ static void _addRequirements(Decl* decl, List<DocMarkdownWriter::Requirement>& i if (auto glslRequiredModifier = decl->findModifier<RequiredGLSLVersionModifier>()) { - buf.Clear(); + buf.clear(); buf << "GLSL" << glslRequiredModifier->versionNumberToken.getContent(); _addRequirement(CodeGenTarget::GLSL, buf, ioReqs); } if (auto cudaSMVersionModifier = decl->findModifier<RequiredCUDASMVersionModifier>()) { - buf.Clear(); + buf.clear(); buf << "SM "; cudaSMVersionModifier->version.append(buf); _addRequirement(CodeGenTarget::CUDASource, buf, ioReqs); @@ -522,7 +522,7 @@ static void _addRequirements(Decl* decl, List<DocMarkdownWriter::Requirement>& i if (auto extensionModifier = decl->findModifier<RequiredGLSLExtensionModifier>()) { - buf.Clear(); + buf.clear(); buf << extensionModifier->extensionNameToken.getContent(); _addRequirement(CodeGenTarget::GLSL, buf, ioReqs); } @@ -675,7 +675,7 @@ static bool _isFirstOverridden(Decl* decl) Name* declName = decl->getName(); if (declName) { - Decl** firstDeclPtr = parentDecl->getMemberDictionary().TryGetValue(declName); + Decl** firstDeclPtr = parentDecl->getMemberDictionary().tryGetValue(declName); return (firstDeclPtr && *firstDeclPtr == decl) || (firstDeclPtr == nullptr); } @@ -1068,7 +1068,7 @@ void DocMarkdownWriter::writeAggType(const ASTMarkup::Entry& entry, AggTypeDeclB List<Decl*> uniqueMethods; for (const auto& pair : memberDict) { - CallableDecl* callableDecl = as<CallableDecl>(pair.Value); + CallableDecl* callableDecl = as<CallableDecl>(pair.value); if (callableDecl && isVisible(callableDecl)) { uniqueMethods.add(callableDecl); diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 166c131d5..9dacaa4d4 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -82,7 +82,7 @@ Index LocationTracker::getValue(Kind kind, IRInst* inst, IRDecoration* decoratio auto& nextValue = m_nextValueForKind[Index(kind)]; const Location defaultLocation{kind, nextValue}; - const Location foundLocation = m_mapIRToLocations.GetOrAddValue(inst, defaultLocation); + const Location foundLocation = m_mapIRToLocations.getOrAddValue(inst, defaultLocation); // Increase if it was the default nextValue += Index(defaultLocation == foundLocation); @@ -314,7 +314,7 @@ List<IRWitnessTableEntry*> CLikeSourceEmitter::getSortedWitnessTableEntries(IRWi { auto reqEntry = cast<IRInterfaceRequirementEntry>(interfaceType->getOperand(i)); IRWitnessTableEntry* entry = nullptr; - if (witnessTableEntryDictionary.TryGetValue(reqEntry->getRequirementKey(), entry)) + if (witnessTableEntryDictionary.tryGetValue(reqEntry->getRequirementKey(), entry)) { sortedWitnessTableEntries.add(entry); } @@ -648,11 +648,11 @@ UInt CLikeSourceEmitter::getID(IRInst* value) auto& mapIRValueToID = m_mapIRValueToID; UInt id = 0; - if (mapIRValueToID.TryGetValue(value, id)) + if (mapIRValueToID.tryGetValue(value, id)) return id; id = allocateUniqueID(); - mapIRValueToID.Add(value, id); + mapIRValueToID.add(value, id); return id; } @@ -855,7 +855,7 @@ String CLikeSourceEmitter::_generateUniqueName(const UnownedStringSlice& name) String key = sb.ProduceString(); - UInt& countRef = m_uniqueNameCounters.GetOrAddValue(key, 0); + UInt& countRef = m_uniqueNameCounters.getOrAddValue(key, 0); const UInt count = countRef; countRef = count + 1; @@ -937,10 +937,10 @@ String CLikeSourceEmitter::generateName(IRInst* inst) String CLikeSourceEmitter::getName(IRInst* inst) { String name; - if(!m_mapInstToName.TryGetValue(inst, name)) + if(!m_mapInstToName.tryGetValue(inst, name)) { name = generateName(inst); - m_mapInstToName.Add(inst, name); + m_mapInstToName.add(inst, name); } return name; } @@ -3720,7 +3720,7 @@ void CLikeSourceEmitter::ensureGlobalInst(ComputeEmitActionsContext* ctx, IRInst // Have we already processed this instruction? EmitAction::Level existingLevel; - if(ctx->mapInstToLevel.TryGetValue(inst, existingLevel)) + if(ctx->mapInstToLevel.tryGetValue(inst, existingLevel)) { // If we've already emitted it suitably, // then don't worry about it. @@ -3734,17 +3734,17 @@ void CLikeSourceEmitter::ensureGlobalInst(ComputeEmitActionsContext* ctx, IRInst if(requiredLevel == EmitAction::Level::Definition) { - if(ctx->openInsts.Contains(inst)) + if(ctx->openInsts.contains(inst)) { SLANG_UNEXPECTED("circularity during codegen"); return; } - ctx->openInsts.Add(inst); + ctx->openInsts.add(inst); ensureInstOperandsRec(ctx, inst); - ctx->openInsts.Remove(inst); + ctx->openInsts.remove(inst); } ctx->mapInstToLevel[inst] = requiredLevel; diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp index 89d1328bc..38855ae44 100644 --- a/source/slang/slang-emit-cpp.cpp +++ b/source/slang/slang-emit-cpp.cpp @@ -102,7 +102,7 @@ static const char s_xyzwNames[] = "xyzw"; UnownedStringSlice CPPSourceEmitter::_getTypeName(IRType* type) { StringSlicePool::Handle handle = StringSlicePool::kNullHandle; - if (m_typeNameMap.TryGetValue(type, handle)) + if (m_typeNameMap.tryGetValue(type, handle)) { return m_slicePool.getSlice(handle); } @@ -113,7 +113,7 @@ UnownedStringSlice CPPSourceEmitter::_getTypeName(IRType* type) handle = m_slicePool.add(builder); } - m_typeNameMap.Add(type, handle); + m_typeNameMap.add(type, handle); SLANG_ASSERT(handle != StringSlicePool::kNullHandle); return m_slicePool.getSlice(handle); @@ -1889,13 +1889,13 @@ void CPPSourceEmitter::_emitEntryPointGroup(const Int sizeAlongAxis[kThreadGroup for (Index i = 0; i < axes.getCount(); ++i) { const auto& axis = axes[i]; - builder.Clear(); + builder.clear(); const char elem[2] = { s_xyzwNames[axis.axis], 0 }; builder << "for (uint32_t " << elem << " = 0; " << elem << " < " << axis.size << "; ++" << elem << ")\n{\n"; m_writer->emit(builder); m_writer->indent(); - builder.Clear(); + builder.clear(); builder << "threadInput.groupThreadID." << elem << " = " << elem << ";\n"; m_writer->emit(builder); } @@ -1923,7 +1923,7 @@ void CPPSourceEmitter::_emitEntryPointGroupRange(const Int sizeAlongAxis[kThread for (Index i = 0; i < axes.getCount(); ++i) { const auto& axis = axes[i]; - builder.Clear(); + builder.clear(); const char elem[2] = { s_xyzwNames[axis.axis], 0 }; builder << "for (uint32_t " << elem << " = vi.startGroupID." << elem << "; " << elem << " < vi.endGroupID." << elem << "; ++" << elem << ")\n{\n"; @@ -1956,7 +1956,7 @@ void CPPSourceEmitter::_emitInitAxisValues(const Int sizeAlongAxis[kThreadGroupA m_writer->indent(); for (int i = 0; i < kThreadGroupAxisCount; ++i) { - builder.Clear(); + builder.clear(); const char elem[2] = { s_xyzwNames[i], 0 }; builder << mulName << "." << elem << " * " << sizeAlongAxis[i]; if (addName.getLength() > 0) diff --git a/source/slang/slang-emit-source-writer.cpp b/source/slang/slang-emit-source-writer.cpp index 27cbd1932..fc1b48f8c 100644 --- a/source/slang/slang-emit-source-writer.cpp +++ b/source/slang/slang-emit-source-writer.cpp @@ -468,10 +468,10 @@ void SourceWriter::_emitLineDirective(const HumaneSourceLoc& sourceLocation) // extension and then emit a traditional line directive. int id = 0; - if (!m_mapGLSLSourcePathToID.TryGetValue(path, id)) + if (!m_mapGLSLSourcePathToID.tryGetValue(path, id)) { id = m_glslSourceIDCount++; - m_mapGLSLSourcePathToID.Add(path, id); + m_mapGLSLSourcePathToID.add(path, id); } sprintf(buffer, "%d", id); diff --git a/source/slang/slang-emit-source-writer.h b/source/slang/slang-emit-source-writer.h index b64eb052a..955d3359c 100644 --- a/source/slang/slang-emit-source-writer.h +++ b/source/slang/slang-emit-source-writer.h @@ -65,7 +65,7 @@ public: /// Get the content as a string String getContent() { return m_builder.ProduceString(); } /// Clear the content - void clearContent() { m_builder.Clear(); } + void clearContent() { m_builder.clear(); } /// Get the content as a string and clear the internal representation String getContentAndClear(); diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 694f836ae..8710c608a 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -411,11 +411,11 @@ struct SPIRVEmitContext /// Register that `irInst` maps to `spvInst` void registerInst(IRInst* irInst, SpvInst* spvInst) { - m_mapIRInstToSpvInst.Add(irInst, spvInst); + m_mapIRInstToSpvInst.add(irInst, spvInst); // If we have reserved an SpvID for `irInst`, make sure to use it. SpvWord reservedID = 0; - m_mapIRInstToSpvID.TryGetValue(irInst, reservedID); + m_mapIRInstToSpvID.tryGetValue(irInst, reservedID); if (reservedID) { @@ -429,11 +429,11 @@ struct SPIRVEmitContext { // If we have already emitted an SpvInst for `inst`, return its ID. SpvInst* spvInst = nullptr; - if (m_mapIRInstToSpvInst.TryGetValue(inst, spvInst)) + if (m_mapIRInstToSpvInst.tryGetValue(inst, spvInst)) return getID(spvInst); // Check if we have reserved an ID for `inst`. SpvWord result = 0; - if (m_mapIRInstToSpvID.TryGetValue(inst, result)) + if (m_mapIRInstToSpvID.tryGetValue(inst, result)) return result; // Otherwise, reserve a new ID for inst, and register it in `m_mapIRInstToSpvID`. result = m_nextID; @@ -558,7 +558,7 @@ struct SPIRVEmitContext SpvInst* ensureInst(IRInst* irInst) { SpvInst* spvInst = nullptr; - if (!m_mapIRInstToSpvInst.TryGetValue(irInst, spvInst)) + if (!m_mapIRInstToSpvInst.tryGetValue(irInst, spvInst)) { // If the `irInst` hasn't already been emitted, // then we will assume that is is a global instruction @@ -704,7 +704,7 @@ struct SPIRVEmitContext key.value = val; key.type = type; SpvInst* result = nullptr; - if (m_spvIntConstants.TryGetValue(key, result)) + if (m_spvIntConstants.tryGetValue(key, result)) return result; SpvWord valWord; memcpy(&valWord, &val, sizeof(SpvWord)); @@ -750,7 +750,7 @@ struct SPIRVEmitContext key.value = val; key.type = type; SpvInst* result = nullptr; - if (m_spvFloatConstants.TryGetValue(key, result)) + if (m_spvFloatConstants.tryGetValue(key, result)) return result; SpvWord valWord; memcpy(&valWord, &val, sizeof(SpvWord)); @@ -961,7 +961,7 @@ struct SPIRVEmitContext SpvInst* ensureExtensionDeclaration(UnownedStringSlice name) { SpvInst* result = nullptr; - if (m_extensionInsts.TryGetValue(name, result)) + if (m_extensionInsts.tryGetValue(name, result)) return result; result = emitInst(getSection(SpvLogicalSectionID::Extensions), nullptr, SpvOpExtension, name); @@ -1001,7 +1001,7 @@ struct SPIRVEmitContext for (auto op : operands) key.words.add(op); SpvInst* result = nullptr; - if (m_spvTypeInsts.TryGetValue(key, result)) + if (m_spvTypeInsts.tryGetValue(key, result)) { return result; } @@ -1499,7 +1499,7 @@ struct SPIRVEmitContext // we can be sure that it will have been registred. // SpvInst* spvBlock = nullptr; - m_mapIRInstToSpvInst.TryGetValue(irBlock, spvBlock); + m_mapIRInstToSpvInst.tryGetValue(irBlock, spvBlock); SLANG_ASSERT(spvBlock); // [3.32.17. Control-Flow Instructions] @@ -1527,7 +1527,7 @@ struct SPIRVEmitContext for (auto loopInst : pendingLoopInsts) { SpvInst* headerBlock = nullptr; - m_mapIRInstToSpvInst.TryGetValue(loopInst, headerBlock); + m_mapIRInstToSpvInst.tryGetValue(loopInst, headerBlock); SLANG_ASSERT(headerBlock); emitLoopHeaderBlock(loopInst, headerBlock); } @@ -1671,7 +1671,7 @@ struct SPIRVEmitContext // Return loop header block in its own block. auto blockId = getIRInstSpvID(inst); SpvInst* block = nullptr; - m_mapIRInstToSpvInst.TryGetValue(inst, block); + m_mapIRInstToSpvInst.tryGetValue(inst, block); SLANG_ASSERT(block); // Emit a jump to the loop header block. @@ -1995,7 +1995,7 @@ struct SPIRVEmitContext SpvInst* getBuiltinGlobalVar(IRType* type, SpvBuiltIn builtinVal) { SpvInst* result = nullptr; - if (m_builtinGlobalVars.TryGetValue(builtinVal, result)) + if (m_builtinGlobalVars.tryGetValue(builtinVal, result)) { return result; } @@ -2070,9 +2070,9 @@ struct SPIRVEmitContext { RefPtr<BlockParamIndexInfo> info; int result = -1; - if (m_mapIRBlockToParamIndexInfo.TryGetValue(block, info)) + if (m_mapIRBlockToParamIndexInfo.tryGetValue(block, info)) { - info->mapParamToIndex.TryGetValue(paramInst, result); + info->mapParamToIndex.tryGetValue(paramInst, result); SLANG_ASSERT(result != -1); return result; } @@ -2147,7 +2147,7 @@ struct SPIRVEmitContext if (isLoopTargetBlock(block, loopInst)) { SpvInst* loopSpvBlockInst = nullptr; - m_mapIRInstToSpvInst.TryGetValue(loopInst, loopSpvBlockInst); + m_mapIRInstToSpvInst.tryGetValue(loopInst, loopSpvBlockInst); SLANG_ASSERT(loopSpvBlockInst); parent = loopSpvBlockInst; } @@ -2257,7 +2257,7 @@ struct SPIRVEmitContext SpvInst* maybeEmitSpvConstant(SpvSnippet::ASMConstant constant) { SpvInst* result = nullptr; - if (m_spvSnippetConstantInsts.TryGetValue(constant, result)) + if (m_spvSnippetConstantInsts.tryGetValue(constant, result)) return result; IRBuilder builder(m_irModule); @@ -2362,7 +2362,7 @@ struct SPIRVEmitContext if (operand.content != -1) { emitOperand(context.qualifiedResultTypes[(SpvStorageClass)operand.content] - .GetValue()); + .getValue()); } else { @@ -2460,13 +2460,13 @@ struct SPIRVEmitContext Index getStructFieldId(IRStructType* structType, IRStructKey* structFieldKey) { RefPtr<StructTypeInfo> info; - if (!m_structTypeInfos.TryGetValue(structType, info)) + if (!m_structTypeInfos.tryGetValue(structType, info)) { info = createStructTypeInfo(structType); m_structTypeInfos[structType] = info; } Index fieldIndex = -1; - info->structFieldIndices.TryGetValue(structFieldKey, fieldIndex); + info->structFieldIndices.tryGetValue(structFieldKey, fieldIndex); SLANG_ASSERT(fieldIndex != -1); return fieldIndex; } @@ -2837,7 +2837,7 @@ struct SPIRVEmitContext void requireSPIRVCapability(SpvCapability capability) { - if (m_capabilities.Add(capability)) + if (m_capabilities.add(capability)) { emitInst( getSection(SpvLogicalSectionID::Capabilities), diff --git a/source/slang/slang-ir-address-analysis.cpp b/source/slang/slang-ir-address-analysis.cpp index 1473bc466..feba0898a 100644 --- a/source/slang/slang-ir-address-analysis.cpp +++ b/source/slang/slang-ir-address-analysis.cpp @@ -15,7 +15,7 @@ namespace Slang HashSet<IRInst*> operandInsts; for (UInt i = 0; i < inst->getOperandCount(); i++) { - operandInsts.Add(inst->getOperand(i)); + operandInsts.add(inst->getOperand(i)); auto parentBlock = as<IRBlock>(inst->getOperand(i)->getParent()); if (parentBlock) { @@ -24,7 +24,7 @@ namespace Slang } } { - operandInsts.Add(inst->getFullType()); + operandInsts.add(inst->getFullType()); auto parentBlock = as<IRBlock>(inst->getFullType()->getParent()); if (parentBlock) { @@ -58,7 +58,7 @@ namespace Slang IRInst* latestOperand = nullptr; for (auto childInst : earliestBlock->getChildren()) { - if (operandInsts.Contains(childInst)) + if (operandInsts.contains(childInst)) { latestOperand = childInst; } @@ -157,13 +157,13 @@ namespace Slang for (auto& addr : info.addressInfos) { RefPtr<AddressInfo> parentInfo; - if (addr.Value->addrInst->getOperandCount() > 1 && - info.addressInfos.TryGetValue(addr.Value->addrInst->getOperand(0), parentInfo)) + if (addr.value->addrInst->getOperandCount() > 1 && + info.addressInfos.tryGetValue(addr.value->addrInst->getOperand(0), parentInfo)) { - addr.Value->parentAddress = parentInfo; - parentInfo->children.add(addr.Value); + addr.value->parentAddress = parentInfo; + parentInfo->children.add(addr.value); if (!parentInfo->isConstant) - addr.Value->isConstant = false; + addr.value->isConstant = false; } } return info; diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp index 27bba3fde..0c603d81a 100644 --- a/source/slang/slang-ir-any-value-marshalling.cpp +++ b/source/slang/slang-ir-any-value-marshalling.cpp @@ -49,7 +49,7 @@ namespace Slang AnyValueTypeInfo* ensureAnyValueType(IRAnyValueType* type) { auto size = getIntVal(type->getSize()); - if (auto typeInfo = generatedAnyValueTypes.TryGetValue(size)) + if (auto typeInfo = generatedAnyValueTypes.tryGetValue(size)) return typeInfo->Ptr(); RefPtr<AnyValueTypeInfo> info = new AnyValueTypeInfo(); IRBuilder builder(sharedContext->module); @@ -63,7 +63,7 @@ namespace Slang for (decltype(fieldCount) i = 0; i < fieldCount; i++) { auto key = builder.createStructKey(); - nameSb.Clear(); + nameSb.clear(); nameSb << "field" << i; builder.addNameHintDecoration(key, nameSb.getUnownedSlice()); nameSb << "_anyVal" << size; @@ -560,7 +560,7 @@ namespace Slang key.originalType = type; key.anyValueSize = size; MarshallingFunctionSet funcSet; - if (mapTypeMarshalingFunctions.TryGetValue(key, funcSet)) + if (mapTypeMarshalingFunctions.tryGetValue(key, funcSet)) return funcSet; funcSet.packFunc = generatePackingFunc(type, anyValueType); funcSet.unpackFunc = generateUnpackingFunc(type, anyValueType); @@ -627,7 +627,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); processInst(inst); @@ -643,7 +643,7 @@ namespace Slang if (auto anyValueType = as<IRAnyValueType>(inst)) processAnyValueType(anyValueType); } - sharedContext->mapInterfaceRequirementKeyValue.Clear(); + sharedContext->mapInterfaceRequirementKeyValue.clear(); } }; diff --git a/source/slang/slang-ir-augment-make-existential.cpp b/source/slang/slang-ir-augment-make-existential.cpp index 2ef81f1ce..a2038ea24 100644 --- a/source/slang/slang-ir-augment-make-existential.cpp +++ b/source/slang/slang-ir-augment-make-existential.cpp @@ -13,11 +13,11 @@ struct AugmentMakeExistentialContext void addToWorkList(IRInst* inst) { - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } void processMakeExistential(IRMakeExistential* inst) @@ -56,7 +56,7 @@ struct AugmentMakeExistentialContext IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-autodiff-cfg-norm.cpp b/source/slang/slang-ir-autodiff-cfg-norm.cpp index a67b7f167..1727f7d8f 100644 --- a/source/slang/slang-ir-autodiff-cfg-norm.cpp +++ b/source/slang/slang-ir-autodiff-cfg-norm.cpp @@ -442,7 +442,7 @@ struct CFGNormalizationPass { HashSet<IRBlock*> predecessorSet; for (auto predecessor : block->getPredecessors()) - predecessorSet.Add(predecessor); + predecessorSet.add(predecessor); return predecessorSet; } @@ -453,7 +453,7 @@ struct CFGNormalizationPass auto firstLoopBlock = loop->getTargetBlock(); // If we only have one predecessor, the loop is trivial. - return (getPredecessorSet(firstLoopBlock).Count() == 1); + return (getPredecessorSet(firstLoopBlock).getCount() == 1); } IRBlock* normalizeBreakableRegion(IRInst* branchInst) @@ -690,7 +690,7 @@ void normalizeCFG( // Collect loop body blocks. workList.clear(); - workListSet.Clear(); + workListSet.clear(); workList.add(bodyBlock); workListSet.add(bodyBlock); for (Index i = 0; i < workList.getCount(); i++) @@ -716,7 +716,7 @@ void normalizeCFG( for (auto use = inst->firstUse; use; use = use->nextUse) { auto userBlock = as<IRBlock>(use->getUser()->getParent()); - if (userBlock && !workListSet.Contains(userBlock)) + if (userBlock && !workListSet.contains(userBlock)) { // Hoist the inst. if (auto var = as<IRVar>(inst)) diff --git a/source/slang/slang-ir-autodiff-fwd.cpp b/source/slang/slang-ir-autodiff-fwd.cpp index 45857ca45..598a1dde9 100644 --- a/source/slang/slang-ir-autodiff-fwd.cpp +++ b/source/slang/slang-ir-autodiff-fwd.cpp @@ -560,7 +560,7 @@ InstPair ForwardDiffTranscriber::transcribeCall(IRBuilder* builder, IRCall* orig IRInst* diffCallee = nullptr; if (substPrimalCallee == primalCallee) { - instMapD.TryGetValue(origCallee, diffCallee); + instMapD.tryGetValue(origCallee, diffCallee); } else { @@ -890,7 +890,7 @@ InstPair ForwardDiffTranscriber::transcribeSpecialize(IRBuilder* builder, IRSpec (IRType*)primalType, primalBase, primalArgs.getCount(), primalArgs.getBuffer()); IRInst* diffBase = nullptr; - if (instMapD.TryGetValue(origSpecialize->getBase(), diffBase)) + if (instMapD.tryGetValue(origSpecialize->getBase(), diffBase)) { if (diffBase) { @@ -1570,7 +1570,7 @@ void insertTempVarForMutableParams(IRModule* module, IRFunc* func) builder.setInsertBefore(inst); for (auto& kv : mapParamToTempVar) { - builder.emitStore(kv.Key, builder.emitLoad(kv.Value)); + builder.emitStore(kv.key, builder.emitLoad(kv.value)); } } } @@ -1629,7 +1629,7 @@ InstPair ForwardDiffTranscriber::transcribeFunc(IRBuilder* inBuilder, IRFunc* pr differentiableTypeConformanceContext.setFunc(primalFuncClone); - mapInOutParamToWriteBackValue.Clear(); + mapInOutParamToWriteBackValue.clear(); // Create and map blocks in diff func. for (auto block = primalFuncClone->getFirstBlock(); block; block = block->getNextBlock()) @@ -1653,12 +1653,12 @@ InstPair ForwardDiffTranscriber::transcribeFunc(IRBuilder* inBuilder, IRFunc* pr builder.setInsertBefore(inst); for (auto& writeBack : mapInOutParamToWriteBackValue) { - auto param = writeBack.Key; - auto primalVal = builder.emitLoad(writeBack.Value.primal); + auto param = writeBack.key; + auto primalVal = builder.emitLoad(writeBack.value.primal); IRInst* valToStore = nullptr; - if (writeBack.Value.differential) + if (writeBack.value.differential) { - auto diffVal = builder.emitLoad(writeBack.Value.differential); + auto diffVal = builder.emitLoad(writeBack.value.differential); builder.markInstAsDifferential(diffVal, primalVal->getFullType()); valToStore = builder.emitMakeDifferentialPair(cast<IRPtrTypeBase>(param->getFullType())->getValueType(), primalVal, diffVal); @@ -1666,12 +1666,12 @@ InstPair ForwardDiffTranscriber::transcribeFunc(IRBuilder* inBuilder, IRFunc* pr } else { - valToStore = builder.emitLoad(writeBack.Value.primal); + valToStore = builder.emitLoad(writeBack.value.primal); } auto storeInst = builder.emitStore(param, valToStore); - if (writeBack.Value.differential) + if (writeBack.value.differential) { builder.markInstAsMixedDifferential(storeInst, valToStore->getFullType()); } diff --git a/source/slang/slang-ir-autodiff-pairs.cpp b/source/slang/slang-ir-autodiff-pairs.cpp index 7b16c0213..4082a1c86 100644 --- a/source/slang/slang-ir-autodiff-pairs.cpp +++ b/source/slang/slang-ir-autodiff-pairs.cpp @@ -127,15 +127,15 @@ struct DiffPairLoweringPass : InstPassBase { if (auto loweredType = lowerPairType(builder, pairType)) { - pendingReplacements.Add(pairType, loweredType); + pendingReplacements.add(pairType, loweredType); modified = true; } } }); for (auto replacement : pendingReplacements) { - replacement.Key->replaceUsesWith(replacement.Value); - replacement.Key->removeAndDeallocate(); + replacement.key->replaceUsesWith(replacement.value); + replacement.key->removeAndDeallocate(); } return modified; @@ -237,14 +237,14 @@ struct DifferentialPairUserCodeTranscribePass : public InstPassBase { if (auto loweredType = rewritePairType(builder, inst)) { - pendingReplacements.Add(inst, loweredType); + pendingReplacements.add(inst, loweredType); modified = true; } }); for (auto replacement : pendingReplacements) { - replacement.Key->replaceUsesWith(replacement.Value); - replacement.Key->removeAndDeallocate(); + replacement.key->replaceUsesWith(replacement.value); + replacement.key->removeAndDeallocate(); } return modified; diff --git a/source/slang/slang-ir-autodiff-primal-hoist.cpp b/source/slang/slang-ir-autodiff-primal-hoist.cpp index 1bc3caaba..08b946cdd 100644 --- a/source/slang/slang-ir-autodiff-primal-hoist.cpp +++ b/source/slang/slang-ir-autodiff-primal-hoist.cpp @@ -110,8 +110,8 @@ static Dictionary<IRBlock*, IRBlock*> createPrimalRecomputeBlocks( auto recomputeBlock = builder.createBlock(); recomputeBlock->insertAtEnd(func); builder.addDecoration(recomputeBlock, kIROp_RecomputeBlockDecoration); - recomputeBlockMap.Add(primalBlock, recomputeBlock); - indexedBlockInfo[recomputeBlock] = indexedBlockInfo[primalBlock].GetValue(); + recomputeBlockMap.add(primalBlock, recomputeBlock); + indexedBlockInfo[recomputeBlock] = indexedBlockInfo[primalBlock].getValue(); return recomputeBlock; }; @@ -147,7 +147,7 @@ static Dictionary<IRBlock*, IRBlock*> createPrimalRecomputeBlocks( auto primalBlock = workItem.primalBlock; auto recomputeBlock = workItem.recomptueBlock; - List<IndexTrackingInfo>* thisBlockIndexInfo = indexedBlockInfo.TryGetValue(primalBlock); + List<IndexTrackingInfo>* thisBlockIndexInfo = indexedBlockInfo.tryGetValue(primalBlock); if (!thisBlockIndexInfo) continue; @@ -167,7 +167,7 @@ static Dictionary<IRBlock*, IRBlock*> createPrimalRecomputeBlocks( // Have we already created a recompute block for this target? // If so, use it. IRBlock* existingRecomputeBlock = nullptr; - if (recomputeBlockMap.TryGetValue(subRegionEndBlock, existingRecomputeBlock)) + if (recomputeBlockMap.tryGetValue(subRegionEndBlock, existingRecomputeBlock)) { builder.emitBranch(existingRecomputeBlock); } @@ -191,7 +191,7 @@ static Dictionary<IRBlock*, IRBlock*> createPrimalRecomputeBlocks( // Queue work for the subregion. auto loop = as<IRLoop>(primalBlock->getTerminator()); auto bodyBlock = getLoopRegionBodyBlock(loop); - auto diffLoop = mapPrimalLoopToDiffLoop[loop].GetValue(); + auto diffLoop = mapPrimalLoopToDiffLoop[loop].getValue(); auto diffBodyBlock = getLoopRegionBodyBlock(diffLoop); auto bodyRecomputeBlock = createRecomputeBlock(bodyBlock); bodyRecomputeBlock->insertBefore(diffBodyBlock); @@ -244,7 +244,7 @@ static Dictionary<IRBlock*, IRBlock*> createPrimalRecomputeBlocks( // Have we already created a recompute block for this target? // If so, use it. IRBlock* existingRecomputeBlock = nullptr; - if (recomputeBlockMap.TryGetValue(target, existingRecomputeBlock)) + if (recomputeBlockMap.tryGetValue(target, existingRecomputeBlock)) { newTerminator->setOperand(op, existingRecomputeBlock); continue; @@ -355,25 +355,25 @@ RefPtr<HoistedPrimalsInfo> AutodiffCheckpointPolicyBase::processFunc( auto use = workList.getLast(); workList.removeLast(); - if (processedUses.Contains(use)) + if (processedUses.contains(use)) continue; - processedUses.Add(use); + processedUses.add(use); HoistResult result = this->classify(use); if (result.mode == HoistResult::Mode::Store) { - SLANG_ASSERT(!checkpointInfo->recomputeSet.Contains(result.instToStore)); - checkpointInfo->storeSet.Add(result.instToStore); + SLANG_ASSERT(!checkpointInfo->recomputeSet.contains(result.instToStore)); + checkpointInfo->storeSet.add(result.instToStore); } else if (result.mode == HoistResult::Mode::Recompute) { - SLANG_ASSERT(!checkpointInfo->storeSet.Contains(result.instToRecompute)); - checkpointInfo->recomputeSet.Add(result.instToRecompute); + SLANG_ASSERT(!checkpointInfo->storeSet.contains(result.instToRecompute)); + checkpointInfo->recomputeSet.add(result.instToRecompute); if (isDifferentialInst(use->getUser())) - usesToReplace.Add(use); + usesToReplace.add(use); if (auto param = as<IRParam>(result.instToRecompute)) { @@ -422,13 +422,13 @@ RefPtr<HoistedPrimalsInfo> AutodiffCheckpointPolicyBase::processFunc( SLANG_RELEASE_ASSERT(result.inversionInfo.targetInsts.contains(use->getUser())); if (isDifferentialInst(use->getUser())) - usesToReplace.Add(use); + usesToReplace.add(use); - checkpointInfo->invertSet.Add(instToInvert); + checkpointInfo->invertSet.add(instToInvert); - if (checkpointInfo->invInfoMap.ContainsKey(instToInvert)) + if (checkpointInfo->invInfoMap.containsKey(instToInvert)) { - List<IRInst*> currOperands = checkpointInfo->invInfoMap[instToInvert].GetValue().requiredOperands; + List<IRInst*> currOperands = checkpointInfo->invInfoMap[instToInvert].getValue().requiredOperands; for (Index ii = 0; ii < result.inversionInfo.requiredOperands.getCount(); ii++) { SLANG_RELEASE_ASSERT(result.inversionInfo.requiredOperands[ii] == currOperands[ii]); @@ -465,7 +465,7 @@ RefPtr<HoistedPrimalsInfo> AutodiffCheckpointPolicyBase::processFunc( if (!callUser) continue; checkpointInfo->recomputeSet.add(callUser); - checkpointInfo->storeSet.Remove(callUser); + checkpointInfo->storeSet.remove(callUser); if (instWorkListSet.add(callUser)) instWorkList.add(callUser); } @@ -477,7 +477,7 @@ RefPtr<HoistedPrimalsInfo> AutodiffCheckpointPolicyBase::processFunc( if (auto varArg = as<IRVar>(call->getArg(j))) { checkpointInfo->recomputeSet.add(varArg); - checkpointInfo->storeSet.Remove(varArg); + checkpointInfo->storeSet.remove(varArg); if (instWorkListSet.add(varArg)) instWorkList.add(varArg); } @@ -498,13 +498,14 @@ void applyToInst( IRInst* inst) { // Early-out.. - if (checkpointInfo->storeSet.Contains(inst)) + if (checkpointInfo->storeSet.contains(inst)) { - hoistInfo->storeSet.Add(inst); + hoistInfo->storeSet.add(inst); return; } - bool isInstRecomputed = checkpointInfo->recomputeSet.Contains(inst); + + bool isInstRecomputed = checkpointInfo->recomputeSet.contains(inst); if (isInstRecomputed) { if (as<IRParam>(inst)) @@ -522,11 +523,12 @@ void applyToInst( } return; } + auto recomputeInst = cloneCtx->cloneInstOutOfOrder(builder, inst); - hoistInfo->recomputeSet.Add(recomputeInst); + hoistInfo->recomputeSet.add(recomputeInst); } - bool isInstInverted = checkpointInfo->invertSet.Contains(inst); + bool isInstInverted = checkpointInfo->invertSet.contains(inst); if (isInstInverted) { InversionInfo info = checkpointInfo->invInfoMap[inst]; @@ -536,7 +538,7 @@ void applyToInst( List<IRInst*> newOperands; for (auto operand : info.requiredOperands) { - if (cloneCtx->cloneEnv.mapOldValToNew.ContainsKey(operand)) + if (cloneCtx->cloneEnv.mapOldValToNew.containsKey(operand)) newOperands.add(cloneCtx->cloneEnv.mapOldValToNew[operand]); else newOperands.add(operand); @@ -545,8 +547,8 @@ void applyToInst( info.requiredOperands = newOperands; hoistInfo->invertInfoMap[clonedInstToInvert] = info; - hoistInfo->instsToInvert.Add(clonedInstToInvert); - hoistInfo->invertSet.Add(cloneCtx->cloneInstOutOfOrder(builder, inst)); + hoistInfo->instsToInvert.add(clonedInstToInvert); + hoistInfo->invertSet.add(cloneCtx->cloneInstOutOfOrder(builder, inst)); } } @@ -568,7 +570,7 @@ void applyCheckpointSet( for (auto use : pendingUses) - cloneCtx->pendingUses.Add(use); + cloneCtx->pendingUses.add(use); // Populate the clone context with all the primal uses that we may need to replace with // cloned versions. That way any insts we clone into the diff block will automatically replace @@ -580,7 +582,7 @@ void applyCheckpointSet( for (auto operand = inst->getOperands(); opIndex < inst->getOperandCount(); operand++, opIndex++) { if (!isDifferentialInst(operand->get())) - cloneCtx->pendingUses.Add(operand); + cloneCtx->pendingUses.add(operand); } }; @@ -613,14 +615,14 @@ void applyCheckpointSet( HashSet<IRBlock*> predecessorSet; for (auto predecessor : block->getPredecessors()) { - if (predecessorSet.Contains(predecessor)) + if (predecessorSet.contains(predecessor)) continue; - predecessorSet.Add(predecessor); + predecessorSet.add(predecessor); auto diffPredecessor = as<IRBlock>(diffBlockMap[block]); - if (checkpointInfo->recomputeSet.Contains(param)) + if (checkpointInfo->recomputeSet.contains(param)) { IRInst* terminator = diffPredecessor->getTerminator(); addPhiOutputArg(&builder, @@ -629,7 +631,7 @@ void applyCheckpointSet( as<IRUnconditionalBranch>(predecessor->getTerminator())->getArg(ii)); } - if (checkpointInfo->invertSet.Contains(param)) + if (checkpointInfo->invertSet.contains(param)) { IRInst* terminator = diffPredecessor->getTerminator(); @@ -644,7 +646,7 @@ void applyCheckpointSet( } IRBlock* recomputeBlock = block; - mapPrimalBlockToRecomputeBlock.TryGetValue(block, recomputeBlock); + mapPrimalBlockToRecomputeBlock.tryGetValue(block, recomputeBlock); auto recomputeInsertBeforeInst = recomputeBlock->getFirstOrdinaryInst(); for (auto child : block->getChildren()) @@ -838,7 +840,7 @@ static int getInstRegionNestLevel( IRBlock* defBlock, IRInst* inst) { - auto result = indexedBlockInfo[defBlock].GetValue().getCount(); + auto result = indexedBlockInfo[defBlock].getValue().getCount(); // Loop counters are considered to not belong to the region started by the its loop. if (result > 0 && inst->findDecoration<IRLoopCounterDecoration>()) result--; @@ -922,12 +924,13 @@ RefPtr<HoistedPrimalsInfo> ensurePrimalAvailability( if (outOfScopeUses.getCount() == 0) { + if (!isRecomputeInst) - processedStoreSet.Add(instToStore); + processedStoreSet.add(instToStore); continue; } - auto defBlockIndices = indexedBlockInfo[defBlock].GetValue(); + auto defBlockIndices = indexedBlockInfo[defBlock].getValue(); IRBlock* varBlock = defaultVarBlock; if (isRecomputeInst) { @@ -953,8 +956,9 @@ RefPtr<HoistedPrimalsInfo> ensurePrimalAvailability( if (!isIndexedStore && isDerivativeContextVar(varToStore)) { varToStore->insertBefore(defaultVarBlock->getFirstOrdinaryInst()); + if (!isRecomputeInst) - processedStoreSet.Add(varToStore); + processedStoreSet.add(varToStore); continue; } @@ -975,8 +979,9 @@ RefPtr<HoistedPrimalsInfo> ensurePrimalAvailability( IRInst* loadAddr = emitIndexedLoadAddressForVar(&builder, localVar, defBlockIndices, useBlockIndices); builder.replaceOperand(use, loadAddr); } + if (!isRecomputeInst) - processedStoreSet.Add(localVar); + processedStoreSet.add(localVar); } else { @@ -1006,8 +1011,9 @@ RefPtr<HoistedPrimalsInfo> ensurePrimalAvailability( setInsertBeforeOrdinaryInst(&builder, getInstInBlock(use->getUser())); builder.replaceOperand(use, loadIndexedValue(&builder, localVar, defBlockIndices, useBlockIndices)); } + if (!isRecomputeInst) - processedStoreSet.Add(localVar); + processedStoreSet.add(localVar); } } }; @@ -1202,7 +1208,7 @@ void buildIndexedBlocks( for (auto region : regionMap->getAllAncestorRegions(block)) { IndexTrackingInfo trackingInfo; - if (mapLoopToTrackingInfo.TryGetValue(region->loop, trackingInfo)) + if (mapLoopToTrackingInfo.tryGetValue(region->loop, trackingInfo)) { tryInferMaxIndex(region, &trackingInfo); trackingInfos.add(trackingInfo); diff --git a/source/slang/slang-ir-autodiff-primal-hoist.h b/source/slang/slang-ir-autodiff-primal-hoist.h index 6e861bc5b..fbac42c43 100644 --- a/source/slang/slang-ir-autodiff-primal-hoist.h +++ b/source/slang/slang-ir-autodiff-primal-hoist.h @@ -23,16 +23,16 @@ namespace Slang auto newOperand = clonedInst->getOperand(ii); if (oldOperand == newOperand) - pendingUses.Add(&clonedInst->getOperands()[ii]); + pendingUses.add(&clonedInst->getOperands()[ii]); } for (auto use = inst->firstUse; use;) { auto nextUse = use->nextUse; - if (pendingUses.Contains(use)) + if (pendingUses.contains(use)) { - pendingUses.Remove(use); + pendingUses.remove(use); builder->replaceOperand(use, clonedInst); } @@ -69,15 +69,15 @@ namespace Slang InversionInfo applyMap(IRCloneEnv* env) { InversionInfo newInfo; - if (env->mapOldValToNew.ContainsKey(instToInvert)) + if (env->mapOldValToNew.containsKey(instToInvert)) newInfo.instToInvert = env->mapOldValToNew[instToInvert]; for (auto inst : requiredOperands) - if (env->mapOldValToNew.ContainsKey(inst)) + if (env->mapOldValToNew.containsKey(inst)) newInfo.requiredOperands.add(env->mapOldValToNew[inst]); for (auto inst : targetInsts) - if (env->mapOldValToNew.ContainsKey(inst)) + if (env->mapOldValToNew.containsKey(inst)) newInfo.targetInsts.add(env->mapOldValToNew[inst]); return newInfo; @@ -98,24 +98,24 @@ namespace Slang RefPtr<HoistedPrimalsInfo> newPrimalsInfo = new HoistedPrimalsInfo(); for (auto inst : this->storeSet) - if (env->mapOldValToNew.ContainsKey(inst)) - newPrimalsInfo->storeSet.Add(env->mapOldValToNew[inst]); + if (env->mapOldValToNew.containsKey(inst)) + newPrimalsInfo->storeSet.add(env->mapOldValToNew[inst]); for (auto inst : this->recomputeSet) - if (env->mapOldValToNew.ContainsKey(inst)) - newPrimalsInfo->recomputeSet.Add(env->mapOldValToNew[inst]); + if (env->mapOldValToNew.containsKey(inst)) + newPrimalsInfo->recomputeSet.add(env->mapOldValToNew[inst]); for (auto inst : this->invertSet) - if (env->mapOldValToNew.ContainsKey(inst)) - newPrimalsInfo->invertSet.Add(env->mapOldValToNew[inst]); + if (env->mapOldValToNew.containsKey(inst)) + newPrimalsInfo->invertSet.add(env->mapOldValToNew[inst]); for (auto inst : this->instsToInvert) - if (env->mapOldValToNew.ContainsKey(inst)) - newPrimalsInfo->instsToInvert.Add(env->mapOldValToNew[inst]); + if (env->mapOldValToNew.containsKey(inst)) + newPrimalsInfo->instsToInvert.add(env->mapOldValToNew[inst]); for (auto kvpair : this->invertInfoMap) - if (env->mapOldValToNew.ContainsKey(kvpair.Key)) - newPrimalsInfo->invertInfoMap[env->mapOldValToNew[kvpair.Key]] = kvpair.Value.applyMap(env); + if (env->mapOldValToNew.containsKey(kvpair.key)) + newPrimalsInfo->invertInfoMap[env->mapOldValToNew[kvpair.key]] = kvpair.value.applyMap(env); return newPrimalsInfo; } @@ -123,19 +123,19 @@ namespace Slang void merge(HoistedPrimalsInfo* info) { for (auto inst : info->storeSet) - storeSet.Add(inst); + storeSet.add(inst); for (auto inst : info->recomputeSet) - recomputeSet.Add(inst); + recomputeSet.add(inst); for (auto inst : info->invertSet) - invertSet.Add(inst); + invertSet.add(inst); for (auto inst : info->instsToInvert) - instsToInvert.Add(inst); + instsToInvert.add(inst); for (auto kvpair : info->invertInfoMap) - invertInfoMap[kvpair.Key] = kvpair.Value; + invertInfoMap[kvpair.key] = kvpair.value; } }; diff --git a/source/slang/slang-ir-autodiff-propagate.h b/source/slang/slang-ir-autodiff-propagate.h index 8f912ba61..d6fb01b8b 100644 --- a/source/slang/slang-ir-autodiff-propagate.h +++ b/source/slang/slang-ir-autodiff-propagate.h @@ -79,7 +79,7 @@ struct DiffPropagationPass : InstPassBase workList.clear(); - workListSet.Clear(); + workListSet.clear(); // Add the marked insts to the work list. for (auto inst : initialList) diff --git a/source/slang/slang-ir-autodiff-region.h b/source/slang/slang-ir-autodiff-region.h index 59a977619..976ce5149 100644 --- a/source/slang/slang-ir-autodiff-region.h +++ b/source/slang/slang-ir-autodiff-region.h @@ -65,12 +65,12 @@ struct IndexedRegionMap : public RefObject void mapBlock(IRBlock* block, IndexedRegion* region) { - map.Add(block, region); + map.add(block, region); } bool hasMapping(IRBlock* block) { - return map.ContainsKey(block); + return map.containsKey(block); } IndexedRegion* getRegion(IRBlock* block) diff --git a/source/slang/slang-ir-autodiff-rev.cpp b/source/slang/slang-ir-autodiff-rev.cpp index d7abf1d40..ef1bdaf1e 100644 --- a/source/slang/slang-ir-autodiff-rev.cpp +++ b/source/slang/slang-ir-autodiff-rev.cpp @@ -635,14 +635,14 @@ namespace Slang static void _lockPrimalParamReplacementInsts(IRBuilder* builder, ParameterBlockTransposeInfo& paramInfo) { for (auto& kv : paramInfo.mapPrimalSpecificParamToReplacementInPropFunc) - builder->addKeepAliveDecoration(kv.Value); + builder->addKeepAliveDecoration(kv.value); } // Remove [KeepAlive] decorations for primal param replacement insts. static void _unlockPrimalParamReplacementInsts(ParameterBlockTransposeInfo& paramInfo) { for (auto& kv : paramInfo.mapPrimalSpecificParamToReplacementInPropFunc) - kv.Value->findDecoration<IRKeepAliveDecoration>()->removeAndDeallocate(); + kv.value->findDecoration<IRKeepAliveDecoration>()->removeAndDeallocate(); } // Transcribe a function definition. @@ -732,7 +732,7 @@ namespace Slang List<IRInst*> paramsToRemove; for (auto param : diffPropagateFunc->getParams()) { - if (!paramTransposeInfo.propagateFuncParams.Contains(param)) + if (!paramTransposeInfo.propagateFuncParams.contains(param)) paramsToRemove.add(param); } for (auto param : paramsToRemove) @@ -740,7 +740,7 @@ namespace Slang if (param->hasUses()) { IRInst* replacement = nullptr; - paramTransposeInfo.mapPrimalSpecificParamToReplacementInPropFunc.TryGetValue(param, replacement); + paramTransposeInfo.mapPrimalSpecificParamToReplacementInPropFunc.tryGetValue(param, replacement); SLANG_RELEASE_ASSERT(replacement); param->replaceUsesWith(replacement); } @@ -902,7 +902,7 @@ namespace Slang // Create dOut param. auto diffParam = builder->emitParam(diffType); copyNameHintDecoration(diffParam, fwdParam); - result.propagateFuncParams.Add(diffParam); + result.propagateFuncParams.add(diffParam); primalRefReplacement = builder->emitParam(builder->getOutType(primalType)); copyNameHintDecoration(primalRefReplacement, fwdParam); @@ -929,14 +929,14 @@ namespace Slang primalRefReplacement = builder->emitParam(outType); copyNameHintDecoration(primalRefReplacement, fwdParam); } - result.primalFuncParams.Add(primalRefReplacement); + result.primalFuncParams.add(primalRefReplacement); // Create a local var for the out param for the primal part of the prop func. auto tempPrimalVar = nextBlockBuilder.emitVar(outType->getValueType()); copyNameHintDecoration(tempPrimalVar, fwdParam); result.mapPrimalSpecificParamToReplacementInPropFunc[primalRefReplacement] = tempPrimalVar; - instsToRemove.Add(fwdParam); + instsToRemove.add(fwdParam); } else if (!isRelevantDifferentialPair(fwdParam->getDataType())) { @@ -947,14 +947,14 @@ namespace Slang // bwd func. fwdParam->removeFromParent(); fwdDiffParameterBlock->addParam(fwdParam); - result.primalFuncParams.Add(fwdParam); + result.primalFuncParams.add(fwdParam); primalRefReplacement = fwdParam; // Create an in param for the prop func. auto propParam = builder->emitParam(inoutType->getValueType()); copyNameHintDecoration(propParam, fwdParam); - result.propagateFuncParams.Add(propParam); + result.propagateFuncParams.add(propParam); // Create a local var for the out param for the primal part of the prop func. auto tempPrimalVar = nextBlockBuilder.emitVar(inoutType->getValueType()); @@ -973,8 +973,8 @@ namespace Slang // fwdParam->removeFromParent(); fwdDiffParameterBlock->addParam(fwdParam); - result.primalFuncParams.Add(fwdParam); - result.propagateFuncParams.Add(fwdParam); + result.primalFuncParams.add(fwdParam); + result.propagateFuncParams.add(fwdParam); continue; } } @@ -989,10 +989,10 @@ namespace Slang primalRefReplacement = builder->emitParam(primalType); copyNameHintDecoration(primalRefReplacement, fwdParam); - result.primalFuncParams.Add(primalRefReplacement); + result.primalFuncParams.add(primalRefReplacement); auto propParam = builder->emitParam(inoutDiffPairType); copyNameHintDecoration(propParam, fwdParam); - result.propagateFuncParams.Add(propParam); + result.propagateFuncParams.add(propParam); // A reference to this parameter from the diff blocks should be replaced with a load // of the differential component of the pair. @@ -1014,7 +1014,7 @@ namespace Slang result.propagateFuncSpecificPrimalInsts.add(primalVal); result.mapPrimalSpecificParamToReplacementInPropFunc[primalRefReplacement] = primalVal; - instsToRemove.Add(fwdParam); + instsToRemove.add(fwdParam); } else { @@ -1024,11 +1024,11 @@ namespace Slang // Process differentiable inout parameters. auto primalParam = builder->emitParam(builder->getInOutType(primalType)); copyNameHintDecoration(primalParam, fwdParam); - result.primalFuncParams.Add(primalParam); + result.primalFuncParams.add(primalParam); auto diffParam = builder->emitParam(inoutType); copyNameHintDecoration(diffParam, fwdParam); - result.propagateFuncParams.Add(diffParam); + result.propagateFuncParams.add(diffParam); // Primal references to this param is the new primal param. primalRefReplacement = primalParam; @@ -1078,7 +1078,7 @@ namespace Slang result.mapPrimalSpecificParamToReplacementInPropFunc[primalParam] = primalVar; result.outDiffWritebacks[diffParam] = InstPair(initPrimalVal, diffVar); - instsToRemove.Add(fwdParam); + instsToRemove.add(fwdParam); } // We have emitted all the new parameters and computed the replacements for the original @@ -1092,13 +1092,13 @@ namespace Slang { SLANG_RELEASE_ASSERT(primalRefReplacement); primalRef->replaceUsesWith(primalRefReplacement); - instsToRemove.Add(primalRef); + instsToRemove.add(primalRef); } else if (auto getPrimal = as<IRDifferentialPairGetPrimal>(use->getUser())) { SLANG_RELEASE_ASSERT(primalRefReplacement); getPrimal->replaceUsesWith(primalRefReplacement); - instsToRemove.Add(getPrimal); + instsToRemove.add(getPrimal); } else if (auto propagateRef = as<IRDiffParamRef>(use->getUser())) { @@ -1120,13 +1120,13 @@ namespace Slang } refUse = nextUse; } - instsToRemove.Add(propagateRef); + instsToRemove.add(propagateRef); } else if (auto getDiff = as<IRDifferentialPairGetDifferential>(use->getUser())) { SLANG_RELEASE_ASSERT(diffRefReplacement); getDiff->replaceUsesWith(diffRefReplacement); - instsToRemove.Add(getDiff); + instsToRemove.add(getDiff); } else { @@ -1161,14 +1161,14 @@ namespace Slang dOutParam = builder->emitParam(dOutParamType); builder->addNameHintDecoration(dOutParam, UnownedStringSlice("_s_dOut")); - result.propagateFuncParams.Add(dOutParam); + result.propagateFuncParams.add(dOutParam); } // Add a parameter for intermediate val. auto ctxParam = builder->emitParam(as<IRFuncType>(diffFunc->getDataType())->getParamType(paramCount - 1)); builder->addNameHintDecoration(ctxParam, UnownedStringSlice("_s_diff_ctx")); - result.primalFuncParams.Add(ctxParam); - result.propagateFuncParams.Add(ctxParam); + result.primalFuncParams.add(ctxParam); + result.propagateFuncParams.add(ctxParam); result.dOutParam = dOutParam; return result; } @@ -1193,9 +1193,9 @@ namespace Slang builder.setInsertBefore(returnInst); for (auto& wb : info.outDiffWritebacks) { - auto dest = wb.Key; - auto srcPrimalVal = wb.Value.primal; - auto srcDiffAddr = wb.Value.differential; + auto dest = wb.key; + auto srcPrimalVal = wb.value.primal; + auto srcDiffAddr = wb.value.differential; auto srcDiffVal = builder.emitLoad(srcDiffAddr); auto destVal = builder.emitMakeDifferentialPair(as<IRPtrTypeBase>(dest->getFullType())->getValueType(), srcPrimalVal, srcDiffVal); builder.emitStore(dest, destVal); @@ -1214,7 +1214,7 @@ namespace Slang auto primalSpecialize = (IRSpecialize*)builder->emitSpecializeInst( (IRType*)primalType, primalBase, primalArgs.getCount(), primalArgs.getBuffer()); - if (auto diffBase = instMapD.TryGetValue(origSpecialize->getBase())) + if (auto diffBase = instMapD.tryGetValue(origSpecialize->getBase())) { List<IRInst*> args; for (UInt i = 0; i < primalSpecialize->getArgCount(); i++) diff --git a/source/slang/slang-ir-autodiff-transcriber-base.cpp b/source/slang/slang-ir-autodiff-transcriber-base.cpp index 98f3aebfa..1f7f5e413 100644 --- a/source/slang/slang-ir-autodiff-transcriber-base.cpp +++ b/source/slang/slang-ir-autodiff-transcriber-base.cpp @@ -33,7 +33,7 @@ void AutoDiffTranscriberBase::mapDifferentialInst(IRInst* origInst, IRInst* diff void AutoDiffTranscriberBase::mapPrimalInst(IRInst* origInst, IRInst* primalInst) { - if (cloneEnv.mapOldValToNew.ContainsKey(origInst) && cloneEnv.mapOldValToNew[origInst] != primalInst) + if (cloneEnv.mapOldValToNew.containsKey(origInst) && cloneEnv.mapOldValToNew[origInst] != primalInst) { getSink()->diagnose(origInst->sourceLoc, Diagnostics::internalCompilerError, @@ -52,7 +52,7 @@ IRInst* AutoDiffTranscriberBase::lookupDiffInst(IRInst* origInst) IRInst* AutoDiffTranscriberBase::lookupDiffInst(IRInst* origInst, IRInst* defaultInst) { - if (auto lookupResult = instMapD.TryGetValue(origInst)) + if (auto lookupResult = instMapD.tryGetValue(origInst)) return *lookupResult; return defaultInst; } @@ -61,7 +61,7 @@ bool AutoDiffTranscriberBase::hasDifferentialInst(IRInst* origInst) { if (!origInst) return false; - return instMapD.ContainsKey(origInst); + return instMapD.containsKey(origInst); } bool AutoDiffTranscriberBase::shouldUseOriginalAsPrimal(IRInst* currentParent, IRInst* origInst) @@ -105,7 +105,7 @@ bool AutoDiffTranscriberBase::hasPrimalInst(IRInst* currentParent, IRInst* origI return false; if (shouldUseOriginalAsPrimal(currentParent, origInst)) return true; - return cloneEnv.mapOldValToNew.ContainsKey(origInst); + return cloneEnv.mapOldValToNew.containsKey(origInst); } IRInst* AutoDiffTranscriberBase::findOrTranscribeDiffInst(IRBuilder* builder, IRInst* origInst) @@ -487,9 +487,9 @@ static bool _findDifferentiableInterfaceLookupPathImpl( IRInterfaceType* type, List<IRInterfaceRequirementEntry*>& currentPath) { - if (processedTypes.Contains(type)) + if (processedTypes.contains(type)) return false; - processedTypes.Add(type); + processedTypes.add(type); List<IRInterfaceRequirementEntry*> lookupKeyPath; for (UInt i = 0; i < type->getOperandCount(); i++) @@ -859,7 +859,7 @@ InstPair AutoDiffTranscriberBase::transcribeBlockImpl(IRBuilder* builder, IRBloc // for (auto child = origBlock->getFirstOrdinaryInst(); child; child = child->getNextInst()) { - if (instsToSkip.Contains(child)) + if (instsToSkip.contains(child)) { continue; } @@ -959,7 +959,7 @@ static void _markGenericChildrenWithoutRelaventUse(IRGeneric* origGeneric, HashS case kIROp_PrimalSubstituteDecoration: break; default: - if (!outInstsToSkip.Contains(use->getUser())) + if (!outInstsToSkip.contains(use->getUser())) { hasRelaventUse = true; } @@ -968,7 +968,7 @@ static void _markGenericChildrenWithoutRelaventUse(IRGeneric* origGeneric, HashS } if (!hasRelaventUse) { - if (outInstsToSkip.Add(inst)) + if (outInstsToSkip.add(inst)) { changed = true; } @@ -1074,11 +1074,11 @@ IRInst* AutoDiffTranscriberBase::transcribe(IRBuilder* builder, IRInst* origInst // Otherwise, dispatch to the appropriate method // depending on the op-code. // - instsInProgress.Add(origInst); + instsInProgress.add(origInst); auto actualInstToTranscribe = getActualInstToTranscribe(origInst); InstPair pair = transcribeInst(builder, actualInstToTranscribe); - instsInProgress.Remove(origInst); + instsInProgress.remove(origInst); if (auto primalInst = pair.primal) { @@ -1176,7 +1176,7 @@ InstPair AutoDiffTranscriberBase::transcribeInst(IRBuilder* builder, IRInst* ori // if (as<IRGeneric>(origType->getParent()->getParent()) && findInnerMostGenericReturnVal(as<IRGeneric>(origType->getParent()->getParent())) == origType && - !instsInProgress.Contains(origType->getParent()->getParent())) + !instsInProgress.contains(origType->getParent()->getParent())) { auto origGenericType = origType->getParent()->getParent(); auto diffGenericType = findOrTranscribeDiffInst(builder, origGenericType); diff --git a/source/slang/slang-ir-autodiff-transpose.h b/source/slang/slang-ir-autodiff-transpose.h index 55f042352..bcc494fa9 100644 --- a/source/slang/slang-ir-autodiff-transpose.h +++ b/source/slang/slang-ir-autodiff-transpose.h @@ -114,7 +114,7 @@ struct DiffTransposePass List<IRInst*> getPhiGrads(IRBlock* block) { - if (!phiGradsMap.ContainsKey(block)) + if (!phiGradsMap.containsKey(block)) return List<IRInst*>(); return phiGradsMap[block]; @@ -143,9 +143,9 @@ struct DiffTransposePass { HashSet<IRBlock*> predecessorSet; for (auto predecessor : block->getPredecessors()) - predecessorSet.Add(predecessor); + predecessorSet.add(predecessor); - SLANG_ASSERT(predecessorSet.Count() == 1); + SLANG_ASSERT(predecessorSet.getCount() == 1); return (*predecessorSet.begin()); } @@ -420,7 +420,7 @@ struct DiffTransposePass reverseSwitchArgs.add(switchInst->getCaseValue(ii)); auto caseLabel = switchInst->getCaseLabel(ii); - if (!reverseLabelEntryBlocks.ContainsKey(caseLabel)) + if (!reverseLabelEntryBlocks.containsKey(caseLabel)) { auto labelRegionInfo = reverseCFGRegion( caseLabel, @@ -539,7 +539,7 @@ struct DiffTransposePass HashSet<IRBlock*> traverseSet; traverseWorkList.add(revDiffFunc->getFirstBlock()); - traverseSet.Add(revDiffFunc->getFirstBlock()); + traverseSet.add(revDiffFunc->getFirstBlock()); for (IRBlock* block = revDiffFunc->getFirstBlock(); block; block = block->getNextBlock()) { if (!isDifferentialInst(block)) @@ -572,7 +572,7 @@ struct DiffTransposePass // Keep track of first diff block, since this is where // we'll emit temporary vars to hold per-block derivatives. // - auto firstRevDiffBlock = revBlockMap[terminalDiffBlocks[0]].GetValue(); + auto firstRevDiffBlock = revBlockMap[terminalDiffBlocks[0]].getValue(); firstRevDiffBlockMap[revDiffFunc] = firstRevDiffBlock; // Move all diff vars to first block, and initialize them with zero. @@ -708,7 +708,7 @@ struct DiffTransposePass IRVar* getOrCreateAccumulatorVar(IRInst* fwdInst) { // Check if we have a var already. - if (revAccumulatorVarMap.ContainsKey(fwdInst)) + if (revAccumulatorVarMap.containsKey(fwdInst)) return revAccumulatorVarMap[fwdInst]; IRBuilder tempVarBuilder(autodiffContext->moduleInst->getModule()); @@ -868,7 +868,7 @@ struct DiffTransposePass // for (auto pair : gradientsMap) { - if (auto loadInst = as<IRLoad>(pair.Key)) + if (auto loadInst = as<IRLoad>(pair.key)) accumulateGradientsForLoad(&builder, loadInst); } @@ -916,14 +916,14 @@ struct DiffTransposePass List<IRInst*> globalInsts; // Holds insts in the global scope. for (auto pair : gradientsMap) { - auto instParent = pair.Key->getParent(); + auto instParent = pair.key->getParent(); if (instParent != fwdBlock) { if (instParent->getParent() == fwdBlock->getParent()) - externInsts.add(pair.Key); + externInsts.add(pair.key); if (as<IRModuleInst>(instParent)) - globalInsts.add(pair.Key); + globalInsts.add(pair.key); } } @@ -965,7 +965,7 @@ struct DiffTransposePass } // We _should_ be completely out of gradients to process at this point. - SLANG_ASSERT(gradientsMap.Count() == 0); + SLANG_ASSERT(gradientsMap.getCount() == 0); // Record any phi gradients for the CFG reversal pass. phiGradsMap[fwdBlock] = phiParamRevGradInsts; @@ -1125,9 +1125,9 @@ struct DiffTransposePass HashSet<IRBlock*> predecessorSet; for (auto predecessor : nextBlock->getPredecessors()) - predecessorSet.Add(predecessor); + predecessorSet.add(predecessor); - if (predecessorSet.Count() > 1) + if (predecessorSet.getCount() > 1) { keepGoing = false; break; @@ -1620,7 +1620,7 @@ struct DiffTransposePass { // No block can by the after block for multiple control flow insts. // - SLANG_ASSERT(!(afterBlockMap.ContainsKey(afterBlock) && \ + SLANG_ASSERT(!(afterBlockMap.containsKey(afterBlock) && \ afterBlockMap[afterBlock] != block->getTerminator())); afterBlockMap[afterBlock] = block->getTerminator(); @@ -2665,12 +2665,12 @@ struct DiffTransposePass auto index = getElementInst->getIndex(); SLANG_ASSERT(index); - if (!bucketedGradients.ContainsKey(index)) + if (!bucketedGradients.containsKey(index)) { bucketedGradients[index] = List<RevGradient>(); } - bucketedGradients[index].GetValue().add(RevGradient( + bucketedGradients[index].getValue().add(RevGradient( RevGradient::Flavor::Simple, gradient.targetInst, gradient.revGradInst, @@ -2681,7 +2681,7 @@ struct DiffTransposePass for (auto pair : bucketedGradients) { - auto subGrads = pair.Value; + auto subGrads = pair.value; auto primalType = tryGetPrimalTypeFromDiffInst(subGrads[0].fwdGradInst); @@ -2691,7 +2691,7 @@ struct DiffTransposePass auto revGradTargetAddress = builder->emitElementAddress( builder->getPtrType(subGrads[0].revGradInst->getDataType()), revGradVar, - pair.Key); + pair.key); builder->emitStore(revGradTargetAddress, emitAggregateValue(builder, primalType, subGrads)); } @@ -2731,12 +2731,12 @@ struct DiffTransposePass auto structKey = as<IRStructKey>(fieldExtractInst->getField()); SLANG_ASSERT(structKey); - if (!bucketedGradients.ContainsKey(structKey)) + if (!bucketedGradients.containsKey(structKey)) { bucketedGradients[structKey] = List<RevGradient>(); } - bucketedGradients[structKey].GetValue().add(RevGradient( + bucketedGradients[structKey].getValue().add(RevGradient( RevGradient::Flavor::Simple, gradient.targetInst, gradient.revGradInst, @@ -2747,7 +2747,7 @@ struct DiffTransposePass for (auto pair : bucketedGradients) { - auto subGrads = pair.Value; + auto subGrads = pair.value; auto primalType = tryGetPrimalTypeFromDiffInst(subGrads[0].fwdGradInst); @@ -2757,7 +2757,7 @@ struct DiffTransposePass auto revGradTargetAddress = builder->emitFieldAddress( builder->getPtrType(subGrads[0].revGradInst->getDataType()), revGradVar, - pair.Key); + pair.key); builder->emitStore(revGradTargetAddress, emitAggregateValue(builder, primalType, subGrads)); } @@ -2976,7 +2976,7 @@ struct DiffTransposePass { gradientsMap[fwdInst] = List<RevGradient>(); } - gradientsMap[fwdInst].GetValue().add(assignment); + gradientsMap[fwdInst].getValue().add(assignment); } List<RevGradient> getRevGradients(IRInst* fwdInst) @@ -2986,14 +2986,14 @@ struct DiffTransposePass List<RevGradient> popRevGradients(IRInst* fwdInst) { - List<RevGradient> val = gradientsMap[fwdInst].GetValue(); - gradientsMap.Remove(fwdInst); + List<RevGradient> val = gradientsMap[fwdInst].getValue(); + gradientsMap.remove(fwdInst); return val; } bool hasRevGradients(IRInst* fwdInst) { - return gradientsMap.ContainsKey(fwdInst); + return gradientsMap.containsKey(fwdInst); } AutoDiffSharedContext* autodiffContext; diff --git a/source/slang/slang-ir-autodiff-unzip.cpp b/source/slang/slang-ir-autodiff-unzip.cpp index a864a74b2..60d829324 100644 --- a/source/slang/slang-ir-autodiff-unzip.cpp +++ b/source/slang/slang-ir-autodiff-unzip.cpp @@ -185,7 +185,7 @@ struct ExtractPrimalFuncContext auto outIntermediary = builder.emitParam(builder.getOutType((IRType*)intermediateType)); oldIntermediateParam->transferDecorationsTo(outIntermediary); - primalParams.Add(outIntermediary); + primalParams.add(outIntermediary); oldIntermediateParam->replaceUsesWith(outIntermediary); oldIntermediateParam->removeAndDeallocate(); @@ -212,7 +212,7 @@ struct ExtractPrimalFuncContext // output intermediary struct. for (auto inst : block->getChildren()) { - if (primalsInfo->storeSet.Contains(inst)) + if (primalsInfo->storeSet.contains(inst)) { if (as<IRVar>(inst)) { @@ -267,7 +267,7 @@ struct ExtractPrimalFuncContext for (auto param = func->getFirstParam(); param;) { auto nextParam = param->getNextParam(); - if (!primalParams.Contains(param)) + if (!primalParams.contains(param)) { param->replaceUsesWith(builder.getVoidValue()); param->removeAndDeallocate(); @@ -281,7 +281,7 @@ struct ExtractPrimalFuncContext static void copyPrimalValueStructKeyDecorations(IRInst* inst, IRCloneEnv& cloneEnv) { IRInst* newInst = nullptr; - if (cloneEnv.mapOldValToNew.TryGetValue(inst, newInst)) + if (cloneEnv.mapOldValToNew.tryGetValue(inst, newInst)) { if (auto decor = newInst->findDecoration<IRPrimalValueStructKeyDecoration>()) { @@ -321,7 +321,7 @@ IRFunc* DiffUnzipPass::extractPrimalFunc( for (auto inst : paramInfo.propagateFuncSpecificPrimalInsts) { IRInst* newInst = nullptr; - if (subEnv.mapOldValToNew.TryGetValue(inst, newInst)) + if (subEnv.mapOldValToNew.tryGetValue(inst, newInst)) { newInst->removeAndDeallocate(); } @@ -330,8 +330,8 @@ IRFunc* DiffUnzipPass::extractPrimalFunc( HashSet<IRInst*> newPrimalParams; for (auto param : func->getParams()) { - if (paramInfo.primalFuncParams.Contains(param)) - newPrimalParams.Add(subEnv.mapOldValToNew[param].GetValue()); + if (paramInfo.primalFuncParams.contains(param)) + newPrimalParams.add(subEnv.mapOldValToNew[param].getValue()); } ExtractPrimalFuncContext context; diff --git a/source/slang/slang-ir-autodiff-unzip.h b/source/slang/slang-ir-autodiff-unzip.h index 532e63b42..e0723dcdd 100644 --- a/source/slang/slang-ir-autodiff-unzip.h +++ b/source/slang/slang-ir-autodiff-unzip.h @@ -161,16 +161,16 @@ struct DiffUnzipPass List<IRBlock*> workList; for (auto blockRegionPair : indexRegionMap->map) { - IRBlock* block = blockRegionPair.Key; + IRBlock* block = blockRegionPair.key; workList.add(block); } for (auto block : workList) { - if (primalMap.ContainsKey(block)) + if (primalMap.containsKey(block)) indexRegionMap->map[as<IRBlock>(primalMap[block])] = (IndexedRegion*)indexRegionMap->map[block]; - if (diffMap.ContainsKey(block)) + if (diffMap.containsKey(block)) indexRegionMap->map[as<IRBlock>(diffMap[block])] = (IndexedRegion*)indexRegionMap->map[block]; } } @@ -181,7 +181,7 @@ struct DiffUnzipPass RefPtr<BlockSplitInfo> splitInfo = new BlockSplitInfo(); for (auto block : mixedBlocks) - if (primalMap.ContainsKey(block)) + if (primalMap.containsKey(block)) splitInfo->diffBlockMap[as<IRBlock>(primalMap[block])] = as<IRBlock>(diffMap[block]); for (auto block : mixedBlocks) @@ -705,7 +705,7 @@ struct DiffUnzipPass if (auto getDiffInst = as<IRDifferentialPairGetDifferential>(child)) { // Replace GetDiff(A) with A.d - if (diffMap.ContainsKey(getDiffInst->getBase())) + if (diffMap.containsKey(getDiffInst->getBase())) { getDiffInst->replaceUsesWith(lookupDiffInst(getDiffInst->getBase())); getDiffInst->removeAndDeallocate(); @@ -715,7 +715,7 @@ struct DiffUnzipPass else if (auto getPrimalInst = as<IRDifferentialPairGetPrimal>(child)) { // Replace GetPrimal(A) with A.p - if (primalMap.ContainsKey(getPrimalInst->getBase())) + if (primalMap.containsKey(getPrimalInst->getBase())) { getPrimalInst->replaceUsesWith(lookupPrimalInst(getPrimalInst->getBase())); getPrimalInst->removeAndDeallocate(); diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp index 656b0e11b..4dac6b347 100644 --- a/source/slang/slang-ir-autodiff.cpp +++ b/source/slang/slang-ir-autodiff.cpp @@ -298,7 +298,7 @@ IRInst* DifferentialPairTypeBuilder::lowerDiffPairType( // purposes. auto primalType = pairType->getValueType(); - if (pairTypeCache.TryGetValue(primalType, result)) + if (pairTypeCache.tryGetValue(primalType, result)) return result; if (!pairType) { @@ -315,7 +315,7 @@ IRInst* DifferentialPairTypeBuilder::lowerDiffPairType( if (!diffType) return result; result = _createDiffPairType(pairType->getValueType(), (IRType*)diffType); - pairTypeCache.Add(primalType, result); + pairTypeCache.add(primalType, result); return result; } @@ -391,20 +391,20 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func) { if (auto item = as<IRDifferentiableTypeDictionaryItem>(child)) { - auto existingItem = differentiableWitnessDictionary.TryGetValue(item->getConcreteType()); + auto existingItem = differentiableWitnessDictionary.tryGetValue(item->getConcreteType()); if (existingItem) { *existingItem = item->getWitness(); } else { - differentiableWitnessDictionary.Add((IRType*)item->getConcreteType(), item->getWitness()); + differentiableWitnessDictionary.add((IRType*)item->getConcreteType(), item->getWitness()); // Also register the type's differential type with the same witness. IRBuilder subBuilder(item->getConcreteType()); if (!as<IRInterfaceType>(item->getConcreteType())) { - differentiableWitnessDictionary.AddIfNotExists( + differentiableWitnessDictionary.addIfNotExists( (IRType*)_lookupWitness(&subBuilder, item->getWitness(), sharedContext->differentialAssocTypeStructKey), item->getWitness()); } @@ -418,7 +418,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func) auto diffWitness = _lookupWitness(&builder, diffPairType->getWitness(), sharedContext->differentialAssocTypeWitnessStructKey); if (diffType && diffWitness) { - differentiableWitnessDictionary.AddIfNotExists((IRType*)diffType, diffWitness); + differentiableWitnessDictionary.addIfNotExists((IRType*)diffType, diffWitness); } } } @@ -429,7 +429,7 @@ void DifferentiableTypeConformanceContext::setFunc(IRGlobalValueWithCode* func) IRInst* DifferentiableTypeConformanceContext::lookUpConformanceForType(IRInst* type) { IRInst* foundResult = nullptr; - differentiableWitnessDictionary.TryGetValue(type, foundResult); + differentiableWitnessDictionary.tryGetValue(type, foundResult); return foundResult; } @@ -464,7 +464,7 @@ void DifferentiableTypeConformanceContext::buildGlobalWitnessDictionary() { if (auto pairType = as<IRDifferentialPairTypeBase>(globalInst)) { - differentiableWitnessDictionary.AddIfNotExists(pairType->getValueType(), pairType->getWitness()); + differentiableWitnessDictionary.addIfNotExists(pairType->getValueType(), pairType->getWitness()); } } } @@ -873,9 +873,9 @@ bool isDifferentiableType(DifferentiableTypeConformanceContext& context, IRInst* // Look for equivalent types. for (auto type : context.differentiableWitnessDictionary) { - if (isTypeEqual(type.Key, (IRType*)typeInst)) + if (isTypeEqual(type.key, (IRType*)typeInst)) { - context.differentiableWitnessDictionary[(IRType*)typeInst] = type.Value; + context.differentiableWitnessDictionary[(IRType*)typeInst] = type.value; return true; } } @@ -1010,7 +1010,7 @@ struct AutoDiffPass : public InstPassBase auto type = processIntermediateContextTypeBase(&subBuilder, baseFunc); if (type) { - loweredIntermediateTypes.Add(type); + loweredIntermediateTypes.add(type); inst->replaceUsesWith(type); inst->removeAndDeallocate(); changed = true; @@ -1034,7 +1034,7 @@ struct AutoDiffPass : public InstPassBase // Utility function for topology sorting the intermediate context types. bool isIntermediateContextTypeReadyForProcess(OrderedHashSet<IRInst*>& contextTypes, OrderedHashSet<IRInst*>& sortedSet, IRInst* t) { - if (!contextTypes.Contains(t)) + if (!contextTypes.contains(t)) return true; switch (t->getOp()) @@ -1082,7 +1082,7 @@ struct AutoDiffPass : public InstPassBase { if (auto e = as<IRDifferentiableTypeDictionaryItem>(entry)) { - registeredType.Add(e->getOperand(0)); + registeredType.add(e->getOperand(0)); } } // Use a work list to recursively walk through all sub fields of the struct type. @@ -1092,9 +1092,9 @@ struct AutoDiffPass : public InstPassBase { auto t = wlist[i]; IntermediateContextTypeDifferentialInfo diffInfo; - if (!diffTypes.TryGetValue(t, diffInfo)) + if (!diffTypes.tryGetValue(t, diffInfo)) continue; - if (registeredType.Add(t)) + if (registeredType.add(t)) builder.addDifferentiableTypeEntry(diffDecor, t, diffInfo.diffWitness); else continue; @@ -1115,16 +1115,16 @@ struct AutoDiffPass : public InstPassBase OrderedHashSet<IRInst*> sortedContextTypes; for (;;) { - auto lastCount = sortedContextTypes.Count(); + auto lastCount = sortedContextTypes.getCount(); for (auto t : contextTypes) { - if (sortedContextTypes.Contains(t)) + if (sortedContextTypes.contains(t)) continue; // Have all dependent types been added yet? if (isIntermediateContextTypeReadyForProcess(contextTypes, sortedContextTypes, t)) - sortedContextTypes.Add(t); + sortedContextTypes.add(t); } - if (lastCount == sortedContextTypes.Count()) + if (lastCount == sortedContextTypes.getCount()) break; } @@ -1149,7 +1149,7 @@ struct AutoDiffPass : public InstPassBase // A specialize of a context type translates to a specialize of its differential type/witness. IntermediateContextTypeDifferentialInfo baseInfo; - SLANG_RELEASE_ASSERT(diffTypes.TryGetValue(specialize->getBase(), baseInfo)); + SLANG_RELEASE_ASSERT(diffTypes.tryGetValue(specialize->getBase(), baseInfo)); builder.setInsertBefore(t); List<IRInst*> args; for (UInt i = 0; i < specialize->getArgCount(); i++) @@ -1170,7 +1170,7 @@ struct AutoDiffPass : public InstPassBase // We currently don't support the `LookupInterfaceMethod` case, since it can't // appear in a derivative function because we will only call the backward diff function without a intermediate-type // via an interface. - SLANG_RELEASE_ASSERT(diffTypes.ContainsKey(t)); + SLANG_RELEASE_ASSERT(diffTypes.containsKey(t)); } } @@ -1178,16 +1178,16 @@ struct AutoDiffPass : public InstPassBase for (auto t : diffTypes) { HashSet<IRFunc*> registeredFuncs; - for (auto use = t.Key->firstUse; use; use = use->nextUse) + for (auto use = t.key->firstUse; use; use = use->nextUse) { auto parentFunc = getParentFunc(use->getUser()); if (!parentFunc) continue; - if (!registeredFuncs.Add(parentFunc)) + if (!registeredFuncs.add(parentFunc)) continue; if (auto dictDecor = parentFunc->findDecoration<IRDifferentiableTypeDictionaryDecoration>()) { - registerDiffContextType(builder, dictDecor, diffTypes, t.Key); + registerDiffContextType(builder, dictDecor, diffTypes, t.key); } } } @@ -1222,7 +1222,7 @@ struct AutoDiffPass : public InstPassBase else { IntermediateContextTypeDifferentialInfo diffFieldTypeInfo; - diffTypes.TryGetValue(field->getFieldType(), diffFieldTypeInfo); + diffTypes.tryGetValue(field->getFieldType(), diffFieldTypeInfo); diffFieldWitness = diffFieldTypeInfo.diffWitness; } if (diffFieldWitness) @@ -1370,7 +1370,7 @@ struct AutoDiffPass : public InstPassBase // any unmaterialized intermediate context types. bool isTypeFullyDifferentiated(IRInst* type) { - if (fullyDifferentiatedInsts.Contains(type)) + if (fullyDifferentiatedInsts.contains(type)) return true; if (type->getOp() == kIROp_BackwardDiffIntermediateContextType) return false; @@ -1384,7 +1384,7 @@ struct AutoDiffPass : public InstPassBase { bool result = isTypeFullyDifferentiated(findGenericReturnVal(genType)); if (result) - fullyDifferentiatedInsts.Add(genType); + fullyDifferentiatedInsts.add(genType); return result; } switch (type->getOp()) @@ -1401,7 +1401,7 @@ struct AutoDiffPass : public InstPassBase if (!isTypeFullyDifferentiated(type->getOperand(i))) return false; default: - fullyDifferentiatedInsts.Add(type); + fullyDifferentiatedInsts.add(type); return true; } } @@ -1410,7 +1410,7 @@ struct AutoDiffPass : public InstPassBase // any differentiate insts. bool isFullyDifferentiated(IRFunc* func) { - if (fullyDifferentiatedInsts.Contains(func)) + if (fullyDifferentiatedInsts.contains(func)) return true; for (auto block : func->getBlocks()) @@ -1430,7 +1430,7 @@ struct AutoDiffPass : public InstPassBase return false; } } - fullyDifferentiatedInsts.Add(func); + fullyDifferentiatedInsts.add(func); return true; } @@ -1439,7 +1439,7 @@ struct AutoDiffPass : public InstPassBase // bool processReferencedFunctions(IRBuilder* builder) { - fullyDifferentiatedInsts.Clear(); + fullyDifferentiatedInsts.clear(); bool hasChanges = false; for (;;) { diff --git a/source/slang/slang-ir-byte-address-legalize.cpp b/source/slang/slang-ir-byte-address-legalize.cpp index 0a4339ff3..2d53dcab7 100644 --- a/source/slang/slang-ir-byte-address-legalize.cpp +++ b/source/slang/slang-ir-byte-address-legalize.cpp @@ -671,10 +671,10 @@ struct ByteAddressBufferLegalizationContext KeyValuePair<IRInst*, IRInst*> key(elementType, byteAddressBufferParam); IRGlobalParam* structuredBufferParam; - if(!m_cachedStructuredBuffers.TryGetValue(key, structuredBufferParam)) + if(!m_cachedStructuredBuffers.tryGetValue(key, structuredBufferParam)) { structuredBufferParam = createEquivalentStructuredBufferParam(elementType, byteAddressBufferParam); - m_cachedStructuredBuffers.Add(key, structuredBufferParam); + m_cachedStructuredBuffers.add(key, structuredBufferParam); } return structuredBufferParam; } diff --git a/source/slang/slang-ir-check-differentiability.cpp b/source/slang/slang-ir-check-differentiability.cpp index 355381559..e1601c39a 100644 --- a/source/slang/slang-ir-check-differentiability.cpp +++ b/source/slang/slang-ir-check-differentiability.cpp @@ -93,7 +93,7 @@ public: return false; } - if (auto existingLevel = differentiableFunctions.TryGetValue(func)) + if (auto existingLevel = differentiableFunctions.tryGetValue(func)) return *existingLevel >= level; if (func->findDecoration<IRTreatAsDifferentiableDecoration>()) @@ -124,7 +124,7 @@ public: { if (as<IRGeneric>(func)) { - if (auto existingLevel = differentiableFunctions.TryGetValue(func)) + if (auto existingLevel = differentiableFunctions.tryGetValue(func)) { if (*existingLevel >= level) return true; @@ -242,8 +242,8 @@ public: { if (as<IROutTypeBase>(param->getFullType())) differentiableOutputs++; - produceDiffSet.Add(param); - carryNonTrivialDiffSet.Add(param); + produceDiffSet.add(param); + carryNonTrivialDiffSet.add(param); } } if (auto funcType = as<IRFuncType>(funcInst->getDataType())) @@ -283,7 +283,7 @@ public: return false; for (UInt i = 0; i < inst->getOperandCount(); i++) { - if (produceDiffSet.Contains(inst->getOperand(i))) + if (produceDiffSet.contains(inst->getOperand(i))) { return true; } @@ -315,7 +315,7 @@ public: return false; for (UInt i = 0; i < inst->getOperandCount(); i++) { - if (carryNonTrivialDiffSet.Contains(inst->getOperand(i))) + if (carryNonTrivialDiffSet.contains(inst->getOperand(i))) { return true; } @@ -330,7 +330,7 @@ public: { if (isInstInFunc(inst, funcInst)) { - if (expectDiffInstWorkListSet.Add(inst)) + if (expectDiffInstWorkListSet.add(inst)) { expectDiffInstWorkList.add(inst); } @@ -341,7 +341,7 @@ public: Index lastProduceDiffCount = 0; do { - lastProduceDiffCount = produceDiffSet.Count(); + lastProduceDiffCount = produceDiffSet.getCount(); for (auto block : funcInst->getBlocks()) { if (block != funcInst->getFirstBlock()) @@ -357,10 +357,10 @@ public: if (branch->getArgCount() > paramIndex) { auto arg = branch->getArg(paramIndex); - if (produceDiffSet.Contains(arg)) - produceDiffSet.Add(param); - if (carryNonTrivialDiffSet.Contains(arg)) - carryNonTrivialDiffSet.Add(param); + if (produceDiffSet.contains(arg)) + produceDiffSet.add(param); + if (carryNonTrivialDiffSet.contains(arg)) + carryNonTrivialDiffSet.add(param); } } } @@ -370,9 +370,9 @@ public: for (auto inst : block->getChildren()) { if (isInstProducingDiff(inst)) - produceDiffSet.Add(inst); + produceDiffSet.add(inst); if (isInstCarryingOverDiff(inst)) - carryNonTrivialDiffSet.Add(inst); + carryNonTrivialDiffSet.add(inst); switch (inst->getOp()) { case kIROp_Call: @@ -406,14 +406,14 @@ public: } } } - } while (produceDiffSet.Count() != lastProduceDiffCount); + } while (produceDiffSet.getCount() != lastProduceDiffCount); // Reverse propagate `expectDiffSet`. for (int i = 0; i < expectDiffInstWorkList.getCount(); i++) { auto inst = expectDiffInstWorkList[i]; // Is inst in produceDiffSet? - if (!produceDiffSet.Contains(inst)) + if (!produceDiffSet.contains(inst)) { if (auto call = as<IRCall>(inst)) { @@ -526,7 +526,7 @@ public: { if (auto storeInst = as<IRStore>(inst)) { - if (carryNonTrivialDiffSet.Contains(storeInst->getVal()) && + if (carryNonTrivialDiffSet.contains(storeInst->getVal()) && !canAddressHoldDerivative(diffTypeContext, storeInst->getPtr())) { sink->diagnose(storeInst->sourceLoc, Diagnostics::lossOfDerivativeAssigningToNonDifferentiableLocation); @@ -569,24 +569,24 @@ public: if (_isDifferentiableFuncImpl(inst, DifferentiableLevel::Backward)) { if (auto linkageDecor = inst->findDecoration<IRLinkageDecoration>()) - bwdDifferentiableSymbolNames.Add(linkageDecor->getMangledName()); - differentiableFunctions.Add(inst, DifferentiableLevel::Backward); + bwdDifferentiableSymbolNames.add(linkageDecor->getMangledName()); + differentiableFunctions.add(inst, DifferentiableLevel::Backward); } else if (_isDifferentiableFuncImpl(inst, DifferentiableLevel::Forward)) { if (auto linkageDecor = inst->findDecoration<IRLinkageDecoration>()) - fwdDifferentiableSymbolNames.Add(linkageDecor->getMangledName()); - differentiableFunctions.Add(inst, DifferentiableLevel::Forward); + fwdDifferentiableSymbolNames.add(linkageDecor->getMangledName()); + differentiableFunctions.add(inst, DifferentiableLevel::Forward); } } for (auto inst : module->getGlobalInsts()) { if (auto linkageDecor = inst->findDecoration<IRLinkageDecoration>()) { - if (bwdDifferentiableSymbolNames.Contains(linkageDecor->getMangledName())) + if (bwdDifferentiableSymbolNames.contains(linkageDecor->getMangledName())) differentiableFunctions[inst] = DifferentiableLevel::Backward; - else if (fwdDifferentiableSymbolNames.Contains(linkageDecor->getMangledName())) - differentiableFunctions.AddIfNotExists(inst, DifferentiableLevel::Forward); + else if (fwdDifferentiableSymbolNames.contains(linkageDecor->getMangledName())) + differentiableFunctions.addIfNotExists(inst, DifferentiableLevel::Forward); } } diff --git a/source/slang/slang-ir-cleanup-void.cpp b/source/slang/slang-ir-cleanup-void.cpp index 47d982950..7fc9041ec 100644 --- a/source/slang/slang-ir-cleanup-void.cpp +++ b/source/slang/slang-ir-cleanup-void.cpp @@ -22,11 +22,11 @@ namespace Slang return; } - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } void processInst(IRInst* inst) @@ -160,7 +160,7 @@ namespace Slang IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-clone.cpp b/source/slang/slang-ir-clone.cpp index 6ac9442ee..9258e511f 100644 --- a/source/slang/slang-ir-clone.cpp +++ b/source/slang/slang-ir-clone.cpp @@ -12,7 +12,7 @@ IRInst* lookUp(IRCloneEnv* env, IRInst* oldVal) for( auto ee = env; ee; ee = ee->parent ) { IRInst* newVal = nullptr; - if(ee->mapOldValToNew.TryGetValue(oldVal, newVal)) + if(ee->mapOldValToNew.tryGetValue(oldVal, newVal)) return newVal; } return nullptr; @@ -173,7 +173,7 @@ static void _cloneInstDecorationsAndChildren( // old to new values. // auto newChild = cloneInstAndOperands(env, builder, oldChild); - env->mapOldValToNew.Add(oldChild, newChild); + env->mapOldValToNew.add(oldChild, newChild); // If and only if the old child had decorations // or children, we will register it into our @@ -245,7 +245,7 @@ IRInst* cloneInst( SLANG_ASSERT(oldInst); IRInst* newInst = nullptr; - if( env->mapOldValToNew.TryGetValue(oldInst, newInst) ) + if( env->mapOldValToNew.tryGetValue(oldInst, newInst) ) { // In this case, somebody is trying to clone an // instruction that already had been cloned @@ -266,7 +266,7 @@ IRInst* cloneInst( newInst = cloneInstAndOperands( env, builder, oldInst); - env->mapOldValToNew.Add(oldInst, newInst); + env->mapOldValToNew.add(oldInst, newInst); cloneInstDecorationsAndChildren( env, builder->getModule(), oldInst, newInst); diff --git a/source/slang/slang-ir-constexpr.cpp b/source/slang/slang-ir-constexpr.cpp index c1f14fe24..883997d8a 100644 --- a/source/slang/slang-ir-constexpr.cpp +++ b/source/slang/slang-ir-constexpr.cpp @@ -209,10 +209,10 @@ void maybeAddToWorkList( PropagateConstExprContext* context, IRInst* gv) { - if( !context->onWorkList.Contains(gv) ) + if( !context->onWorkList.contains(gv) ) { context->workList.add(gv); - context->onWorkList.Add(gv); + context->onWorkList.add(gv); } } @@ -532,7 +532,7 @@ void propagateConstExpr( { auto gv = context.workList[0]; context.workList.fastRemoveAt(0); - context.onWorkList.Remove(gv); + context.onWorkList.remove(gv); switch( gv->getOp() ) { diff --git a/source/slang/slang-ir-dce.cpp b/source/slang/slang-ir-dce.cpp index 1b0ecf521..64e0e3648 100644 --- a/source/slang/slang-ir-dce.cpp +++ b/source/slang/slang-ir-dce.cpp @@ -52,7 +52,7 @@ struct DeadCodeEliminationContext // if(!inst) return false; - return liveInsts.Contains(inst); + return liveInsts.contains(inst); } // We are going to do an iterative analysis @@ -81,9 +81,9 @@ struct DeadCodeEliminationContext // if(!inst) return; - if(liveInsts.Contains(inst)) + if(liveInsts.contains(inst)) return; - liveInsts.Add(inst); + liveInsts.add(inst); workList.add(inst); } @@ -106,7 +106,7 @@ struct DeadCodeEliminationContext bool result = false; for (;;) { - liveInsts.Clear(); + liveInsts.clear(); workList.clear(); // First of all, we know that the root instruction diff --git a/source/slang/slang-ir-deduplicate.cpp b/source/slang/slang-ir-deduplicate.cpp index f0d0f57dd..8db57b3f3 100644 --- a/source/slang/slang-ir-deduplicate.cpp +++ b/source/slang/slang-ir-deduplicate.cpp @@ -7,8 +7,8 @@ namespace Slang m_module = module; m_session = module->getSession(); - m_globalValueNumberingMap.Clear(); - m_constantMap.Clear(); + m_globalValueNumberingMap.clear(); + m_constantMap.clear(); } void IRDeduplicationContext::removeHoistableInstFromGlobalNumberingMap(IRInst* instToRemove) @@ -17,7 +17,7 @@ namespace Slang List<IRInst*> userWorkList; auto addToWorkList = [&](IRInst* i) { - if (userWorkListSet.Add(i)) + if (userWorkListSet.add(i)) userWorkList.add(i); }; addToWorkList(instToRemove); @@ -40,7 +40,7 @@ namespace Slang List<IRInst*> workList; HashSet<IRInst*> workListSet; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); IRBuilder builder(inst->getModule()); for (Index i = 0; i < workList.getCount(); i++) @@ -71,7 +71,7 @@ namespace Slang { if (getIROpInfo(use->getUser()->getOp()).isHoistable()) { - if (workListSet.Add(use->getUser())) + if (workListSet.add(use->getUser())) workList.add(use->getUser()); } } diff --git a/source/slang/slang-ir-dominators.cpp b/source/slang/slang-ir-dominators.cpp index e03ae9425..6c2045b7f 100644 --- a/source/slang/slang-ir-dominators.cpp +++ b/source/slang/slang-ir-dominators.cpp @@ -179,7 +179,7 @@ IRDominatorTree::DominatedList IRDominatorTree::getProperlyDominatedBlocks(IRBlo Int IRDominatorTree::getBlockIndex(IRBlock* block) { Int index = kInvalidIndex; - if(!mapBlockToIndex.TryGetValue(block, index)) + if(!mapBlockToIndex.tryGetValue(block, index)) { SLANG_UNEXPECTED("block was not present in dominator tree"); } @@ -188,7 +188,7 @@ Int IRDominatorTree::getBlockIndex(IRBlock* block) bool IRDominatorTree::isUnreachable(IRBlock* block) { - return !mapBlockToIndex.ContainsKey(block); + return !mapBlockToIndex.containsKey(block); } @@ -279,11 +279,11 @@ struct DepthFirstSearchContext template<typename SuccessorFunc> void walk(IRBlock* block, const SuccessorFunc& getSuccessors) { - visited.Add(block); + visited.add(block); preVisit(block); for(auto succ : getSuccessors(block)) { - if(!visited.Contains(succ)) + if(!visited.contains(succ)) { walk(succ, getSuccessors); } @@ -328,7 +328,7 @@ void computePostorder(IRGlobalValueWithCode* code, List<IRBlock*>& outOrder) List<IRBlock*> prefix; for (auto block : code->getBlocks()) { - if (!context.visited.Contains(block)) + if (!context.visited.contains(block)) { prefix.add(block); } @@ -753,7 +753,7 @@ struct DominatorTreeComputationContext // from the block to the node index. // node.block = block; - dominatorTree->mapBlockToIndex.Add(block, nodeIndex); + dominatorTree->mapBlockToIndex.add(block, nodeIndex); // Filling in the parent is easy enough, just with the detail that // we need to handle the invalid case explicitly (for a node with diff --git a/source/slang/slang-ir-eliminate-multilevel-break.cpp b/source/slang/slang-ir-eliminate-multilevel-break.cpp index 83da1bba5..7db517309 100644 --- a/source/slang/slang-ir-eliminate-multilevel-break.cpp +++ b/source/slang/slang-ir-eliminate-multilevel-break.cpp @@ -63,21 +63,21 @@ struct EliminateMultiLevelBreakContext { // Push break block to a stack so we can easily check if a block is a break block in its // parent regions. - breakBlocks.Add(info.getBreakBlock()); + breakBlocks.add(info.getBreakBlock()); auto successors = as<IRBlock>(info.headerInst->getParent())->getSuccessors(); for (auto successor : successors) { - if (!breakBlocks.Add(successor)) + if (!breakBlocks.add(successor)) continue; - if (info.blockSet.Add(successor)) + if (info.blockSet.add(successor)) info.blocks.add(successor); } for (Index i = 0; i < info.blocks.getCount(); i++) { auto block = info.blocks[i]; - if (!processedBlocks.Add(block)) + if (!processedBlocks.add(block)) continue; switch (block->getTerminator()->getOp()) { @@ -92,7 +92,7 @@ struct EliminateMultiLevelBreakContext collectBreakableRegionBlocks(*childRegion); info.childRegions.add(childRegion); block = childRegion->getBreakBlock(); - if (info.blockSet.Add(block)) + if (info.blockSet.add(block)) { info.blocks.add(block); } @@ -103,23 +103,23 @@ struct EliminateMultiLevelBreakContext } for (auto succ : block->getSuccessors()) { - if (!breakBlocks.Contains(succ)) + if (!breakBlocks.contains(succ)) { - if (info.blockSet.Add(succ)) + if (info.blockSet.add(succ)) info.blocks.add(succ); } } } // Pop the break block from stack since we are no longer processing the region. - breakBlocks.Remove(info.getBreakBlock()); + breakBlocks.remove(info.getBreakBlock()); } void gatherInfo(IRGlobalValueWithCode* func) { for (auto block : func->getBlocks()) { - if (processedBlocks.Contains(block)) + if (processedBlocks.contains(block)) continue; auto terminator = block->getTerminator(); switch (terminator->getOp()) @@ -142,9 +142,9 @@ struct EliminateMultiLevelBreakContext l->forEach( [&](BreakableRegionInfo* region) { - mapBreakBlockToRegion.Add(region->getBreakBlock(), region); + mapBreakBlockToRegion.add(region->getBreakBlock(), region); for (auto block : region->blocks) - mapBlockToRegion.Add(block, region); + mapBlockToRegion.add(block, region); }); } @@ -157,9 +157,9 @@ struct EliminateMultiLevelBreakContext continue; BreakableRegionInfo* breakTargetRegion = nullptr; BreakableRegionInfo* currentRegion = nullptr; - if (!mapBreakBlockToRegion.TryGetValue(branch->getTargetBlock(), breakTargetRegion)) + if (!mapBreakBlockToRegion.tryGetValue(branch->getTargetBlock(), breakTargetRegion)) continue; - if (mapBlockToRegion.TryGetValue(block, currentRegion)) + if (mapBlockToRegion.tryGetValue(block, currentRegion)) { if (currentRegion != breakTargetRegion) { @@ -265,7 +265,7 @@ struct EliminateMultiLevelBreakContext auto region = breakInfo.currentRegion; while (region) { - skippedOverRegions.Add(region); + skippedOverRegions.add(region); region = region->parent; if (region == breakInfo.breakTargetRegion) break; @@ -319,7 +319,7 @@ struct EliminateMultiLevelBreakContext } builder.setInsertInto(jumpToOuterBlock); - if (skippedOverRegions.Contains(skippedRegion->parent)) + if (skippedOverRegions.contains(skippedRegion->parent)) { builder.emitBranch(skippedRegion->parent->getBreakBlock(), 1, (IRInst**)&targetLevelParam); } @@ -334,8 +334,8 @@ struct EliminateMultiLevelBreakContext // value equal to the level of its corresponding region. for (auto breakBlockKV : mapNewBreakBlockToRegionLevel) { - auto breakBlock = breakBlockKV.Key; - auto level = breakBlockKV.Value; + auto breakBlock = breakBlockKV.key; + auto level = breakBlockKV.value; IRInst* levelInst = nullptr; List<IRUse*> uses; for (auto use = breakBlock->firstUse; use; use = use->nextUse) diff --git a/source/slang/slang-ir-eliminate-phis.cpp b/source/slang/slang-ir-eliminate-phis.cpp index e0d51edd3..48e95303f 100644 --- a/source/slang/slang-ir-eliminate-phis.cpp +++ b/source/slang/slang-ir-eliminate-phis.cpp @@ -142,9 +142,9 @@ struct PhiEliminationContext for (auto instAlloc : m_registerAllocation.mapInstToRegister) { - auto inst = instAlloc.Key; + auto inst = instAlloc.key; IRInst* registerVar = nullptr; - m_mapRegToTempVar.TryGetValue(instAlloc.Value, registerVar); + m_mapRegToTempVar.tryGetValue(instAlloc.value, registerVar); SLANG_RELEASE_ASSERT(registerVar); switch (inst->getOp()) @@ -156,10 +156,10 @@ struct PhiEliminationContext auto updateInst = as<IRUpdateElement>(inst); builder.setInsertBefore(updateInst); RefPtr<RegisterInfo> oldReg; - m_registerAllocation.mapInstToRegister.TryGetValue(updateInst->getOldValue(), oldReg); + m_registerAllocation.mapInstToRegister.tryGetValue(updateInst->getOldValue(), oldReg); // If the original value is not assigned to the same register as this inst, // we need to insert a copy. - if (instAlloc.Value != oldReg) + if (instAlloc.value != oldReg) { builder.emitStore(registerVar, updateInst->getOldValue()); } @@ -180,9 +180,9 @@ struct PhiEliminationContext for (auto instAlloc : m_registerAllocation.mapInstToRegister) { - auto inst = instAlloc.Key; + auto inst = instAlloc.key; IRInst* registerVar = nullptr; - m_mapRegToTempVar.TryGetValue(instAlloc.Value, registerVar); + m_mapRegToTempVar.tryGetValue(instAlloc.value, registerVar); SLANG_RELEASE_ASSERT(registerVar); while (auto use = inst->firstUse) { @@ -221,8 +221,8 @@ struct PhiEliminationContext Dictionary<RegisterInfo*, IRInst*> mapRegToVar; for (auto& regList : m_registerAllocation.mapTypeToRegisterList) { - auto type = regList.Key; - for (auto reg : regList.Value) + auto type = regList.key; + for (auto reg : regList.value) { // Find the common dominator for all the insts, and determine the latest insertion // point of the tempVar inst. @@ -417,21 +417,21 @@ struct PhiEliminationContext // be building up auxilliary data structures that the // subsequent steps will make use of. // - mapParamToIndex.Clear(); + mapParamToIndex.clear(); phiInfos.clear(); Count paramCounter = 0; for (auto param : block->getParams()) { Index paramIndex = paramCounter++; - mapParamToIndex.Add(param, paramIndex); + mapParamToIndex.add(param, paramIndex); IRInst* temp = nullptr; // Have we already allocated a register for this inst? // If so we use the var for that register. - if (auto registerInfo = m_registerAllocation.mapInstToRegister.TryGetValue(param)) + if (auto registerInfo = m_registerAllocation.mapInstToRegister.tryGetValue(param)) { - m_mapRegToTempVar.TryGetValue(registerInfo->get(), temp); + m_mapRegToTempVar.tryGetValue(registerInfo->get(), temp); } if (!temp) @@ -700,7 +700,7 @@ struct PhiEliminationContext // the map we pre-computed. // Index srcParamIndex = kInvalidIndex; - mapParamToIndex.TryGetValue(srcArgVal, srcParamIndex); + mapParamToIndex.tryGetValue(srcArgVal, srcParamIndex); srcArg.paramIndex = srcParamIndex; if (srcParamIndex != kInvalidIndex) diff --git a/source/slang/slang-ir-explicit-global-context.cpp b/source/slang/slang-ir-explicit-global-context.cpp index ce55bd44a..ab3a8bb51 100644 --- a/source/slang/slang-ir-explicit-global-context.cpp +++ b/source/slang/slang-ir-explicit-global-context.cpp @@ -256,7 +256,7 @@ struct IntroduceExplicitGlobalContextPass // for the instruction, so that we can use the key // to access the field later. // - m_mapInstToContextFieldKey.Add(originalInst, key); + m_mapInstToContextFieldKey.add(originalInst, key); } void createContextForEntryPoint(IRFunc* entryPointFunc) @@ -309,7 +309,7 @@ struct IntroduceExplicitGlobalContextPass // auto contextVarPtr = builder.emitVar(m_contextStructType); addKernelContextNameHint(contextVarPtr); - m_mapFuncToContextPtr.Add(entryPointFunc, contextVarPtr); + m_mapFuncToContextPtr.add(entryPointFunc, contextVarPtr); // If there is a global-scope uniform parameter, then // we need to use our new explicit entry point parameter @@ -444,7 +444,7 @@ struct IntroduceExplicitGlobalContextPass // If we already created such a pointer (perhaps because // `func` is an entry point), then we are home free. // - if( auto found = m_mapFuncToContextPtr.TryGetValue(func) ) + if( auto found = m_mapFuncToContextPtr.tryGetValue(func) ) { return *found; } @@ -476,7 +476,7 @@ struct IntroduceExplicitGlobalContextPass // that call `func` to protect against a possible infinite-recursion // situation if `func` is recursive along some path. // - m_mapFuncToContextPtr.Add(func, contextParam); + m_mapFuncToContextPtr.add(func, contextParam); // Any code that calls `func` now needs to be updated to pass // the context parameter. diff --git a/source/slang/slang-ir-generics-lowering-context.cpp b/source/slang/slang-ir-generics-lowering-context.cpp index 0dbc84e51..609a9e298 100644 --- a/source/slang/slang-ir-generics-lowering-context.cpp +++ b/source/slang/slang-ir-generics-lowering-context.cpp @@ -56,7 +56,7 @@ namespace Slang IRInst* SharedGenericsLoweringContext::maybeEmitRTTIObject(IRInst* typeInst) { IRInst* result = nullptr; - if (mapTypeToRTTIObject.TryGetValue(typeInst, result)) + if (mapTypeToRTTIObject.tryGetValue(typeInst, result)) return result; IRBuilder builderStorage(module); auto builder = &builderStorage; @@ -87,17 +87,17 @@ namespace Slang IRInst* SharedGenericsLoweringContext::findInterfaceRequirementVal(IRInterfaceType* interfaceType, IRInst* requirementKey) { - if (auto dict = mapInterfaceRequirementKeyValue.TryGetValue(interfaceType)) - return (*dict)[requirementKey].GetValue(); + if (auto dict = mapInterfaceRequirementKeyValue.tryGetValue(interfaceType)) + return (*dict)[requirementKey].getValue(); _builldInterfaceRequirementMap(interfaceType); return findInterfaceRequirementVal(interfaceType, requirementKey); } void SharedGenericsLoweringContext::_builldInterfaceRequirementMap(IRInterfaceType* interfaceType) { - mapInterfaceRequirementKeyValue.Add(interfaceType, + mapInterfaceRequirementKeyValue.add(interfaceType, Dictionary<IRInst*, IRInst*>()); - auto dict = mapInterfaceRequirementKeyValue.TryGetValue(interfaceType); + auto dict = mapInterfaceRequirementKeyValue.tryGetValue(interfaceType); for (UInt i = 0; i < interfaceType->getOperandCount(); i++) { auto entry = cast<IRInterfaceRequirementEntry>(interfaceType->getOperand(i)); @@ -136,7 +136,7 @@ namespace Slang return nullptr; IRInst* resultType; - if (typeMapping.TryGetValue(paramType, resultType)) + if (typeMapping.tryGetValue(paramType, resultType)) return (IRType*)resultType; if (isTypeValue(paramType)) @@ -302,7 +302,7 @@ namespace Slang // Only in the original interface type will an associated type entry have an IRAssociatedType value. // We need to extract AnyValueSize from this IRAssociatedType. // In lowered interface type, that entry is lowered into an Ptr(RTTIType) and this info is lost. - mapLoweredInterfaceToOriginal.TryGetValue(interfaceType, interfaceType); + mapLoweredInterfaceToOriginal.tryGetValue(interfaceType, interfaceType); auto reqVal = findInterfaceRequirementVal( interfaceType, lookupInterface->getRequirementKey()); diff --git a/source/slang/slang-ir-generics-lowering-context.h b/source/slang/slang-ir-generics-lowering-context.h index 8030751d0..8790da901 100644 --- a/source/slang/slang-ir-generics-lowering-context.h +++ b/source/slang/slang-ir-generics-lowering-context.h @@ -58,11 +58,11 @@ namespace Slang return; } - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } @@ -108,7 +108,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); func(inst); diff --git a/source/slang/slang-ir-glsl-liveness.cpp b/source/slang/slang-ir-glsl-liveness.cpp index 1a42155bc..af64df4f4 100644 --- a/source/slang/slang-ir-glsl-liveness.cpp +++ b/source/slang/slang-ir-glsl-liveness.cpp @@ -121,7 +121,7 @@ void GLSLLivenessContext::_replaceMarker(IRLiveRangeMarker* markerInst) IRFunc* func = nullptr; - if (IRFunc** funcPtr = entry.m_funcs.TryGetValue(referencedType)) + if (IRFunc** funcPtr = entry.m_funcs.tryGetValue(referencedType)) { func = *funcPtr; } @@ -146,7 +146,7 @@ void GLSLLivenessContext::_replaceMarker(IRLiveRangeMarker* markerInst) _addDecorations(kind, func); // Add to the map - entry.m_funcs.Add(referencedType, func); + entry.m_funcs.add(referencedType, func); } SLANG_ASSERT(func); diff --git a/source/slang/slang-ir-inline.cpp b/source/slang/slang-ir-inline.cpp index ed4fc7b06..f825a9461 100644 --- a/source/slang/slang-ir-inline.cpp +++ b/source/slang/slang-ir-inline.cpp @@ -309,7 +309,7 @@ struct InliningPassBase SLANG_ASSERT(argCounter < (Int)specialize->getArgCount()); auto arg = specialize->getArg(argCounter++); - env.mapOldValToNew.Add(param, arg); + env.mapOldValToNew.add(param, arg); } SLANG_ASSERT(argCounter == (Int)specialize->getArgCount()); @@ -365,7 +365,7 @@ struct InliningPassBase { SLANG_ASSERT(argCounter < (Int)call->getArgCount()); auto arg = call->getArg(argCounter++); - env.mapOldValToNew.Add(param, arg); + env.mapOldValToNew.add(param, arg); } SLANG_ASSERT(argCounter == (Int)call->getArgCount()); } @@ -572,7 +572,7 @@ struct InliningPassBase // Insert a branch into the cloned first block at the end of `callerBlock`. builder->setInsertInto(callerBlock); - auto mainBlock = as<IRBlock>(env->mapOldValToNew[callee->getFirstBlock()].GetValue()); + auto mainBlock = as<IRBlock>(env->mapOldValToNew[callee->getFirstBlock()].getValue()); auto newBranch = builder->emitLoop(mainBlock, afterBlock, mainBlock); _setSourceLoc(newBranch, call, callSite); @@ -580,7 +580,7 @@ struct InliningPassBase bool isFirstBlock = true; for (auto calleeBlock : callee->getBlocks()) { - auto clonedBlock = env->mapOldValToNew[calleeBlock].GetValue(); + auto clonedBlock = env->mapOldValToNew[calleeBlock].getValue(); builder->setInsertInto(clonedBlock); // We will loop over the instructions of the each block, // and clone each of them appropriately. diff --git a/source/slang/slang-ir-inst-pass-base.h b/source/slang/slang-ir-inst-pass-base.h index 2db8a725f..14607d722 100644 --- a/source/slang/slang-ir-inst-pass-base.h +++ b/source/slang/slang-ir-inst-pass-base.h @@ -17,11 +17,11 @@ namespace Slang HashSet<IRInst*> workListSet; void addToWorkList(IRInst* inst) { - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } IRInst* pop(bool removeFromSet = true) @@ -32,7 +32,7 @@ namespace Slang IRInst* inst = workList.getLast(); workList.removeLast(); if (removeFromSet) - workListSet.Remove(inst); + workListSet.remove(inst); return inst; } @@ -45,7 +45,7 @@ namespace Slang void processInstsOfType(IROp instOp, const Func& f) { workList.clear(); - workListSet.Clear(); + workListSet.clear(); addToWorkList(module->getModuleInst()); @@ -69,7 +69,7 @@ namespace Slang void processChildInstsOfType(IROp instOp, IRInst* parent, const Func& f) { workList.clear(); - workListSet.Clear(); + workListSet.clear(); addToWorkList(parent); @@ -92,7 +92,7 @@ namespace Slang void processChildInsts(IRInst* root, const Func& f) { workList.clear(); - workListSet.Clear(); + workListSet.clear(); addToWorkList(root); @@ -119,7 +119,7 @@ namespace Slang void processAllReachableInsts(const Func& f) { workList.clear(); - workListSet.Clear(); + workListSet.clear(); addToWorkList(module->getModuleInst()); while (workList.getCount() != 0) diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp index 52b5bc72f..5bfbfe994 100644 --- a/source/slang/slang-ir-legalize-types.cpp +++ b/source/slang/slang-ir-legalize-types.cpp @@ -179,7 +179,7 @@ static LegalVal legalizeOperand( IRInst* irValue) { LegalVal legalVal; - if( context->mapValToLegalVal.TryGetValue(irValue, legalVal) ) + if( context->mapValToLegalVal.tryGetValue(irValue, legalVal) ) { return maybeMaterializeWrappedValue(context, legalVal); } @@ -599,7 +599,7 @@ private: // recorded for the function. // RefPtr<LegalFuncInfo> parentFuncInfo; - if( !m_context->mapFuncToInfo.TryGetValue(parentFunc, parentFuncInfo) ) + if( !m_context->mapFuncToInfo.tryGetValue(parentFunc, parentFuncInfo) ) { // If we fail to find the extended information then either: // @@ -2313,7 +2313,7 @@ struct LegalFuncBuilder // the reuslt value into the newly-declared parameter(s). // RefPtr<LegalFuncInfo> funcInfo = new LegalFuncInfo(); - m_context->mapFuncToInfo.Add(oldFunc, funcInfo); + m_context->mapFuncToInfo.add(oldFunc, funcInfo); // We know that our new parameters need to come after // those that were declared for the "base" parameters @@ -3480,7 +3480,7 @@ struct IRTypeLegalizationPass bool hasBeenAddedToWorkListOrProcessed(IRInst* inst) { if (hasBeenAddedToWorkList(inst)) return true; - return hasBeenAddedOrProcessedSet.Contains(inst); + return hasBeenAddedOrProcessedSet.contains(inst); } // We will add a simple query to check whether an instruciton @@ -3520,7 +3520,7 @@ struct IRTypeLegalizationPass // if(inst->getOp() == kIROp_InterfaceRequirementEntry) return true; - return addedToWorkListSet.Contains(inst); + return addedToWorkListSet.contains(inst); } // Next we define a convenience routine for adding something to the work list. @@ -3529,11 +3529,11 @@ struct IRTypeLegalizationPass { // We want to avoid adding anything we've already added or processed. // - if(addedToWorkListSet.Contains(inst)) + if(addedToWorkListSet.contains(inst)) return; workList.add(inst); - addedToWorkListSet.Add(inst); - hasBeenAddedOrProcessedSet.Add(inst); + addedToWorkListSet.add(inst); + hasBeenAddedOrProcessedSet.add(inst); } void processModule(IRModule* module) @@ -3546,7 +3546,7 @@ struct IRTypeLegalizationPass // for (;;) { - auto lastReplacedInstCount = context->replacedInstructions.Count(); + auto lastReplacedInstCount = context->replacedInstructions.getCount(); addToWorkList(module->getModuleInst()); while( workList.getCount() != 0 ) { @@ -3562,7 +3562,7 @@ struct IRTypeLegalizationPass // List<IRInst*> workListCopy; Swap(workListCopy, workList); - addedToWorkListSet.Clear(); + addedToWorkListSet.clear(); // Now we simply process each instruction on the copy of // the work list, knowing that `processInst` may add additional @@ -3575,7 +3575,7 @@ struct IRTypeLegalizationPass } // Any changes made? Run the process again. - if (lastReplacedInstCount == context->replacedInstructions.Count()) + if (lastReplacedInstCount == context->replacedInstructions.getCount()) break; } @@ -3594,7 +3594,7 @@ struct IRTypeLegalizationPass continue; if (as<IRType>(user)) continue; - if (!context->replacedInstructions.Contains(user)) + if (!context->replacedInstructions.contains(user)) SLANG_UNEXPECTED("replaced inst still has use."); if (lv->getParent()) SLANG_UNEXPECTED("replaced inst still in a parent."); diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp index b976f4b21..de9071adf 100644 --- a/source/slang/slang-ir-link.cpp +++ b/source/slang/slang-ir-link.cpp @@ -326,7 +326,7 @@ IRInst* findClonedValue( IRInst* clonedValue = nullptr; for (auto env = context->getEnv(); env; env = env->parent) { - if (env->clonedValues.TryGetValue(originalValue, clonedValue)) + if (env->clonedValues.tryGetValue(originalValue, clonedValue)) { return clonedValue; } @@ -596,7 +596,7 @@ IRGeneric* cloneGenericImpl( continue; for (auto kv : paramMapping) { - registerClonedValue(context, kv.Key, kv.Value); + registerClonedValue(context, kv.key, kv.value); } IRBuilder builderStorage = *builder; @@ -891,11 +891,11 @@ IRFunc* specializeIRForEntryPoint( // not the same as the mangled name of the decl. // RefPtr<IRSpecSymbol> sym; - if (!context->getSymbols().TryGetValue(mangledName, sym)) + if (!context->getSymbols().tryGetValue(mangledName, sym)) { String hashedName = getHashedName(mangledName.getUnownedSlice()); - if (!context->getSymbols().TryGetValue(hashedName, sym)) + if (!context->getSymbols().tryGetValue(hashedName, sym)) { SLANG_UNEXPECTED("no matching IR symbol"); return nullptr; @@ -1263,7 +1263,7 @@ IRInst* cloneGlobalValueWithLinkage( auto mangledName = String(originalLinkage->getMangledName()); RefPtr<IRSpecSymbol> sym; - if( !context->getSymbols().TryGetValue(mangledName, sym) ) + if( !context->getSymbols().tryGetValue(mangledName, sym) ) { if(!originalVal) return nullptr; @@ -1338,14 +1338,14 @@ void insertGlobalValueSymbol( sym->irGlobalValue = gv; RefPtr<IRSpecSymbol> prev; - if (sharedContext->symbols.TryGetValue(mangledName, prev)) + if (sharedContext->symbols.tryGetValue(mangledName, prev)) { sym->nextWithSameName = prev->nextWithSameName; prev->nextWithSameName = sym; } else { - sharedContext->symbols.Add(mangledName, sym); + sharedContext->symbols.add(mangledName, sym); } } diff --git a/source/slang/slang-ir-liveness.cpp b/source/slang/slang-ir-liveness.cpp index f2d834cc1..9cd4462af 100644 --- a/source/slang/slang-ir-liveness.cpp +++ b/source/slang/slang-ir-liveness.cpp @@ -768,13 +768,13 @@ void LivenessContext::_addInst(IRInst* inst) void LivenessContext::_addAccessInst(IRInst* inst) { // If we already have it don't need to add again - if (m_accessSet.Contains(inst)) + if (m_accessSet.contains(inst)) { return; } // Add to the access set - m_accessSet.Add(inst); + m_accessSet.add(inst); // Add the instruction to the block info _addInst(inst); @@ -785,7 +785,7 @@ void LivenessContext::_findAliasesAndAccesses(IRInst* root) // Clear all the aliases m_aliases.clear(); // Clear the access set - m_accessSet.Clear(); + m_accessSet.clear(); // Add the root to the list of aliases, to start lookup m_aliases.add(root); @@ -997,7 +997,7 @@ bool LivenessContext::_isNormalRunInst(IRInst* inst) { // Just because it's the right type *doesn't* mean it's an access, it has to also // be in the access set - return m_accessSet.Contains(inst); + return m_accessSet.contains(inst); } return false; @@ -1289,7 +1289,7 @@ void LivenessContext::_processFunction(IRFunc* func) // By having as an index we can easily/quickly associate information with blocks with arrays // Set up the map from blocks to indices - m_blockIndexMap.Clear(); + m_blockIndexMap.clear(); m_blockInfos.clear(); m_fixedBlockInfos.clear(); @@ -1304,7 +1304,7 @@ void LivenessContext::_processFunction(IRFunc* func) for (auto block : func->getChildren()) { IRBlock* blockInst = as<IRBlock>(block); - m_blockIndexMap.Add(blockInst, BlockIndex(index++)); + m_blockIndexMap.add(blockInst, BlockIndex(index++)); FixedBlockInfo fixedBlockInfo; fixedBlockInfo.init(blockInst); @@ -1484,7 +1484,7 @@ void LivenessContext::_orderRangeStartsDeterministically() Index order = -1; - if (auto orderPtr = rootOrderMap.TryGetValueOrAdd(root, orderCounter + 1)) + if (auto orderPtr = rootOrderMap.tryGetValueOrAdd(root, orderCounter + 1)) { order = *orderPtr; } diff --git a/source/slang/slang-ir-loop-unroll.cpp b/source/slang/slang-ir-loop-unroll.cpp index a368ff8c8..f068eded4 100644 --- a/source/slang/slang-ir-loop-unroll.cpp +++ b/source/slang/slang-ir-loop-unroll.cpp @@ -17,7 +17,7 @@ static bool _eliminateDeadBlocks(List<IRBlock*>& blocks, IRBlock* unreachableBlo return false; bool changed = false; HashSet<IRBlock*> aliveBlocks; - aliveBlocks.Add(blocks[0]); + aliveBlocks.add(blocks[0]); List<IRBlock*> workList; workList.add(blocks[0]); for (Index i = 0; i < workList.getCount(); i++) @@ -25,7 +25,7 @@ static bool _eliminateDeadBlocks(List<IRBlock*>& blocks, IRBlock* unreachableBlo auto block = workList[i]; for (auto succ : block->getSuccessors()) { - if (aliveBlocks.Add(succ)) + if (aliveBlocks.add(succ)) { workList.add(succ); } @@ -33,7 +33,7 @@ static bool _eliminateDeadBlocks(List<IRBlock*>& blocks, IRBlock* unreachableBlo } for (auto& b : blocks) { - if (!aliveBlocks.Contains(b)) + if (!aliveBlocks.contains(b)) { if (b->hasUses()) { @@ -53,7 +53,7 @@ List<IRBlock*> _collectBlocksInLoop(IRDominatorTree* dom, IRLoop* loopInst) HashSet<IRBlock*> loopBlocksSet; auto addBlock = [&](IRBlock* block) { - if (loopBlocksSet.Add(block)) + if (loopBlocksSet.add(block)) loopBlocks.add(block); }; auto firstBlock = as<IRBlock>(loopInst->block.get()); @@ -347,7 +347,7 @@ static bool _unrollLoop( builder.setInsertBefore(firstIterationBreakBlock); auto clonedBlock = builder.createBlock(); clonedBlock->insertBefore(firstIterationBreakBlock); - cloneEnv.mapOldValToNew.AddIfNotExists(b, clonedBlock); + cloneEnv.mapOldValToNew.addIfNotExists(b, clonedBlock); clonedBlocks.add(clonedBlock); } @@ -408,19 +408,19 @@ static bool _unrollLoop( HashSet<IRBlock*> blockSet; for (auto block : blocks) { - blockSet.Add(block); + blockSet.add(block); } for (auto block : blocks) { for (auto inst : block->getChildren()) { IRInst* newInst = nullptr; - if (!cloneEnv.mapOldValToNew.TryGetValue(inst, newInst)) + if (!cloneEnv.mapOldValToNew.tryGetValue(inst, newInst)) continue; for (auto use = inst->firstUse; use;) { auto nextUse = use->nextUse; - if (!blockSet.Contains(as<IRBlock>(use->getUser()->getParent()))) + if (!blockSet.contains(as<IRBlock>(use->getUser()->getParent()))) { use->set(newInst); } diff --git a/source/slang/slang-ir-lower-bit-cast.cpp b/source/slang/slang-ir-lower-bit-cast.cpp index 700d30d52..b63f32dab 100644 --- a/source/slang/slang-ir-lower-bit-cast.cpp +++ b/source/slang/slang-ir-lower-bit-cast.cpp @@ -21,10 +21,10 @@ struct BitCastLoweringContext return; } - if (workList.Contains(inst)) + if (workList.contains(inst)) return; - workList.Add(inst); + workList.add(inst); } void processInst(IRInst* inst) @@ -43,7 +43,7 @@ struct BitCastLoweringContext { addToWorkList(module->getModuleInst()); - while (workList.Count() != 0) + while (workList.getCount() != 0) { IRInst* inst = workList.getLast(); diff --git a/source/slang/slang-ir-lower-com-methods.cpp b/source/slang/slang-ir-lower-com-methods.cpp index 4ff9c1848..181965849 100644 --- a/source/slang/slang-ir-lower-com-methods.cpp +++ b/source/slang/slang-ir-lower-com-methods.cpp @@ -42,7 +42,7 @@ struct ComMethodLoweringContext : public InstPassBase innerMostCallee->getWitnessTable(), callee->getRequirementKey()); } - comCallees.Add(callee); + comCallees.add(callee); auto calleeType = as<IRFuncType>(callee->getDataType()); SLANG_ASSERT(calleeType); @@ -129,7 +129,7 @@ struct ComMethodLoweringContext : public InstPassBase for (auto entry : witnessTable->getEntries()) { IRInst* interfaceRequirement = nullptr; - if (!interfaceReqDict.TryGetValue(entry->getRequirementKey(), interfaceRequirement)) + if (!interfaceReqDict.tryGetValue(entry->getRequirementKey(), interfaceRequirement)) continue; auto implFunc = as<IRFunc>(entry->getSatisfyingVal()); if (!implFunc) continue; diff --git a/source/slang/slang-ir-lower-error-handling.cpp b/source/slang/slang-ir-lower-error-handling.cpp index 013f683c0..d598df9bb 100644 --- a/source/slang/slang-ir-lower-error-handling.cpp +++ b/source/slang/slang-ir-lower-error-handling.cpp @@ -18,11 +18,11 @@ struct ErrorHandlingLoweringContext void addToWorkList(IRInst* inst) { - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } void processFuncType(IRFuncType* funcType) @@ -182,7 +182,7 @@ struct ErrorHandlingLoweringContext IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-lower-existential.cpp b/source/slang/slang-ir-lower-existential.cpp index 9c31c0411..7bae856c6 100644 --- a/source/slang/slang-ir-lower-existential.cpp +++ b/source/slang/slang-ir-lower-existential.cpp @@ -226,7 +226,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-lower-generic-call.cpp b/source/slang/slang-ir-lower-generic-call.cpp index 0b24b2a9b..aaa419b2e 100644 --- a/source/slang/slang-ir-lower-generic-call.cpp +++ b/source/slang/slang-ir-lower-generic-call.cpp @@ -134,11 +134,11 @@ namespace Slang IRInst* requirementKey, IRInst* requirementVal) { - if (auto func = sharedContext->mapInterfaceRequirementKeyToDispatchMethods.TryGetValue(requirementKey)) + if (auto func = sharedContext->mapInterfaceRequirementKeyToDispatchMethods.tryGetValue(requirementKey)) return *func; auto dispatchFunc = _createInterfaceDispatchMethod(builder, interfaceType, requirementKey, requirementVal); - sharedContext->mapInterfaceRequirementKeyToDispatchMethods.AddIfNotExists( + sharedContext->mapInterfaceRequirementKeyToDispatchMethods.addIfNotExists( requirementKey, dispatchFunc); return dispatchFunc; } @@ -355,7 +355,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-lower-generic-function.cpp b/source/slang/slang-ir-lower-generic-function.cpp index 12be27f07..31ac7850a 100644 --- a/source/slang/slang-ir-lower-generic-function.cpp +++ b/source/slang/slang-ir-lower-generic-function.cpp @@ -20,7 +20,7 @@ namespace Slang IRInst* lowerGenericFunction(IRInst* genericValue) { IRInst* result = nullptr; - if (sharedContext->loweredGenericFunctions.TryGetValue(genericValue, result)) + if (sharedContext->loweredGenericFunctions.tryGetValue(genericValue, result)) return result; // Do not lower intrinsic functions. if (genericValue->findDecoration<IRTargetIntrinsicDecoration>()) @@ -95,11 +95,11 @@ namespace Slang default: { bool shouldDemote = false; - if (childrenToDemote.Contains(clonedChild->getFullType())) + if (childrenToDemote.contains(clonedChild->getFullType())) shouldDemote = true; for (UInt i = 0; i < clonedChild->getOperandCount(); i++) { - if (childrenToDemote.Contains(clonedChild->getOperand(i))) + if (childrenToDemote.contains(clonedChild->getOperand(i))) { shouldDemote = true; break; @@ -197,9 +197,9 @@ namespace Slang IRInterfaceType* maybeLowerInterfaceType(IRInterfaceType* interfaceType) { IRInterfaceType* loweredType = nullptr; - if (sharedContext->loweredInterfaceTypes.TryGetValue(interfaceType, loweredType)) + if (sharedContext->loweredInterfaceTypes.tryGetValue(interfaceType, loweredType)) return loweredType; - if (sharedContext->mapLoweredInterfaceToOriginal.ContainsKey(interfaceType)) + if (sharedContext->mapLoweredInterfaceToOriginal.containsKey(interfaceType)) return interfaceType; // Do not lower intrinsic interfaces. if (isBuiltin(interfaceType)) @@ -255,7 +255,7 @@ namespace Slang IRCloneEnv cloneEnv; cloneInstDecorationsAndChildren(&cloneEnv, sharedContext->module, interfaceType, loweredType); - sharedContext->loweredInterfaceTypes.Add(interfaceType, loweredType); + sharedContext->loweredInterfaceTypes.add(interfaceType, loweredType); sharedContext->mapLoweredInterfaceToOriginal[loweredType] = interfaceType; return loweredType; } @@ -371,9 +371,9 @@ namespace Slang { for (auto lowered : sharedContext->loweredInterfaceTypes) { - lowered.Key->replaceUsesWith(lowered.Value); + lowered.key->replaceUsesWith(lowered.value); } - sharedContext->mapInterfaceRequirementKeyValue.Clear(); + sharedContext->mapInterfaceRequirementKeyValue.clear(); } void processModule() @@ -385,7 +385,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir-lower-generic-type.cpp b/source/slang/slang-ir-lower-generic-type.cpp index 256978346..ae085145c 100644 --- a/source/slang/slang-ir-lower-generic-type.cpp +++ b/source/slang/slang-ir-lower-generic-type.cpp @@ -63,7 +63,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); inst = processInst(inst); @@ -72,7 +72,7 @@ namespace Slang sharedContext->addToWorkList(child); } } - sharedContext->mapInterfaceRequirementKeyValue.Clear(); + sharedContext->mapInterfaceRequirementKeyValue.clear(); } }; diff --git a/source/slang/slang-ir-lower-generics.cpp b/source/slang/slang-ir-lower-generics.cpp index bc6b9fff8..fc810e54e 100644 --- a/source/slang/slang-ir-lower-generics.cpp +++ b/source/slang/slang-ir-lower-generics.cpp @@ -28,7 +28,7 @@ namespace Slang for (auto rtti : sharedContext->mapTypeToRTTIObject) { IRBuilder builder(sharedContext->module); - builder.setInsertBefore(rtti.Value); + builder.setInsertBefore(rtti.value); IRUse* nextUse = nullptr; auto uint2Type = builder.getVectorType( builder.getUIntType(), builder.getIntValue(builder.getIntType(), 2)); @@ -36,7 +36,7 @@ namespace Slang builder.getIntValue(builder.getUIntType(), id), builder.getIntValue(builder.getUIntType(), 0)}; auto idOperand = builder.emitMakeVector(uint2Type, 2, uint2Args); - for (auto use = rtti.Value->firstUse; use; use = nextUse) + for (auto use = rtti.value->firstUse; use; use = nextUse) { nextUse = use->nextUse; if (use->getUser()->getOp() == kIROp_GetAddr) @@ -133,7 +133,7 @@ namespace Slang if (sink->getErrorCount() != 0) return; - sharedContext->mapInterfaceRequirementKeyValue.Clear(); + sharedContext->mapInterfaceRequirementKeyValue.clear(); specializeRTTIObjectReferences(sharedContext); @@ -152,7 +152,7 @@ namespace Slang if (inst->getOp() == kIROp_WitnessTable) { auto interfaceType = cast<IRWitnessTableType>(inst->getDataType())->getConformanceType(); - implementedInterfaces.Add(interfaceType); + implementedInterfaces.add(interfaceType); } } // Check if an interface type has any implementations. @@ -166,11 +166,11 @@ namespace Slang auto interfaceType = cast<IRWitnessTableType>(witnessTableType)->getConformanceType(); if (isComInterfaceType((IRType*)interfaceType)) return; - if (!implementedInterfaces.Contains(interfaceType)) + if (!implementedInterfaces.contains(interfaceType)) { context->sink->diagnose(interfaceType->sourceLoc, Diagnostics::noTypeConformancesFoundForInterface, interfaceType); // Add to set to prevent duplicate diagnostic messages. - implementedInterfaces.Add(interfaceType); + implementedInterfaces.add(interfaceType); } } }); diff --git a/source/slang/slang-ir-lower-optional-type.cpp b/source/slang/slang-ir-lower-optional-type.cpp index 4156fe9e1..9d6b98dc9 100644 --- a/source/slang/slang-ir-lower-optional-type.cpp +++ b/source/slang/slang-ir-lower-optional-type.cpp @@ -53,9 +53,9 @@ namespace Slang LoweredOptionalTypeInfo* getLoweredOptionalType(IRBuilder* builder, IRInst* type) { - if (auto loweredInfo = loweredOptionalTypes.TryGetValue(type)) + if (auto loweredInfo = loweredOptionalTypes.tryGetValue(type)) return loweredInfo->Ptr(); - if (auto loweredInfo = mapLoweredTypeToOptionalTypeInfo.TryGetValue(type)) + if (auto loweredInfo = mapLoweredTypeToOptionalTypeInfo.tryGetValue(type)) return loweredInfo->Ptr(); if (!type) @@ -102,11 +102,11 @@ namespace Slang return; } - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } void processMakeOptionalValue(IRMakeOptionalValue* inst) @@ -255,7 +255,7 @@ namespace Slang IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); @@ -268,7 +268,7 @@ namespace Slang // Replace all optional types with lowered struct types. for (auto kv : loweredOptionalTypes) { - kv.Key->replaceUsesWith(kv.Value->loweredType); + kv.key->replaceUsesWith(kv.value->loweredType); } } }; diff --git a/source/slang/slang-ir-lower-reinterpret.cpp b/source/slang/slang-ir-lower-reinterpret.cpp index 6fef9ee84..7575c8f12 100644 --- a/source/slang/slang-ir-lower-reinterpret.cpp +++ b/source/slang/slang-ir-lower-reinterpret.cpp @@ -16,10 +16,10 @@ struct ReinterpretLoweringContext void addToWorkList(IRInst* inst) { - if (workList.Contains(inst)) + if (workList.contains(inst)) return; - workList.Add(inst); + workList.add(inst); } void processInst(IRInst* inst) @@ -38,7 +38,7 @@ struct ReinterpretLoweringContext { addToWorkList(module->getModuleInst()); - while (workList.Count() != 0) + while (workList.getCount() != 0) { IRInst* inst = workList.getLast(); diff --git a/source/slang/slang-ir-lower-result-type.cpp b/source/slang/slang-ir-lower-result-type.cpp index 7b4712a18..c8d156cec 100644 --- a/source/slang/slang-ir-lower-result-type.cpp +++ b/source/slang/slang-ir-lower-result-type.cpp @@ -36,9 +36,9 @@ namespace Slang LoweredResultTypeInfo* getLoweredResultType(IRBuilder* builder, IRInst* type) { - if (auto loweredInfo = loweredResultTypes.TryGetValue(type)) + if (auto loweredInfo = loweredResultTypes.tryGetValue(type)) return loweredInfo->Ptr(); - if (auto loweredInfo = mapLoweredTypeToResultTypeInfo.TryGetValue(type)) + if (auto loweredInfo = mapLoweredTypeToResultTypeInfo.tryGetValue(type)) return loweredInfo->Ptr(); if (!type) @@ -86,11 +86,11 @@ namespace Slang return; } - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } IRInst* getSuccessErrorValue(IRType* type) @@ -276,7 +276,7 @@ namespace Slang IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); @@ -289,7 +289,7 @@ namespace Slang // Replace all result types with lowered struct types. for (auto kv : loweredResultTypes) { - kv.Key->replaceUsesWith(kv.Value->loweredType); + kv.key->replaceUsesWith(kv.value->loweredType); } } }; diff --git a/source/slang/slang-ir-lower-tuple-types.cpp b/source/slang/slang-ir-lower-tuple-types.cpp index bde7aea78..717c6a896 100644 --- a/source/slang/slang-ir-lower-tuple-types.cpp +++ b/source/slang/slang-ir-lower-tuple-types.cpp @@ -33,9 +33,9 @@ namespace Slang LoweredTupleInfo* getLoweredTupleType(IRBuilder* builder, IRInst* type) { - if (auto loweredInfo = loweredTuples.TryGetValue(type)) + if (auto loweredInfo = loweredTuples.tryGetValue(type)) return loweredInfo->Ptr(); - if (auto loweredInfo = mapLoweredStructToTupleInfo.TryGetValue(type)) + if (auto loweredInfo = mapLoweredStructToTupleInfo.tryGetValue(type)) return loweredInfo->Ptr(); if (!type) @@ -54,7 +54,7 @@ namespace Slang { auto elementType = maybeLowerTupleType(builder, (IRType*)(type->getOperand(i))); auto key = builder->createStructKey(); - fieldNameSb.Clear(); + fieldNameSb.clear(); fieldNameSb << "value" << i; builder->addNameHintDecoration(key, fieldNameSb.getUnownedSlice()); auto field = builder->createStructField(structType, key, (IRType*)elementType); @@ -74,11 +74,11 @@ namespace Slang return; } - if (workListSet.Contains(inst)) + if (workListSet.contains(inst)) return; workList.add(inst); - workListSet.Add(inst); + workListSet.add(inst); } void processMakeTuple(IRMakeTuple* inst) @@ -155,7 +155,7 @@ namespace Slang IRInst* inst = workList.getLast(); workList.removeLast(); - workListSet.Remove(inst); + workListSet.remove(inst); processInst(inst); @@ -168,7 +168,7 @@ namespace Slang // Replace all tuple types with lowered struct types. for (auto kv : loweredTuples) { - kv.Key->replaceUsesWith(kv.Value->structType); + kv.key->replaceUsesWith(kv.value->structType); } } }; diff --git a/source/slang/slang-ir-lower-witness-lookup.cpp b/source/slang/slang-ir-lower-witness-lookup.cpp index d3e96eb21..c1ee204b0 100644 --- a/source/slang/slang-ir-lower-witness-lookup.cpp +++ b/source/slang/slang-ir-lower-witness-lookup.cpp @@ -28,7 +28,7 @@ struct WitnessLookupLoweringContext { if (auto witnessDispatchFunc = as<IRDispatchFuncDecoration>(decor)) { - witnessDispatchFunctions.Add(key, witnessDispatchFunc->getFunc()); + witnessDispatchFunctions.add(key, witnessDispatchFunc->getFunc()); } } } @@ -54,7 +54,7 @@ struct WitnessLookupLoweringContext { if (!inst->getOperand(j)) continue; - if (processedSet.Add(inst->getOperand(j))) + if (processedSet.add(inst->getOperand(j))) workList.add(inst->getOperand(j)); } } @@ -119,7 +119,7 @@ struct WitnessLookupLoweringContext { IRInst* func = nullptr; auto requirementKey = cast<IRStructKey>(lookupInst->getRequirementKey()); - if (witnessDispatchFunctions.TryGetValue(requirementKey, func)) + if (witnessDispatchFunctions.tryGetValue(requirementKey, func)) { return func; } diff --git a/source/slang/slang-ir-peephole.cpp b/source/slang/slang-ir-peephole.cpp index 2244b480a..fa3e854f2 100644 --- a/source/slang/slang-ir-peephole.cpp +++ b/source/slang/slang-ir-peephole.cpp @@ -559,7 +559,7 @@ struct PeepholeContext : InstPassBase // If the key already exists, it means there is already a later update at this key. // We need to be careful not to override it with an earlier value. // AddIfNotExists will ensure this does not happen. - mapFieldKeyToVal.AddIfNotExists( + mapFieldKeyToVal.addIfNotExists( subStructKey, updateElement->getElementValue()); } @@ -572,7 +572,7 @@ struct PeepholeContext : InstPassBase for (auto field : structType->getFields()) { IRInst* arg = nullptr; - if (mapFieldKeyToVal.TryGetValue(field->getKey(), arg)) + if (mapFieldKeyToVal.tryGetValue(field->getKey(), arg)) { args.add(arg); } diff --git a/source/slang/slang-ir-propagate-func-properties.cpp b/source/slang/slang-ir-propagate-func-properties.cpp index 5b673e02a..7ce4bfc80 100644 --- a/source/slang/slang-ir-propagate-func-properties.cpp +++ b/source/slang/slang-ir-propagate-func-properties.cpp @@ -15,7 +15,7 @@ bool propagateFuncProperties(IRModule* module) auto addToWorkList = [&](IRFunc* f) { - if (workListSet.Add(f)) + if (workListSet.add(f)) workList.add(f); }; auto addCallersToWorkList = [&](IRFunc* f) @@ -49,7 +49,7 @@ bool propagateFuncProperties(IRModule* module) { bool changed = false; workList.clear(); - workListSet.Clear(); + workListSet.clear(); // Add side effect free functions and their transitive callers to work list. for (auto inst : module->getGlobalInsts()) diff --git a/source/slang/slang-ir-reachability.cpp b/source/slang/slang-ir-reachability.cpp index 9d36b9450..1a3cab386 100644 --- a/source/slang/slang-ir-reachability.cpp +++ b/source/slang/slang-ir-reachability.cpp @@ -8,7 +8,7 @@ namespace Slang bool ReachabilityContext::computeReachability(IRBlock* block1, IRBlock* block2) { workList.clear(); - reachableBlocks.Clear(); + reachableBlocks.clear(); workList.add(block1); for (Index i = 0; i < workList.getCount(); i++) { @@ -17,7 +17,7 @@ bool ReachabilityContext::computeReachability(IRBlock* block1, IRBlock* block2) { if (successor == block2) return true; - if (reachableBlocks.Add(successor)) + if (reachableBlocks.add(successor)) workList.add(successor); } } @@ -30,7 +30,7 @@ bool ReachabilityContext::isBlockReachable(IRBlock* from, IRBlock* to) pair.first = from; pair.second = to; bool result = false; - if (reachabilityResults.TryGetValue(pair, result)) + if (reachabilityResults.tryGetValue(pair, result)) return result; result = computeReachability(from, to); reachabilityResults[pair] = result; diff --git a/source/slang/slang-ir-redundancy-removal.cpp b/source/slang/slang-ir-redundancy-removal.cpp index 99cae22f0..b139d4194 100644 --- a/source/slang/slang-ir-redundancy-removal.cpp +++ b/source/slang/slang-ir-redundancy-removal.cpp @@ -253,12 +253,12 @@ bool tryRemoveRedundantStore(IRGlobalValueWithCode* func, IRStore* store) HashSet<IRInst*> knownAccessChain; for (auto accessChain = store->getPtr(); accessChain;) { - knownAccessChain.Add(accessChain); + knownAccessChain.add(accessChain); for (auto use = accessChain->firstUse; use; use = use->nextUse) { if (as<IRDecoration>(use->getUser())) continue; - if (knownAccessChain.Contains(use->getUser())) + if (knownAccessChain.contains(use->getUser())) continue; if (use->getUser()->getOp() == kIROp_Store && use == use->getUser()->getOperands()) @@ -331,7 +331,7 @@ bool tryRemoveRedundantStore(IRGlobalValueWithCode* func, IRStore* store) if (auto branch = as<IRUnconditionalBranch>(next)) { auto nextBlock = branch->getTargetBlock(); - if (visitedBlocks.Add(nextBlock)) + if (visitedBlocks.add(nextBlock)) { next = nextBlock->getFirstInst(); continue; diff --git a/source/slang/slang-ir-restructure-scoping.cpp b/source/slang/slang-ir-restructure-scoping.cpp index d7195a718..33935c36c 100644 --- a/source/slang/slang-ir-restructure-scoping.cpp +++ b/source/slang/slang-ir-restructure-scoping.cpp @@ -17,7 +17,7 @@ static SimpleRegion* getFirstRegionForBlock( IRBlock* block) { SimpleRegion* region = nullptr; - if( regionTree->mapBlockToRegion.TryGetValue(block, region) ) + if( regionTree->mapBlockToRegion.tryGetValue(block, region) ) { return region; } diff --git a/source/slang/slang-ir-restructure.cpp b/source/slang/slang-ir-restructure.cpp index b0f822def..9ba7a2b20 100644 --- a/source/slang/slang-ir-restructure.cpp +++ b/source/slang/slang-ir-restructure.cpp @@ -229,7 +229,7 @@ namespace Slang // pass that avoids duplicating blocks (by introducing new temporaries...) // SimpleRegion* nextSimpleRegionForSameBlock = nullptr; - ctx->regionTree->mapBlockToRegion.TryGetValue(block, nextSimpleRegionForSameBlock); + ctx->regionTree->mapBlockToRegion.tryGetValue(block, nextSimpleRegionForSameBlock); ctx->regionTree->mapBlockToRegion[block] = simpleRegion; *resultLink = simpleRegion; diff --git a/source/slang/slang-ir-sccp.cpp b/source/slang/slang-ir-sccp.cpp index 4e589c1fe..d253163c0 100644 --- a/source/slang/slang-ir-sccp.cpp +++ b/source/slang/slang-ir-sccp.cpp @@ -243,7 +243,7 @@ struct SCCPContext // Look up in the dictionary and just return the value we get from it. LatticeVal latticeVal; - if(mapInstToLatticeVal.TryGetValue(inst, latticeVal)) + if(mapInstToLatticeVal.tryGetValue(inst, latticeVal)) return latticeVal; // If we can't find the value from dictionary, we want to return None if this is a value @@ -973,12 +973,12 @@ struct SCCPContext bool isMarkedAsExecuted(IRBlock* block) { - return executedBlocks.Contains(block); + return executedBlocks.contains(block); } void markAsExecuted(IRBlock* block) { - executedBlocks.Add(block); + executedBlocks.add(block); } // The core of the algorithm is based on two work lists. diff --git a/source/slang/slang-ir-simplify-cfg.cpp b/source/slang/slang-ir-simplify-cfg.cpp index 4d5b6e21b..797e5c9ea 100644 --- a/source/slang/slang-ir-simplify-cfg.cpp +++ b/source/slang/slang-ir-simplify-cfg.cpp @@ -60,7 +60,7 @@ static bool isTrivialSingleIterationLoop( context.regionTree = generateRegionTreeForFunc(func, nullptr); SimpleRegion* targetBlockRegion = nullptr; - if (!context.regionTree->mapBlockToRegion.TryGetValue(targetBlock, targetBlockRegion)) + if (!context.regionTree->mapBlockToRegion.tryGetValue(targetBlock, targetBlockRegion)) return false; BreakableRegion* loopBreakableRegion = findBreakableRegion(targetBlockRegion); LoopRegion* loopRegion = as<LoopRegion>(loopBreakableRegion); @@ -73,13 +73,13 @@ static bool isTrivialSingleIterationLoop( if (context.domTree->dominates(loop->getBreakBlock(), block)) continue; SimpleRegion* region = nullptr; - if (!context.regionTree->mapBlockToRegion.TryGetValue(block, region)) + if (!context.regionTree->mapBlockToRegion.tryGetValue(block, region)) return false; for (auto branchTarget : block->getSuccessors()) { SimpleRegion* targetRegion = nullptr; - if (!context.regionTree->mapBlockToRegion.TryGetValue(branchTarget, targetRegion)) + if (!context.regionTree->mapBlockToRegion.tryGetValue(branchTarget, targetRegion)) return false; // If multi-level break out that skips over this loop exists, then this is not a trivial loop. if (targetRegion->isDescendentOf(loopRegion)) @@ -102,7 +102,7 @@ static bool doesLoopHasSideEffect(IRGlobalValueWithCode* func, IRLoop* loopInst) auto blocks = collectBlocksInLoop(func, loopInst); HashSet<IRBlock*> loopBlocks; for (auto b : blocks) - loopBlocks.Add(b); + loopBlocks.add(b); auto addressHasOutOfLoopUses = [&](IRInst* addr) { // The entire access chain of `addr` must have no uses outside the loop. @@ -113,7 +113,7 @@ static bool doesLoopHasSideEffect(IRGlobalValueWithCode* func, IRLoop* loopInst) return true; for (auto use = chainNode->firstUse; use; use = use->nextUse) { - if (!loopBlocks.Contains(as<IRBlock>(use->getUser()->getParent()))) + if (!loopBlocks.contains(as<IRBlock>(use->getUser()->getParent()))) return true; } switch (chainNode->getOp()) @@ -144,7 +144,7 @@ static bool doesLoopHasSideEffect(IRGlobalValueWithCode* func, IRLoop* loopInst) // Is this inst used anywhere outside the loop? If so the loop has side effect. for (auto use = inst->firstUse; use; use = use->nextUse) { - if (!loopBlocks.Contains(as<IRBlock>(use->getUser()->getParent()))) + if (!loopBlocks.contains(as<IRBlock>(use->getUser()->getParent()))) return true; } @@ -174,7 +174,7 @@ static bool doesLoopHasSideEffect(IRGlobalValueWithCode* func, IRLoop* loopInst) } else if (auto branch = as<IRUnconditionalBranch>(inst)) { - if (loopBlocks.Contains(branch->getTargetBlock())) + if (loopBlocks.contains(branch->getTargetBlock())) continue; // Branching out of the loop with some argument is considered // having a side effect. @@ -224,7 +224,7 @@ static bool removeDeadBlocks(IRGlobalValueWithCode* func) { for (auto succ : block->getSuccessors()) { - if (workListSet.Add(succ)) + if (workListSet.add(succ)) { nextWorkList.add(succ); } @@ -236,7 +236,7 @@ static bool removeDeadBlocks(IRGlobalValueWithCode* func) if (nextWorkList.getCount()) { workList = _Move(nextWorkList); - workListSet.Clear(); + workListSet.clear(); } else { @@ -462,7 +462,7 @@ static bool removeTrivialPhiParams(IRBlock* block) for (UInt i = 1; i < (UInt)args.getCount(); i++) for (UInt j = 0; j < i; j++) - args[i].sameAsParamSet.Add(j); + args[i].sameAsParamSet.add(j); for (auto pred : block->getPredecessors()) { @@ -484,7 +484,7 @@ static bool removeTrivialPhiParams(IRBlock* block) { if (termInst->getArg(i) != termInst->getArg(j)) { - args[i].sameAsParamSet.Remove(j); + args[i].sameAsParamSet.remove(j); } } } @@ -496,7 +496,7 @@ static bool removeTrivialPhiParams(IRBlock* block) { targetVal = args[i].knownValue; } - else if (args[i].sameAsParamSet.Count()) + else if (args[i].sameAsParamSet.getCount()) { auto targetParamId = *args[i].sameAsParamSet.begin(); targetVal = params[targetParamId]; @@ -620,7 +620,7 @@ static bool processFunc(IRGlobalValueWithCode* func) } for (auto successor : block->getSuccessors()) { - if (processedBlock.Add(successor)) + if (processedBlock.add(successor)) { workList.add(successor); } diff --git a/source/slang/slang-ir-simplify-for-emit.cpp b/source/slang/slang-ir-simplify-for-emit.cpp index a6f93f2f1..f040ef1ec 100644 --- a/source/slang/slang-ir-simplify-for-emit.cpp +++ b/source/slang/slang-ir-simplify-for-emit.cpp @@ -20,7 +20,7 @@ struct SimplifyForEmitContext : public InstPassBase void addToFollowUpWorkList(IRInst* inst) { - if (followUpWorkListSet.Add(inst)) + if (followUpWorkListSet.add(inst)) followUpWorkList.add(inst); } @@ -197,12 +197,12 @@ struct SimplifyForEmitContext : public InstPassBase for (auto use = var->firstUse; use; use = use->nextUse) if (use->getUser()->getParent() == var->getParent()) { - userInSameBlock.Add(use->getUser()); + userInSameBlock.add(use->getUser()); } IRInst* firstUser = nullptr; for (auto inst = var->getNextInst(); inst; inst = inst->getNextInst()) { - if (userInSameBlock.Contains(inst)) + if (userInSameBlock.contains(inst)) { firstUser = inst; break; @@ -250,7 +250,7 @@ struct SimplifyForEmitContext : public InstPassBase void eliminateCompositeConstruct(IRGlobalValueWithCode* func) { followUpWorkList.clear(); - followUpWorkListSet.Clear(); + followUpWorkListSet.clear(); for (auto block : func->getBlocks()) { @@ -273,7 +273,7 @@ struct SimplifyForEmitContext : public InstPassBase void deferAndDuplicateLoad(IRGlobalValueWithCode* func) { followUpWorkList.clear(); - followUpWorkListSet.Clear(); + followUpWorkListSet.clear(); for (auto block : func->getBlocks()) { @@ -294,7 +294,7 @@ struct SimplifyForEmitContext : public InstPassBase void deferVarDecl(IRGlobalValueWithCode* func) { followUpWorkList.clear(); - followUpWorkListSet.Clear(); + followUpWorkListSet.clear(); for (auto block : func->getBlocks()) { @@ -315,7 +315,7 @@ struct SimplifyForEmitContext : public InstPassBase void deferAndDuplicateElementExtract(IRGlobalValueWithCode* func) { followUpWorkList.clear(); - followUpWorkListSet.Clear(); + followUpWorkListSet.clear(); for (auto block = func->getLastBlock(); block; block = block->getPrevBlock()) { diff --git a/source/slang/slang-ir-specialize-dispatch.cpp b/source/slang/slang-ir-specialize-dispatch.cpp index 074aedb06..b7bab777a 100644 --- a/source/slang/slang-ir-specialize-dispatch.cpp +++ b/source/slang/slang-ir-specialize-dispatch.cpp @@ -191,7 +191,7 @@ bool _isWitnessTableTransitivelyVisible(IRInst* witness) { if (user->getParent()) { - if (workSet.Add(user->getParent())) + if (workSet.add(user->getParent())) { workList.add(user->getParent()); } @@ -262,7 +262,7 @@ void ensureWitnessTableSequentialIDs(SharedGenericsLoweringContext* sharedContex // Get a sequential ID for the witness table using the map from the Linkage. uint32_t seqID = 0; - if (!linkage->mapMangledNameToRTTIObjectIndex.TryGetValue( + if (!linkage->mapMangledNameToRTTIObjectIndex.tryGetValue( witnessTableMangledName, seqID)) { auto interfaceType = @@ -273,13 +273,13 @@ void ensureWitnessTableSequentialIDs(SharedGenericsLoweringContext* sharedContex "but a witness table associated with it has one."); auto interfaceName = interfaceLinkage->getMangledName(); auto idAllocator = - linkage->mapInterfaceMangledNameToSequentialIDCounters.TryGetValue( + linkage->mapInterfaceMangledNameToSequentialIDCounters.tryGetValue( interfaceName); if (!idAllocator) { linkage->mapInterfaceMangledNameToSequentialIDCounters[interfaceName] = 0; idAllocator = - linkage->mapInterfaceMangledNameToSequentialIDCounters.TryGetValue( + linkage->mapInterfaceMangledNameToSequentialIDCounters.tryGetValue( interfaceName); } seqID = *idAllocator; @@ -334,7 +334,7 @@ void specializeDispatchFunctions(SharedGenericsLoweringContext* sharedContext) // Generate specialized dispatch functions and fixup call sites. for (auto kv : sharedContext->mapInterfaceRequirementKeyToDispatchMethods) { - auto dispatchFunc = kv.Value; + auto dispatchFunc = kv.value; // Generate a specialized `switch` statement based dispatch func, // from the witness tables present in the module. diff --git a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp index 1a1186cda..cbc085da5 100644 --- a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp +++ b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp @@ -149,7 +149,7 @@ struct AssociatedTypeLookupSpecializationContext return; auto key = inst->getRequirementKey(); IRFunc* func = nullptr; - if (!sharedContext->mapInterfaceRequirementKeyToDispatchMethods.TryGetValue(key, func)) + if (!sharedContext->mapInterfaceRequirementKeyToDispatchMethods.tryGetValue(key, func)) { func = createWitnessTableLookupFunc(interfaceType, key); sharedContext->mapInterfaceRequirementKeyToDispatchMethods[key] = func; diff --git a/source/slang/slang-ir-specialize-function-call.cpp b/source/slang/slang-ir-specialize-function-call.cpp index a2ebbc0cf..b0ad58f8c 100644 --- a/source/slang/slang-ir-specialize-function-call.cpp +++ b/source/slang/slang-ir-specialize-function-call.cpp @@ -326,7 +326,7 @@ struct FunctionParameterSpecializationContext // that is suitable to this call site. // IRFunc* newFunc = nullptr; - if( !specializedFuncs.TryGetValue(callInfo.key, newFunc) ) + if( !specializedFuncs.tryGetValue(callInfo.key, newFunc) ) { // If we didn't find a pre-existing specialized // function, then we will go ahead and create one. @@ -344,7 +344,7 @@ struct FunctionParameterSpecializationContext // function and the information we gathered. // newFunc = generateSpecializedFunc(oldFunc, funcInfo); - specializedFuncs.Add(callInfo.key, newFunc); + specializedFuncs.add(callInfo.key, newFunc); } // Once we've other found or generated a specialized function @@ -755,7 +755,7 @@ struct FunctionParameterSpecializationContext { UInt paramIndex = paramCounter++; auto newVal = funcInfo.replacementsForOldParameters[paramIndex]; - cloneEnv.mapOldValToNew.Add(oldParam, newVal); + cloneEnv.mapOldValToNew.add(oldParam, newVal); } // Next we will create the skeleton of the new diff --git a/source/slang/slang-ir-specialize.cpp b/source/slang/slang-ir-specialize.cpp index eb3677653..d74c8fb37 100644 --- a/source/slang/slang-ir-specialize.cpp +++ b/source/slang/slang-ir-specialize.cpp @@ -109,7 +109,7 @@ struct SpecializationContext } } - return fullySpecializedInsts.Contains(inst); + return fullySpecializedInsts.contains(inst); } // When an instruction isn't fully specialized, but its operands *are* @@ -162,9 +162,9 @@ struct SpecializationContext } #endif - if (workList.Add(inst)) + if (workList.add(inst)) { - cleanInsts.Remove(inst); + cleanInsts.remove(inst); addUsersToWorkList(inst); } @@ -192,9 +192,9 @@ struct SpecializationContext void markInstAsFullySpecialized( IRInst* inst) { - if(fullySpecializedInsts.Contains(inst)) + if(fullySpecializedInsts.contains(inst)) return; - fullySpecializedInsts.Add(inst); + fullySpecializedInsts.add(inst); // If we know that an instruction is fully specialized, // then we should start to consider its uses and children @@ -257,7 +257,7 @@ struct SpecializationContext // If one is found, our work is done. // IRInst* specializedVal = nullptr; - if(genericSpecializations.TryGetValue(key, specializedVal)) + if(genericSpecializations.tryGetValue(key, specializedVal)) return specializedVal; } @@ -284,7 +284,7 @@ struct SpecializationContext // specializations so that we don't instantiate // this generic again for the same arguments. // - genericSpecializations.Add(key, specializedVal); + genericSpecializations.add(key, specializedVal); return specializedVal; } @@ -797,16 +797,16 @@ struct SpecializationContext builder.setInsertInto(dictInst); for (auto kv : dict) { - if (!kv.Value->parent) + if (!kv.value->parent) continue; - for (auto keyVal : kv.Key.vals) + for (auto keyVal : kv.key.vals) { if (!keyVal->parent) goto next; } { List<IRInst*> args; - args.add(kv.Value); - args.addRange(kv.Key.vals); + args.add(kv.value); + args.addRange(kv.key.vals); builder.emitIntrinsicInst(nullptr, kIROp_SpecializationDictionaryItem, args.getCount(), args.getBuffer()); } next:; @@ -874,17 +874,17 @@ struct SpecializationContext bool iterChanged = false; addToWorkList(module->getModuleInst()); - while (workList.Count() != 0) + while (workList.getCount() != 0) { // We will then iterate until our work list goes dry. // - while (workList.Count() != 0) + while (workList.getCount() != 0) { IRInst* inst = workList.getLast(); workList.removeLast(); - cleanInsts.Add(inst); + cleanInsts.add(inst); // For each instruction we process, we want to perform // a few steps. @@ -957,7 +957,7 @@ struct SpecializationContext void addDirtyInstsToWorkListRec(IRInst* inst) { - if( !cleanInsts.Contains(inst) ) + if( !cleanInsts.contains(inst) ) { addToWorkList(inst); } @@ -1060,11 +1060,11 @@ struct SpecializationContext auto newWrapExistential = builder.emitWrapExistential( resultType, newCall, slotOperandCount, slotOperands.getBuffer()); inst->replaceUsesWith(newWrapExistential); - workList.Remove(inst); + workList.remove(inst); inst->removeAndDeallocate(); addUsersToWorkList(newWrapExistential); - workList.Remove(wrapExistential); + workList.remove(wrapExistential); SLANG_ASSERT(!wrapExistential->hasUses()); wrapExistential->removeAndDeallocate(); return true; @@ -1211,13 +1211,13 @@ struct SpecializationContext // existing specialization of the callee that we can use. // IRFunc* specializedCallee = nullptr; - if( !existentialSpecializedFuncs.TryGetValue(key, specializedCallee) ) + if( !existentialSpecializedFuncs.tryGetValue(key, specializedCallee) ) { // If we didn't find a specialized callee already made, then we // will go ahead and create one, and then register it in our cache. // specializedCallee = createExistentialSpecializedFunc(inst, calleeFunc); - existentialSpecializedFuncs.Add(key, specializedCallee); + existentialSpecializedFuncs.add(key, specializedCallee); } // At this point we have found or generated a specialized version @@ -1322,7 +1322,7 @@ struct SpecializationContext List<IRInst*> localWorkList; HashSet<IRInst*> processedInsts; localWorkList.add(inst); - processedInsts.Add(inst); + processedInsts.add(inst); while (localWorkList.getCount() != 0) { @@ -1345,7 +1345,7 @@ struct SpecializationContext for (UInt i = 0; i < curInst->getOperandCount(); ++i) { auto operand = curInst->getOperand(i); - if (processedInsts.Add(operand)) + if (processedInsts.add(operand)) { localWorkList.add(operand); } @@ -1528,7 +1528,7 @@ struct SpecializationContext // Whatever replacement value was constructed, we need to // register it as the replacement for the original parameter. // - cloneEnv.mapOldValToNew.Add(oldParam, replacementVal); + cloneEnv.mapOldValToNew.add(oldParam, replacementVal); } // Next we will create the skeleton of the new @@ -1553,7 +1553,7 @@ struct SpecializationContext // "fully specialized" by the rules used for doing // generic specialization elsewhere in this pass. // - fullySpecializedInsts.Add(newFuncType); + fullySpecializedInsts.add(newFuncType); // The above steps have accomplished the "first phase" // of cloning the function (since `IRFunc`s have no @@ -2223,7 +2223,7 @@ struct SpecializationContext IRStructType* newStructType = nullptr; addUsersToWorkList(type); - if( !existentialSpecializedStructs.TryGetValue(key, newStructType) ) + if( !existentialSpecializedStructs.tryGetValue(key, newStructType) ) { builder.setInsertBefore(baseStructType); newStructType = builder.createStructType(); @@ -2251,7 +2251,7 @@ struct SpecializationContext builder.createStructField(newStructType, oldField->getKey(), newFieldType); } - existentialSpecializedStructs.Add(key, newStructType); + existentialSpecializedStructs.add(key, newStructType); } type->replaceUsesWith(newStructType); @@ -2405,7 +2405,7 @@ IRInst* specializeGenericImpl( IRInst* arg = specializeInst->getArg(argIndex); - env.mapOldValToNew.Add(param, arg); + env.mapOldValToNew.add(param, arg); } // We will set up an IR builder for insertion diff --git a/source/slang/slang-ir-spirv-legalize.cpp b/source/slang/slang-ir-spirv-legalize.cpp index f3971743f..b0199a760 100644 --- a/source/slang/slang-ir-spirv-legalize.cpp +++ b/source/slang/slang-ir-spirv-legalize.cpp @@ -28,7 +28,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase void addToWorkList(IRInst* inst) { - if (workList.Add(inst)) + if (workList.add(inst)) { addUsersToWorkList(inst); } @@ -261,7 +261,7 @@ struct SPIRVLegalizationContext : public SourceEmitterBase void processModule() { addToWorkList(m_module->getModuleInst()); - while (workList.Count() != 0) + while (workList.getCount() != 0) { IRInst* inst = workList.getLast(); workList.removeLast(); diff --git a/source/slang/slang-ir-spirv-legalize.h b/source/slang/slang-ir-spirv-legalize.h index fbde7b780..5d5a7d3ab 100644 --- a/source/slang/slang-ir-spirv-legalize.h +++ b/source/slang/slang-ir-spirv-legalize.h @@ -25,7 +25,7 @@ struct SPIRVEmitSharedContext SpvSnippet* getParsedSpvSnippet(IRTargetIntrinsicDecoration* intrinsic) { RefPtr<SpvSnippet> snippet; - if (m_parsedSpvSnippets.TryGetValue(intrinsic, snippet)) + if (m_parsedSpvSnippets.tryGetValue(intrinsic, snippet)) { return snippet.Ptr(); } diff --git a/source/slang/slang-ir-spirv-snippet.cpp b/source/slang/slang-ir-spirv-snippet.cpp index 120c0accb..ee40456a7 100644 --- a/source/slang/slang-ir-spirv-snippet.cpp +++ b/source/slang/slang-ir-spirv-snippet.cpp @@ -132,7 +132,7 @@ RefPtr<SpvSnippet> SpvSnippet::parse(UnownedStringSlice definition) tokenReader.ReadToken(); operand.type = SpvSnippet::ASMOperandType::InstReference; auto refName = tokenReader.ReadToken().Content; - if (!mapInstNameToIndex.TryGetValue(refName, operand.content)) + if (!mapInstNameToIndex.tryGetValue(refName, operand.content)) { SLANG_ASSERT(!"Invalid SPV ASM: referenced inst is not defined."); } diff --git a/source/slang/slang-ir-ssa-register-allocate.cpp b/source/slang/slang-ir-ssa-register-allocate.cpp index 32ca38771..07eec0c2b 100644 --- a/source/slang/slang-ir-ssa-register-allocate.cpp +++ b/source/slang/slang-ir-ssa-register-allocate.cpp @@ -15,12 +15,12 @@ struct RegisterAllocateContext OrderedDictionary<IRType*, List<RefPtr<RegisterInfo>>> mapTypeToRegisterList; List<RefPtr<RegisterInfo>>& getRegisterListForType(IRType* type) { - if (auto list = mapTypeToRegisterList.TryGetValue(type)) + if (auto list = mapTypeToRegisterList.tryGetValue(type)) { return *list; } mapTypeToRegisterList[type] = List<RefPtr<RegisterInfo>>(); - return mapTypeToRegisterList[type].GetValue(); + return mapTypeToRegisterList[type].getValue(); } void assignInstToNewRegister(List<RefPtr<RegisterInfo>>& regList, IRInst* inst) @@ -104,7 +104,7 @@ struct RegisterAllocateContext RegisterAllocationResult allocateRegisters(IRGlobalValueWithCode* func, RefPtr<IRDominatorTree>& inOutDom) { ReachabilityContext reachabilityContext; - mapTypeToRegisterList.Clear(); + mapTypeToRegisterList.clear(); auto dom = computeDominatorTree(func); inOutDom = dom; @@ -141,7 +141,7 @@ struct RegisterAllocateContext // Pop dominatingInst stack to correct location. for (Index i = item.dominatingInstCount; i < dominatingInsts.getCount(); i++) - dominatingInstSet.Remove(dominatingInsts[i]); + dominatingInstSet.remove(dominatingInsts[i]); dominatingInsts.setCount(item.dominatingInstCount); for (auto inst : item.block->getChildren()) @@ -164,7 +164,7 @@ struct RegisterAllocateContext // If `existingInst` does not dominate `inst`, it // can't be alive here and during the entire life-time of the `inst`. // This means that `inst` and `existingInst` won't interfere. - if (!dominatingInstSet.Contains(existingInst)) + if (!dominatingInstSet.contains(existingInst)) continue; // If `existingInst` does dominate `inst`, we need to check all @@ -203,7 +203,7 @@ struct RegisterAllocateContext allocatedReg->insts.add(inst); } dominatingInsts.add(inst); - dominatingInstSet.Add(inst); + dominatingInstSet.add(inst); } // Recursively visit idom children. @@ -217,7 +217,7 @@ struct RegisterAllocateContext result.mapTypeToRegisterList = _Move(mapTypeToRegisterList); for (auto& regList : result.mapTypeToRegisterList) { - for (auto reg : regList.Value) + for (auto reg : regList.value) { for (auto inst : reg->insts) { diff --git a/source/slang/slang-ir-ssa.cpp b/source/slang/slang-ir-ssa.cpp index 9b50b9c30..e62952556 100644 --- a/source/slang/slang-ir-ssa.cpp +++ b/source/slang/slang-ir-ssa.cpp @@ -96,7 +96,7 @@ struct ConstructSSAContext PhiInfo* getPhiInfo(IRParam* phi) { - if(auto found = phiInfos.TryGetValue(phi)) + if(auto found = phiInfos.tryGetValue(phi)) return *found; return nullptr; } @@ -409,7 +409,7 @@ PhiInfo* addPhi( cloneRelevantDecorations(var, phi); RefPtr<PhiInfo> phiInfo = new PhiInfo(); - context->phiInfos.Add(phi, phiInfo); + context->phiInfos.add(phi, phiInfo); phiInfo->phi = phi; phiInfo->var = var; @@ -546,7 +546,7 @@ IRInst* addPhiOperands( // SLANG_RELEASE_ASSERT(predecessorCount <= 1 || predBlock->getSuccessors().getCount() == 1); - auto predInfo = *context->blockInfos.TryGetValue(predBlock); + auto predInfo = *context->blockInfos.tryGetValue(predBlock); auto phiOperand = readVar(context, predInfo, var); SLANG_ASSERT(phiOperand != nullptr); @@ -590,7 +590,7 @@ void maybeSealBlock( // have been filled. for (auto pp : blockInfo->block->getPredecessors()) { - auto predInfo = *context->blockInfos.TryGetValue(pp); + auto predInfo = *context->blockInfos.tryGetValue(pp); if (!predInfo->isFilled) return; } @@ -635,7 +635,7 @@ IRInst* maybeGetPhiReplacement( // The value is a parameter, but is it a phi? IRParam* maybePhi = (IRParam*) val; RefPtr<PhiInfo> phiInfo = nullptr; - if(!context->phiInfos.TryGetValue(maybePhi, phiInfo)) + if(!context->phiInfos.tryGetValue(maybePhi, phiInfo)) break; // Okay, this is indeed a phi we are adding, but @@ -714,7 +714,7 @@ IRInst* readVarRec( // so there is no need to insert a phi. Instead, we // just perform the lookup step recursively in // the predecessor. - auto predInfo = *context->blockInfos.TryGetValue(firstPred); + auto predInfo = *context->blockInfos.tryGetValue(firstPred); val = readVar(context, predInfo, var); } else @@ -770,7 +770,7 @@ IRInst* readVar( // store in the same block, so we can use // that local value. IRInst* val = nullptr; - if (blockInfo->valueForVar.TryGetValue(var, val)) + if (blockInfo->valueForVar.tryGetValue(var, val)) { // Hooray, we found a value to use, and we // can proceed without too many complications. @@ -922,7 +922,7 @@ void processBlock( // of its successor(s) for (auto ss : block->getSuccessors()) { - auto successorInfo = *context->blockInfos.TryGetValue(ss); + auto successorInfo = *context->blockInfos.tryGetValue(ss); maybeSealBlock(context, successorInfo); } } @@ -1091,7 +1091,7 @@ bool constructSSA(ConstructSSAContext* context) blockInfo->builder = IRBuilder(context->module); blockInfo->builder.setInsertBefore(bb->getLastInst()); - context->blockInfos.Add(bb, blockInfo); + context->blockInfos.add(bb, blockInfo); } for(auto bb : globalVal->getBlocks()) @@ -1099,7 +1099,7 @@ bool constructSSA(ConstructSSAContext* context) for(auto bb : globalVal->getBlocks()) { - auto blockInfo = * context->blockInfos.TryGetValue(bb); + auto blockInfo = * context->blockInfos.tryGetValue(bb); processBlock(context, bb, blockInfo); } @@ -1108,7 +1108,7 @@ bool constructSSA(ConstructSSAContext* context) // pass them in. for(auto bb : globalVal->getBlocks()) { - auto blockInfo = *context->blockInfos.TryGetValue(bb); + auto blockInfo = *context->blockInfos.tryGetValue(bb); for (auto phiInfo : blockInfo->phis) { @@ -1125,7 +1125,7 @@ bool constructSSA(ConstructSSAContext* context) for (auto pp : bb->getPredecessors()) { UInt predIndex = predCounter++; - auto predInfo = *context->blockInfos.TryGetValue(pp); + auto predInfo = *context->blockInfos.tryGetValue(pp); IRInst* operandVal = phiInfo->operands[predIndex].get(); @@ -1140,7 +1140,7 @@ bool constructSSA(ConstructSSAContext* context) // which have been stored into the `SSABlockInfo::successorArgs` field. for(auto bb : globalVal->getBlocks()) { - auto blockInfo = * context->blockInfos.TryGetValue(bb); + auto blockInfo = * context->blockInfos.tryGetValue(bb); // Sanity check: all blocks should be filled and sealed. SLANG_ASSERT(blockInfo->isSealed); diff --git a/source/slang/slang-ir-synthesize-active-mask.cpp b/source/slang/slang-ir-synthesize-active-mask.cpp index 1237a48c2..75246d553 100644 --- a/source/slang/slang-ir-synthesize-active-mask.cpp +++ b/source/slang/slang-ir-synthesize-active-mask.cpp @@ -150,11 +150,11 @@ struct SynthesizeActiveMaskForModuleContext // void markFuncUsingActiveMask(IRFunc* func) { - if(m_funcsUsingActiveMaskSet.Contains(func)) + if(m_funcsUsingActiveMaskSet.contains(func)) return; m_funcsUsingActiveMask.add(func); - m_funcsUsingActiveMaskSet.Add(func); + m_funcsUsingActiveMaskSet.add(func); } // The easiest way to know that a function uses the active @@ -459,7 +459,7 @@ struct SynthesizeActiveMaskForFunctionContext // active mask, or else that would imply nothing else in the function // did, and we shouldn't be processing this function at all. // - SLANG_ASSERT(m_blocksNeedingActiveMask.Contains(funcEntryBlock)); + SLANG_ASSERT(m_blocksNeedingActiveMask.contains(funcEntryBlock)); // Our basic approach will be to associate an `IRInst*` that represents // the active mask value to use with each basic block of the function. @@ -610,7 +610,7 @@ struct SynthesizeActiveMaskForFunctionContext // bool doesBlockNeedActiveMask(IRBlock* block) { - return m_blocksNeedingActiveMask.Contains(block); + return m_blocksNeedingActiveMask.contains(block); } void markBlocksNeedingActiveMask() @@ -633,7 +633,7 @@ struct SynthesizeActiveMaskForFunctionContext { if( inst->getOp() == kIROp_WaveGetActiveMask ) { - m_blocksNeedingActiveMask.Add(block); + m_blocksNeedingActiveMask.add(block); break; } } @@ -665,12 +665,12 @@ struct SynthesizeActiveMaskForFunctionContext // for(auto block = m_func->getLastBlock(); block; block = block->getPrevBlock()) { - if(m_blocksNeedingActiveMask.Contains(block)) + if(m_blocksNeedingActiveMask.contains(block)) continue; for( auto successor : block->getSuccessors() ) { - if( !m_blocksNeedingActiveMask.Contains(successor) ) + if( !m_blocksNeedingActiveMask.contains(successor) ) continue; // If we get here then `block` has *not* been marked @@ -678,7 +678,7 @@ struct SynthesizeActiveMaskForFunctionContext // `successor` which *has* been marked, so we need // to mark `block` and keep looking for changes. // - m_blocksNeedingActiveMask.Add(block); + m_blocksNeedingActiveMask.add(block); change = true; break; } @@ -754,7 +754,7 @@ struct SynthesizeActiveMaskForFunctionContext // Once we've computed the mask value to start with, we add it to // our tracking structure so we can remember which value to use. // - m_activeMaskForBlock.Add(funcEntryBlock, initialActiveMask); + m_activeMaskForBlock.add(funcEntryBlock, initialActiveMask); } } @@ -827,7 +827,7 @@ struct SynthesizeActiveMaskForFunctionContext auto activeMaskParam = builder.emitParam(m_maskType); - m_activeMaskForBlock.Add(block, activeMaskParam); + m_activeMaskForBlock.add(block, activeMaskParam); } // The remainder of the work in this pass is going to be based @@ -971,7 +971,7 @@ struct SynthesizeActiveMaskForFunctionContext // we run this code. // IRInst* activeMaskOnFuncEntry = nullptr; - m_activeMaskForBlock.TryGetValue(funcEntryBlock, activeMaskOnFuncEntry); + m_activeMaskForBlock.tryGetValue(funcEntryBlock, activeMaskOnFuncEntry); SLANG_ASSERT(activeMaskOnFuncEntry); // The root region of our tree of regions will @@ -1669,7 +1669,7 @@ struct SynthesizeActiveMaskForFunctionContext // active mask on input to `toBlock` is the `fromActiveMask` being // provided as part of the conditional branch. // - m_activeMaskForBlock.Add(toBlock, fromActiveMask); + m_activeMaskForBlock.add(toBlock, fromActiveMask); } // Unconditional edges are more complicated than conditional @@ -1898,7 +1898,7 @@ struct SynthesizeActiveMaskForFunctionContext // block, and we can just bind the comptue value // directly. // - m_activeMaskForBlock.Add(toBlock, toActiveMask); + m_activeMaskForBlock.add(toBlock, toActiveMask); } } @@ -2045,7 +2045,7 @@ struct SynthesizeActiveMaskForFunctionContext // to each of its successors. // IRInst* activeMaskOnRegionEntry = nullptr; - if( !m_activeMaskForBlock.TryGetValue(regionEntry, activeMaskOnRegionEntry) ) + if( !m_activeMaskForBlock.tryGetValue(regionEntry, activeMaskOnRegionEntry) ) { SLANG_UNEXPECTED("no active mask registered for block"); } diff --git a/source/slang/slang-ir-union.cpp b/source/slang/slang-ir-union.cpp index 3d0ed1fe8..caa646fb0 100644 --- a/source/slang/slang-ir-union.cpp +++ b/source/slang/slang-ir-union.cpp @@ -611,7 +611,7 @@ struct DesugarUnionTypesContext // { TaggedUnionInfo* info = nullptr; - if(mapIRTypeToTaggedUnionInfo.TryGetValue(type, info)) + if(mapIRTypeToTaggedUnionInfo.tryGetValue(type, info)) return info; } @@ -621,7 +621,7 @@ struct DesugarUnionTypesContext // so that we can replacement them later. // auto info = createTaggedUnionInfo(type); - mapIRTypeToTaggedUnionInfo.Add(type, info.Ptr()); + mapIRTypeToTaggedUnionInfo.add(type, info.Ptr()); taggedUnionInfos.add(info); return info; diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index 9348dfe8a..07da03744 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -791,7 +791,7 @@ struct GenericChildrenMigrationContextImpl inst = inst->getNextInst()) { IRInstKey key = { inst }; - deduplicateContext.deduplicateMap.AddIfNotExists(key, inst); + deduplicateContext.deduplicateMap.addIfNotExists(key, inst); } } } diff --git a/source/slang/slang-ir-util.h b/source/slang/slang-ir-util.h index 9405771b1..076ae8fd0 100644 --- a/source/slang/slang-ir-util.h +++ b/source/slang/slang-ir-util.h @@ -45,7 +45,7 @@ struct DeduplicateContext if (!shouldDeduplicate(value)) return value; IRInstKey key = { value }; - if (auto newValue = deduplicateMap.TryGetValue(key)) + if (auto newValue = deduplicateMap.tryGetValue(key)) return *newValue; for (UInt i = 0; i < value->getOperandCount(); i++) { @@ -56,7 +56,7 @@ struct DeduplicateContext auto deduplicatedType = (IRType*)deduplicate(value->getFullType(), shouldDeduplicate); if (deduplicatedType != value->getFullType()) value->setFullType(deduplicatedType); - if (auto newValue = deduplicateMap.TryGetValue(key)) + if (auto newValue = deduplicateMap.tryGetValue(key)) return *newValue; deduplicateMap[key] = value; return value; diff --git a/source/slang/slang-ir-validate.cpp b/source/slang/slang-ir-validate.cpp index 3c720e929..18229c9b6 100644 --- a/source/slang/slang-ir-validate.cpp +++ b/source/slang/slang-ir-validate.cpp @@ -155,7 +155,7 @@ namespace Slang // in order. if (context) { - validate(context, context->seenInsts.Contains(operandValue), inst, "def must come before use in same block"); + validate(context, context->seenInsts.contains(operandValue), inst, "def must come before use in same block"); } return; } @@ -281,12 +281,12 @@ namespace Slang { HashSet<IRBlock*> blocks; for (auto block : code->getBlocks()) - blocks.Add(block); + blocks.add(block); auto validateBranchTarget = [&](IRInst* inst, IRBlock* target) { validate( context, - blocks.Contains(target), + blocks.contains(target), inst, "branch inst must have a valid target block that is defined within the same " "scope."); @@ -327,7 +327,7 @@ namespace Slang { // Validate that any operands of the instruction are used appropriately validateIRInstOperands(context, inst); - context->seenInsts.Add(inst); + context->seenInsts.add(inst); // If `inst` is itself a parent instruction, then we need to recursively // validate its children. diff --git a/source/slang/slang-ir-witness-table-wrapper.cpp b/source/slang/slang-ir-witness-table-wrapper.cpp index d8bfdc560..68fdf5b60 100644 --- a/source/slang/slang-ir-witness-table-wrapper.cpp +++ b/source/slang/slang-ir-witness-table-wrapper.cpp @@ -226,7 +226,7 @@ namespace Slang IRInst* inst = sharedContext->workList.getLast(); sharedContext->workList.removeLast(); - sharedContext->workListSet.Remove(inst); + sharedContext->workListSet.remove(inst); processInst(inst); diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 558fd7796..185f31b30 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -1238,7 +1238,7 @@ namespace Slang auto user = use->getUser(); if (user->getModule()) { - user->getModule()->getDeduplicationContext()->getInstReplacementMap().TryGetValue(newValue, newValue); + user->getModule()->getDeduplicationContext()->getInstReplacementMap().tryGetValue(newValue, newValue); } if (!getIROpInfo(user->getOp()).isHoistable()) @@ -1256,7 +1256,7 @@ namespace Slang use->init(user, newValue); IRInst* existingVal = nullptr; - if (builder->getGlobalValueNumberingMap().TryGetValue(IRInstKey{ user }, existingVal)) + if (builder->getGlobalValueNumberingMap().tryGetValue(IRInstKey{ user }, existingVal)) { user->replaceUsesWith(existingVal); return existingVal; @@ -1710,7 +1710,7 @@ namespace Slang Int const* listArgCounts, IRInst* const* const* listArgs) { - m_dedupContext->getInstReplacementMap().TryGetValue((IRInst*)(type), *(IRInst**)&type); + m_dedupContext->getInstReplacementMap().tryGetValue((IRInst*)(type), *(IRInst**)&type); if (getIROpInfo(op).flags & kIROpFlag_Hoistable) { @@ -1744,7 +1744,7 @@ namespace Slang if (fixedArgs) { auto arg = fixedArgs[aa]; - m_dedupContext->getInstReplacementMap().TryGetValue(arg, arg); + m_dedupContext->getInstReplacementMap().tryGetValue(arg, arg); operand->init(inst, arg); } else @@ -1762,7 +1762,7 @@ namespace Slang if (listArgs[ii]) { auto arg = listArgs[ii][jj]; - m_dedupContext->getInstReplacementMap().TryGetValue(arg, arg); + m_dedupContext->getInstReplacementMap().tryGetValue(arg, arg); operand->init(inst, arg); } else @@ -2157,7 +2157,7 @@ namespace Slang key.inst = &keyInst; IRConstant* irValue = nullptr; - if (m_dedupContext->getConstantMap().TryGetValue(key, irValue)) + if (m_dedupContext->getConstantMap().tryGetValue(key, irValue)) { // We found a match, so just use that. return irValue; @@ -2224,7 +2224,7 @@ namespace Slang } key.inst = irValue; - m_dedupContext->getConstantMap().Add(key, irValue); + m_dedupContext->getConstantMap().add(key, irValue); addHoistableInst(this, irValue); @@ -2459,7 +2459,7 @@ namespace Slang for (Int ii = 0; ii < fixedArgCount; ++ii) { auto arg = canonicalizedOperands[ii]; - m_dedupContext->getInstReplacementMap().TryGetValue(arg, arg); + m_dedupContext->getInstReplacementMap().tryGetValue(arg, arg); operand->usedValue = arg; operand++; } @@ -2469,7 +2469,7 @@ namespace Slang for (UInt jj = 0; jj < listOperandCount; ++jj) { auto arg = listArgs[ii][jj]; - m_dedupContext->getInstReplacementMap().TryGetValue(arg, arg); + m_dedupContext->getInstReplacementMap().tryGetValue(arg, arg); operand->usedValue = arg; operand++; } @@ -2481,7 +2481,7 @@ namespace Slang IRInstKey key = { inst }; // Ideally we would add if not found, else return if was found instead of testing & then adding. - IRInst** found = m_dedupContext->getGlobalValueNumberingMap().TryGetValueOrAdd(key, inst); + IRInst** found = m_dedupContext->getGlobalValueNumberingMap().tryGetValueOrAdd(key, inst); SLANG_ASSERT(endCursor == memoryArena.getCursor()); // If it's found, just return, and throw away the instruction if (found) @@ -5883,7 +5883,7 @@ namespace Slang String key = sb.ProduceString(); UInt count = 0; - context->uniqueNameCounters.TryGetValue(key, count); + context->uniqueNameCounters.tryGetValue(key, count); context->uniqueNameCounters[key] = count+1; @@ -5907,11 +5907,11 @@ namespace Slang IRInst* value) { String name; - if (context->mapValueToName.TryGetValue(value, name)) + if (context->mapValueToName.tryGetValue(value, name)) return name; name = createName(context, value); - context->mapValueToName.Add(value, name); + context->mapValueToName.add(value, name); return name; } @@ -6773,7 +6773,7 @@ namespace Slang auto addToWorkList = [&](IRInst* src, IRInst* target) { - if (workListSet.Add(src)) + if (workListSet.add(src)) { WorkItem item; item.thisInst = src; @@ -6841,7 +6841,7 @@ namespace Slang // Is the updated inst already exists in the global numbering map? // If so, we need to continue work on replacing the updated inst with the existing value. IRInst* existingVal = nullptr; - if (dedupContext->getGlobalValueNumberingMap().TryGetValue(IRInstKey{ user }, existingVal)) + if (dedupContext->getGlobalValueNumberingMap().tryGetValue(IRInstKey{ user }, existingVal)) { addToWorkList(user, existingVal); } @@ -7075,9 +7075,9 @@ namespace Slang } else if (auto constInst = as<IRConstant>(this)) { - module->getDeduplicationContext()->getConstantMap().Remove(IRConstantKey{ constInst }); + module->getDeduplicationContext()->getConstantMap().remove(IRConstantKey{ constInst }); } - module->getDeduplicationContext()->getInstReplacementMap().Remove(this); + module->getDeduplicationContext()->getInstReplacementMap().remove(this); } removeArguments(); removeAndDeallocateAllDecorationsAndChildren(); diff --git a/source/slang/slang-ir.h b/source/slang/slang-ir.h index a53fe0092..6d42e9909 100644 --- a/source/slang/slang-ir.h +++ b/source/slang/slang-ir.h @@ -1986,18 +1986,18 @@ public: void _addGlobalNumberingEntry(IRInst* inst) { - m_globalValueNumberingMap.Add(IRInstKey{ inst }, inst); - m_instReplacementMap.Remove(inst); + m_globalValueNumberingMap.add(IRInstKey{ inst }, inst); + m_instReplacementMap.remove(inst); tryHoistInst(inst); } void _removeGlobalNumberingEntry(IRInst* inst) { IRInst* value = nullptr; - if (m_globalValueNumberingMap.TryGetValue(IRInstKey{ inst }, value)) + if (m_globalValueNumberingMap.tryGetValue(IRInstKey{ inst }, value)) { if (value == inst) { - m_globalValueNumberingMap.Remove(IRInstKey{ inst }); + m_globalValueNumberingMap.remove(IRInstKey{ inst }); } } } diff --git a/source/slang/slang-language-server-completion.cpp b/source/slang/slang-language-server-completion.cpp index 92a0b3860..9736bd889 100644 --- a/source/slang/slang-language-server-completion.cpp +++ b/source/slang/slang-language-server-completion.cpp @@ -202,7 +202,7 @@ List<LanguageServerProtocol::TextEditCompletionItem> CompletionContext::gatherFi if (item.label.getLength()) { auto key = String(item.kind) + item.label; - if (context->itemSet.Add(key)) + if (context->itemSet.add(key)) { item.detail = Path::combine(context->path, String(name)); Path::getCanonical(item.detail, item.detail); @@ -483,7 +483,7 @@ List<LanguageServerProtocol::CompletionItem> CompletionContext::collectMembersAn continue; if (item.label.startsWith("$")) continue; - if (!deduplicateSet.Add(item.label)) + if (!deduplicateSet.add(item.label)) continue; if (as<StructDecl>(member)) @@ -536,7 +536,7 @@ List<LanguageServerProtocol::CompletionItem> CompletionContext::collectMembersAn { for (auto keyword : kDeclKeywords) { - if (!deduplicateSet.Add(keyword)) + if (!deduplicateSet.add(keyword)) continue; LanguageServerProtocol::CompletionItem item; item.label = keyword; @@ -549,7 +549,7 @@ List<LanguageServerProtocol::CompletionItem> CompletionContext::collectMembersAn { for (auto keyword : kStmtKeywords) { - if (!deduplicateSet.Add(keyword)) + if (!deduplicateSet.add(keyword)) continue; LanguageServerProtocol::CompletionItem item; item.label = keyword; @@ -564,7 +564,7 @@ List<LanguageServerProtocol::CompletionItem> CompletionContext::collectMembersAn if (!def.name) continue; auto& text = def.name->text; - if (!deduplicateSet.Add(text)) + if (!deduplicateSet.add(text)) continue; LanguageServerProtocol::CompletionItem item; item.label = text; @@ -629,11 +629,11 @@ List<LanguageServerProtocol::CompletionItem> CompletionContext::createSwizzleCan item.data = 0; item.detail = typeStr; item.kind = LanguageServerProtocol::kCompletionItemKindVariable; - nameSB.Clear(); + nameSB.clear(); nameSB << "_m" << i << j; item.label = nameSB.ToString(); result.add(item); - nameSB.Clear(); + nameSB.clear(); nameSB << "_" << i + 1 << j + 1; item.label = nameSB.ToString(); result.add(item); diff --git a/source/slang/slang-language-server-document-symbols.cpp b/source/slang/slang-language-server-document-symbols.cpp index b2b213b02..ae905caec 100644 --- a/source/slang/slang-language-server-document-symbols.cpp +++ b/source/slang/slang-language-server-document-symbols.cpp @@ -131,7 +131,7 @@ namespace Slang auto containerDecl = as<ContainerDecl>(parent); if (!containerDecl) return; - if (!context.processedDecls.Add(parent)) + if (!context.processedDecls.add(parent)) return; auto srcManager = context.linkage->getSourceManager(); for (auto child : containerDecl->members) diff --git a/source/slang/slang-language-server.cpp b/source/slang/slang-language-server.cpp index 25c6c1a01..715ecfc5d 100644 --- a/source/slang/slang-language-server.cpp +++ b/source/slang/slang-language-server.cpp @@ -358,7 +358,7 @@ static String _formatDocumentation(String doc) if (!hasDoxygen) { // For ordinary comments, we want to preserve line breaks in the original comment. - result.Clear(); + result.clear(); for (Index i = 0; i < lines.getCount(); i++) { result << lines[i] << " \n"; @@ -429,7 +429,7 @@ SlangResult LanguageServer::hover( { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -608,7 +608,7 @@ SlangResult LanguageServer::gotoDefinition( { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -734,7 +734,7 @@ SlangResult LanguageServer::completion( String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -898,7 +898,7 @@ SlangResult LanguageServer::semanticTokens( String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1036,7 +1036,7 @@ SlangResult LanguageServer::signatureHelp( { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1249,7 +1249,7 @@ SlangResult LanguageServer::documentSymbol( { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1270,7 +1270,7 @@ SlangResult LanguageServer::inlayHint(const LanguageServerProtocol::InlayHintPar { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1319,7 +1319,7 @@ SlangResult LanguageServer::formatting(const LanguageServerProtocol::DocumentFor { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1337,7 +1337,7 @@ SlangResult LanguageServer::rangeFormatting(const LanguageServerProtocol::Docume { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1360,7 +1360,7 @@ SlangResult LanguageServer::onTypeFormatting(const LanguageServerProtocol::Docum { String canonicalPath = uriToCanonicalPath(args.textDocument.uri); RefPtr<DocumentVersion> doc; - if (!m_workspace->openedDocuments.TryGetValue(canonicalPath, doc)) + if (!m_workspace->openedDocuments.tryGetValue(canonicalPath, doc)) { m_connection->sendResult(NullResponse::get(), responseId); return SLANG_OK; @@ -1398,30 +1398,30 @@ void LanguageServer::publishDiagnostics() List<String> filesToRemove; for (auto& file : m_lastPublishedDiagnostics) { - if (!version->diagnostics.ContainsKey(file.Key)) + if (!version->diagnostics.containsKey(file.key)) { PublishDiagnosticsParams args; - args.uri = URI::fromLocalFilePath(file.Key.getUnownedSlice()).uri; + args.uri = URI::fromLocalFilePath(file.key.getUnownedSlice()).uri; m_connection->sendCall(UnownedStringSlice("textDocument/publishDiagnostics"), &args); - filesToRemove.add(file.Key); + filesToRemove.add(file.key); } } for (auto& toRemove : filesToRemove) { - m_lastPublishedDiagnostics.Remove(toRemove); + m_lastPublishedDiagnostics.remove(toRemove); } // Send updates for any files whose diagnostic messages has changed since last update. for (auto& list : version->diagnostics) { - auto lastPublished = m_lastPublishedDiagnostics.TryGetValue(list.Key); - if (!lastPublished || *lastPublished != list.Value.originalOutput) + auto lastPublished = m_lastPublishedDiagnostics.tryGetValue(list.key); + if (!lastPublished || *lastPublished != list.value.originalOutput) { PublishDiagnosticsParams args; - args.uri = URI::fromLocalFilePath(list.Key.getUnownedSlice()).uri; - for (auto& d : list.Value.messages) + args.uri = URI::fromLocalFilePath(list.key.getUnownedSlice()).uri; + for (auto& d : list.value.messages) args.diagnostics.add(d); m_connection->sendCall(UnownedStringSlice("textDocument/publishDiagnostics"), &args); - m_lastPublishedDiagnostics[list.Key] = list.Value.originalOutput; + m_lastPublishedDiagnostics[list.key] = list.value.originalOutput; } } } @@ -1906,14 +1906,14 @@ void LanguageServer::processCommands() auto id = cmd.cancelArgs.get().id; if (id > 0) { - canceledIDs.Add(id); + canceledIDs.add(id); } } } const int kErrorRequestCanceled = -32800; for (auto& cmd : commands) { - if (cmd.id.getKind() == JSONValue::Kind::Integer && canceledIDs.Contains(cmd.id.asInteger())) + if (cmd.id.getKind() == JSONValue::Kind::Integer && canceledIDs.contains(cmd.id.asInteger())) { m_connection->sendError((JSONRPC::ErrorCode)kErrorRequestCanceled, cmd.id); } diff --git a/source/slang/slang-legalize-types.cpp b/source/slang/slang-legalize-types.cpp index 8d8056e30..e17fa54bb 100644 --- a/source/slang/slang-legalize-types.cpp +++ b/source/slang/slang-legalize-types.cpp @@ -1323,7 +1323,7 @@ LegalType legalizeType( IRType* type) { LegalType legalType; - if(context->mapTypeToLegalType.TryGetValue(type, legalType)) + if(context->mapTypeToLegalType.tryGetValue(type, legalType)) return legalType; legalType = legalizeTypeImpl(context, type); diff --git a/source/slang/slang-lookup.cpp b/source/slang/slang-lookup.cpp index c560b67f9..9ac5fc940 100644 --- a/source/slang/slang-lookup.cpp +++ b/source/slang/slang-lookup.cpp @@ -174,7 +174,7 @@ static void _lookUpDirectAndTransparentMembers( { // Look up the declarations with the chosen name in the container. Decl* firstDecl = nullptr; - containerDecl->getMemberDictionary().TryGetValue(name, firstDecl); + containerDecl->getMemberDictionary().tryGetValue(name, firstDecl); // Now iterate over those declarations (if any) and see if // we find any that meet our filtering criteria. diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index 110f85b87..f156bafa1 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -529,7 +529,7 @@ struct IRGenContext IRGenEnv* envToFindIn = env; while (envToFindIn) { - if (auto rs = envToFindIn->mapDeclToValue.TryGetValue(decl)) + if (auto rs = envToFindIn->mapDeclToValue.tryGetValue(decl)) return rs; envToFindIn = envToFindIn->outer; } @@ -1348,7 +1348,7 @@ IRStructKey* getInterfaceRequirementKey( return nullptr; IRStructKey* requirementKey = nullptr; - if(context->shared->interfaceRequirementKeys.TryGetValue(requirementDecl, requirementKey)) + if(context->shared->interfaceRequirementKeys.tryGetValue(requirementDecl, requirementKey)) { return requirementKey; } @@ -1365,7 +1365,7 @@ IRStructKey* getInterfaceRequirementKey( addLinkageDecoration(context, requirementKey, requirementDecl); - context->shared->interfaceRequirementKeys.Add(requirementDecl, requirementKey); + context->shared->interfaceRequirementKeys.add(requirementDecl, requirementKey); return requirementKey; } @@ -5131,8 +5131,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // Register the `break` and `continue` labels so // that we can find them for nested statements. - context->shared->breakLabels.Add(stmt, breakLabel); - context->shared->continueLabels.Add(stmt, continueLabel); + context->shared->breakLabels.add(stmt, breakLabel); + context->shared->continueLabels.add(stmt, continueLabel); // Emit the branch that will start out loop, // and then insert the block for the head. @@ -5229,8 +5229,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // Register the `break` and `continue` labels so // that we can find them for nested statements. - context->shared->breakLabels.Add(stmt, breakLabel); - context->shared->continueLabels.Add(stmt, continueLabel); + context->shared->breakLabels.add(stmt, breakLabel); + context->shared->continueLabels.add(stmt, continueLabel); // Emit the branch that will start out loop, // and then insert the block for the head. @@ -5291,8 +5291,8 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // Register the `break` and `continue` labels so // that we can find them for nested statements. - context->shared->breakLabels.Add(stmt, breakLabel); - context->shared->continueLabels.Add(stmt, continueLabel); + context->shared->breakLabels.add(stmt, breakLabel); + context->shared->continueLabels.add(stmt, continueLabel); // Emit the branch that will start out loop, // and then insert the block for the head. @@ -5488,7 +5488,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // corresponds to the break label for that statement, // and then emit an instruction to jump to it. IRBlock* targetBlock = nullptr; - context->shared->breakLabels.TryGetValue(parentStmt, targetBlock); + context->shared->breakLabels.tryGetValue(parentStmt, targetBlock); SLANG_ASSERT(targetBlock); getBuilder()->emitBreak(targetBlock); } @@ -5507,7 +5507,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // corresponds to the continue label for that statement, // and then emit an instruction to jump to it. IRBlock* targetBlock = nullptr; - context->shared->continueLabels.TryGetValue(parentStmt, targetBlock); + context->shared->continueLabels.tryGetValue(parentStmt, targetBlock); SLANG_ASSERT(targetBlock); getBuilder()->emitContinue(targetBlock); } @@ -5759,7 +5759,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // Register the `break` label so // that we can find it for nested statements. - context->shared->breakLabels.Add(stmt, breakLabel); + context->shared->breakLabels.add(stmt, breakLabel); builder->setInsertInto(initialBlock->getParent()); @@ -5812,7 +5812,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // (and that control flow will fall through to otherwise). // This is the block that subsequent code will go into. insertBlock(breakLabel); - context->shared->breakLabels.Remove(stmt); + context->shared->breakLabels.remove(stmt); } }; @@ -6550,8 +6550,8 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> for(auto entry : astWitnessTable->requirementDictionary) { - auto requiredMemberDecl = entry.Key; - auto satisfyingWitness = entry.Value; + auto requiredMemberDecl = entry.key; + auto satisfyingWitness = entry.value; auto irRequirementKey = getInterfaceRequirementKey(requiredMemberDecl); if (!irRequirementKey) continue; @@ -6581,7 +6581,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> { auto astReqWitnessTable = satisfyingWitness.getWitnessTable(); IRWitnessTable* irSatisfyingWitnessTable = nullptr; - if(!mapASTToIRWitnessTable.TryGetValue(astReqWitnessTable, irSatisfyingWitnessTable)) + if(!mapASTToIRWitnessTable.tryGetValue(astReqWitnessTable, irSatisfyingWitnessTable)) { // Need to construct a sub-witness-table auto irWitnessTableBaseType = lowerType(subContext, astReqWitnessTable->baseType); @@ -7695,8 +7695,8 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> for (auto& entry : attr->m_mapTypeToIDifferentiableWitness) { // Lower type and witness. - IRType* irType = lowerType(subContext, entry.Value->sub); - IRInst* irWitness = lowerVal(subContext, entry.Value).val; + IRType* irType = lowerType(subContext, entry.value->sub); + IRInst* irWitness = lowerVal(subContext, entry.value).val; SLANG_ASSERT(irType); @@ -7985,7 +7985,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> { if (!isChildOf(value, parentBlock)) return; - if (valuesToClone.Add(value)) + if (valuesToClone.add(value)) { for (UInt i = 0; i < value->getOperandCount(); i++) { @@ -7998,7 +7998,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> auto parent = parentBlock->getParent(); while (parent && parent != parentBlock) { - valuesToClone.Add(parent); + valuesToClone.add(parent); parent = parent->getParent(); } } @@ -8052,7 +8052,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> markInstsToClone(valuesToClone, parentGeneric->getFirstBlock(), genericParam); } } - if (valuesToClone.Count() == 0) + if (valuesToClone.getCount() == 0) { // If the new generic has no parameters, set // the generic inst's type to just `returnType`. @@ -8071,13 +8071,13 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> for (auto child : parentGeneric->getFirstBlock()->getChildren()) { - if (valuesToClone.Contains(child)) + if (valuesToClone.contains(child)) { cloneInst(&cloneEnv, &typeBuilder, child); } } IRInst* clonedReturnType = nullptr; - cloneEnv.mapOldValToNew.TryGetValue(returnType, clonedReturnType); + cloneEnv.mapOldValToNew.tryGetValue(returnType, clonedReturnType); if (clonedReturnType) { // If the type has explicit dependency on generic parameters, use @@ -8110,7 +8110,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo> for (auto param : parentGeneric->getParams()) { IRInst* arg = nullptr; - if (cloneEnv.mapOldValToNew.TryGetValue(param, arg)) + if (cloneEnv.mapOldValToNew.tryGetValue(param, arg)) { specializeArgs.add(arg); } @@ -9040,7 +9040,7 @@ LoweredValInfo ensureDecl( auto env = context->env; while(env) { - if(env->mapDeclToValue.TryGetValue(decl, result)) + if(env->mapDeclToValue.tryGetValue(decl, result)) return result; env = env->outer; @@ -9995,7 +9995,7 @@ IRTypeLayout* lowerTypeLayout( // so that if we run into another type layout for the // same entry point we will re-use the same keys. // - if( !context->mapEntryPointParamToKey.TryGetValue(paramDecl, irFieldKey) ) + if( !context->mapEntryPointParamToKey.tryGetValue(paramDecl, irFieldKey) ) { irFieldKey = context->irBuilder->createStructKey(); @@ -10012,7 +10012,7 @@ IRTypeLayout* lowerTypeLayout( // of these keys will be local to a single `IREntryPointLayout`, // and we don't support combination at a finer granularity than that. - context->mapEntryPointParamToKey.Add(paramDecl, irFieldKey); + context->mapEntryPointParamToKey.add(paramDecl, irFieldKey); } } else diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp index 2386e9f5a..dea808a8e 100644 --- a/source/slang/slang-mangle.cpp +++ b/source/slang/slang-mangle.cpp @@ -441,10 +441,10 @@ namespace Slang auto canonicalizedConstraints = getCanonicalGenericConstraints(parentGenericDeclRef); for (auto& constraint : canonicalizedConstraints) { - for (auto type : constraint.Value) + for (auto type : constraint.value) { emitRaw(context, "C"); - emitQualifiedName(context, DeclRef<Decl>(constraint.Key, nullptr)); + emitQualifiedName(context, DeclRef<Decl>(constraint.key, nullptr)); emitType(context, type); } } diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index a8ac88f81..34ef0763f 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -819,7 +819,7 @@ struct OptionsParser continue; } - buf.Clear(); + buf.clear(); buf << diagnostic->id << " : "; NameConventionUtil::convert(NameStyle::Camel, UnownedStringSlice(diagnostic->name), NameConvention::LowerKabab, buf); @@ -1999,7 +1999,7 @@ struct OptionsParser continue; int targetIndex = 0; - if( !mapFormatToTargetIndex.TryGetValue(impliedFormat, targetIndex) ) + if( !mapFormatToTargetIndex.tryGetValue(impliedFormat, targetIndex) ) { targetIndex = (int) rawTargets.getCount(); @@ -2026,7 +2026,7 @@ struct OptionsParser { auto format = rawTargets[targetIndex].format; - if( mapFormatToTargetIndex.ContainsKey(format) ) + if( mapFormatToTargetIndex.containsKey(format) ) { sink->diagnose(SourceLoc(), Diagnostics::duplicateTargets, format); } @@ -2272,7 +2272,7 @@ struct OptionsParser // sink->diagnose(SourceLoc(), Diagnostics::cannotDeduceOutputFormatFromPath, rawOutput.path); } - else if( mapFormatToTargetIndex.TryGetValue(rawOutput.impliedFormat, targetIndex) ) + else if( mapFormatToTargetIndex.tryGetValue(rawOutput.impliedFormat, targetIndex) ) { rawOutput.targetIndex = targetIndex; } @@ -2330,7 +2330,7 @@ struct OptionsParser auto targetID = rawTargets[rawOutput.targetIndex].targetID; auto target = requestImpl->getLinkage()->targets[targetID]; RefPtr<EndToEndCompileRequest::TargetInfo> targetInfo; - if( !requestImpl->m_targetInfos.TryGetValue(target, targetInfo) ) + if( !requestImpl->m_targetInfos.tryGetValue(target, targetInfo) ) { targetInfo = new EndToEndCompileRequest::TargetInfo(); requestImpl->m_targetInfos[target] = targetInfo; @@ -2356,7 +2356,7 @@ struct OptionsParser auto entryPointReq = requestImpl->getFrontEndReq()->getEntryPointReqs()[entryPointID]; //String outputPath; - if (targetInfo->entryPointOutputPaths.ContainsKey(entryPointID)) + if (targetInfo->entryPointOutputPaths.containsKey(entryPointID)) { sink->diagnose(SourceLoc(), Diagnostics::duplicateOutputPathsForEntryPointAndTarget, entryPointReq->getName(), target->getTarget()); } diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index f3eabf613..1edd87d3a 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -776,11 +776,11 @@ static RefPtr<UsedRangeSet> findUsedRangeSetForSpace( UInt space) { RefPtr<UsedRangeSet> usedRangeSet; - if (context->shared->globalSpaceUsedRangeSets.TryGetValue(space, usedRangeSet)) + if (context->shared->globalSpaceUsedRangeSets.tryGetValue(space, usedRangeSet)) return usedRangeSet; usedRangeSet = new UsedRangeSet(); - context->shared->globalSpaceUsedRangeSets.Add(space, usedRangeSet); + context->shared->globalSpaceUsedRangeSets.add(space, usedRangeSet); return usedRangeSet; } @@ -1979,7 +1979,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter( fieldVarLayout->varDecl = field; structLayout->fields.add(fieldVarLayout); - structLayout->mapVarToLayout.Add(field.getDecl(), fieldVarLayout); + structLayout->mapVarToLayout.add(field.getDecl(), fieldVarLayout); auto fieldTypeLayout = processEntryPointVaryingParameterDecl( context, @@ -2220,7 +2220,7 @@ struct ScopeLayoutBuilder m_structLayout->fields.add(varLayout); - m_structLayout->mapVarToLayout.Add(varLayout->varDecl.getDecl(), varLayout); + m_structLayout->mapVarToLayout.add(varLayout->varDecl.getDecl(), varLayout); } void addParameter( @@ -2794,7 +2794,7 @@ struct CollectGlobalGenericArgumentsVisitor : ComponentTypeVisitor { if(auto globalGenericTypeParamDecl = as<GlobalGenericParamDecl>(globalGenericArg.paramDecl)) { - m_context->shared->programLayout->globalGenericArgs.Add(globalGenericTypeParamDecl, globalGenericArg.argVal); + m_context->shared->programLayout->globalGenericArgs.add(globalGenericTypeParamDecl, globalGenericArg.argVal); } } } @@ -3048,7 +3048,7 @@ static int _calcTotalNumUsedRegistersForLayoutResourceKind(ParameterBindingConte int numUsed = 0; for (auto& pair : bindingContext->shared->globalSpaceUsedRangeSets) { - UsedRangeSet* rangeSet = pair.Value; + UsedRangeSet* rangeSet = pair.value; const auto& usedRanges = rangeSet->usedResourceRanges[kind]; for (const auto& usedRange : usedRanges.ranges) { diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index 555c79445..b3c9f9942 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -3155,7 +3155,7 @@ namespace Slang // lookup will only give us the first. // Decl* firstDecl = nullptr; - parentDecl->getMemberDictionary().TryGetValue(nameAndLoc.name, firstDecl); + parentDecl->getMemberDictionary().tryGetValue(nameAndLoc.name, firstDecl); // // We will search through the declarations of the name // and find the first that is a namespace (if any). @@ -5041,13 +5041,13 @@ namespace Slang SelectExpr* select = new SelectExpr(); FillPosition(select.Ptr()); - select->Arguments.Add(condition); + select->Arguments.add(condition); select->FunctionExpr = parseOperator(this); - select->Arguments.Add(ParseExpression(level)); + select->Arguments.add(ParseExpression(level)); ReadToken(TokenType::Colon); - select->Arguments.Add(ParseExpression(level)); + select->Arguments.add(ParseExpression(level)); return select; } else @@ -5063,9 +5063,9 @@ namespace Slang OperatorExpr* tmp = new InfixExpr(); tmp->FunctionExpr = parseOperator(this); - tmp->Arguments.Add(left); + tmp->Arguments.add(left); FillPosition(tmp.Ptr()); - tmp->Arguments.Add(ParseExpression(Precedence(level + 1))); + tmp->Arguments.add(ParseExpression(Precedence(level + 1))); left = tmp; } return left; @@ -5076,10 +5076,10 @@ namespace Slang if (GetOpLevel(this, tokenReader.PeekTokenType()) == level) { OperatorExpr* tmp = new InfixExpr(); - tmp->Arguments.Add(left); + tmp->Arguments.add(left); FillPosition(tmp.Ptr()); tmp->FunctionExpr = parseOperator(this); - tmp->Arguments.Add(ParseExpression(level)); + tmp->Arguments.add(ParseExpression(level)); left = tmp; } return left; diff --git a/source/slang/slang-preprocessor.cpp b/source/slang/slang-preprocessor.cpp index 341e75ea4..ba96ac887 100644 --- a/source/slang/slang-preprocessor.cpp +++ b/source/slang/slang-preprocessor.cpp @@ -1143,7 +1143,7 @@ static MacroDefinition* LookupMacro(Environment* environment, Name* name) for(Environment* e = environment; e; e = e->parent) { MacroDefinition* macro = NULL; - if (e->macros.TryGetValue(name, macro)) + if (e->macros.tryGetValue(name, macro)) return macro; } @@ -3022,7 +3022,7 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) expectEndOfDirective(context); // Check whether we've previously included this file and seen a `#pragma once` directive - if(context->m_preprocessor->pragmaOnceUniqueIdentities.Contains(filePathInfo.uniqueIdentity)) + if(context->m_preprocessor->pragmaOnceUniqueIdentities.contains(filePathInfo.uniqueIdentity)) { return; } @@ -3093,7 +3093,7 @@ static void _parseMacroOps( { auto paramName = token.getName(); Index paramIndex = -1; - if(!mapParamNameToIndex.TryGetValue(paramName, paramIndex)) + if(!mapParamNameToIndex.tryGetValue(paramName, paramIndex)) { continue; } @@ -3115,7 +3115,7 @@ static void _parseMacroOps( } auto paramName = paramNameToken.getName(); Index paramIndex = -1; - if(!mapParamNameToIndex.TryGetValue(paramName, paramIndex)) + if(!mapParamNameToIndex.tryGetValue(paramName, paramIndex)) { GetSink(preprocessor)->diagnose(token.loc, Diagnostics::expectedMacroParameterAfterStringize); continue; @@ -3298,7 +3298,7 @@ static void HandleDefineDirective(PreprocessorDirectiveContext* context) macro->params.add(param); auto paramName = param.nameLoc.name; - if(mapParamNameToIndex.ContainsKey(paramName)) + if(mapParamNameToIndex.containsKey(paramName)) { GetSink(context)->diagnose(param.nameLoc.loc, Diagnostics::duplicateMacroParameterName, name); } @@ -3390,7 +3390,7 @@ static void HandleUndefDirective(PreprocessorDirectiveContext* context) if (macro != NULL) { // name was defined, so remove it - env->macros.Remove(name); + env->macros.remove(name); delete macro; } @@ -3565,7 +3565,7 @@ SLANG_PRAGMA_DIRECTIVE_CALLBACK(handlePragmaOnceDirective) return; } - context->m_preprocessor->pragmaOnceUniqueIdentities.Add(issuedFromPathInfo.uniqueIdentity); + context->m_preprocessor->pragmaOnceUniqueIdentities.add(issuedFromPathInfo.uniqueIdentity); } // Information about a specific `#pragma` directive @@ -3858,7 +3858,7 @@ Environment::~Environment() { for (auto pair : this->macros) { - auto macro = pair.Value; + auto macro = pair.value; delete macro; } } @@ -3899,7 +3899,7 @@ static void DefineMacro( macro->nameAndLoc.loc = keyView->getRange().begin; MacroDefinition* oldMacro = NULL; - if (preprocessor->globalEnv.macros.TryGetValue(keyName, oldMacro)) + if (preprocessor->globalEnv.macros.tryGetValue(keyName, oldMacro)) { delete oldMacro; } @@ -4060,7 +4060,7 @@ TokenList preprocessSource( { for (auto p : *desc.defines) { - DefineMacro(&preprocessor, p.Key, p.Value); + DefineMacro(&preprocessor, p.key, p.value); } } diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 9c1d48a28..e3e9de2cd 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -269,7 +269,7 @@ SLANG_API SlangResult spReflectionUserAttribute_GetArgumentValueInt(SlangReflect if (index >= (unsigned int)userAttr->args.getCount()) return SLANG_E_INVALID_ARG; NodeBase* val = nullptr; - if (userAttr->intArgVals.TryGetValue(index, val)) + if (userAttr->intArgVals.tryGetValue(index, val)) { *rs = (int)as<ConstantIntVal>(val)->value; return 0; @@ -1409,11 +1409,11 @@ namespace Slang Int _findOrAddDescriptorSet(Int space) { Int index = 0; - if(m_mapSpaceToDescriptorSetIndex.TryGetValue(space, index)) + if(m_mapSpaceToDescriptorSetIndex.tryGetValue(space, index)) return index; index = m_extendedInfo->m_descriptorSets.getCount(); - m_mapSpaceToDescriptorSetIndex.Add(space, index); + m_mapSpaceToDescriptorSetIndex.add(space, index); RefPtr<TypeLayout::ExtendedInfo::DescriptorSetInfo> descriptorSet = new TypeLayout::ExtendedInfo::DescriptorSetInfo(); m_extendedInfo->m_descriptorSets.add(descriptorSet); diff --git a/source/slang/slang-repro.cpp b/source/slang/slang-repro.cpp index d77aa9b21..c978ab47c 100644 --- a/source/slang/slang-repro.cpp +++ b/source/slang/slang-repro.cpp @@ -90,7 +90,7 @@ struct StoreContext Offset32Ptr<FileState> findFile(const String& uniqueIdentity) { Offset32Ptr<FileState> file; - m_uniqueToFileMap.TryGetValue(uniqueIdentity, file); + m_uniqueToFileMap.tryGetValue(uniqueIdentity, file); return file; } @@ -103,13 +103,13 @@ struct StoreContext // Get the file, if it has an identity if (uniqueIdentity.getLength()) { - if (!m_uniqueToFileMap.TryGetValue(uniqueIdentity, file)) + if (!m_uniqueToFileMap.tryGetValue(uniqueIdentity, file)) { // If file was not found create it // Create the file file = m_container->newObject<FileState>(); // Add it - m_uniqueToFileMap.Add(uniqueIdentity, file); + m_uniqueToFileMap.add(uniqueIdentity, file); // Set the identity auto offsetUniqueIdentity = m_container->newString(uniqueIdentity.getUnownedSlice()); @@ -147,7 +147,7 @@ struct StoreContext auto& base = m_container->asBase(); Offset32Ptr<ReproUtil::SourceFileState> sourceFileState; - if (m_sourceFileMap.TryGetValue(sourceFile, sourceFileState)) + if (m_sourceFileMap.tryGetValue(sourceFile, sourceFileState)) { return sourceFileState; } @@ -176,7 +176,7 @@ struct StoreContext dst->type = pathInfo.type; } - m_sourceFileMap.Add(sourceFile, sourceFileState); + m_sourceFileMap.add(sourceFile, sourceFileState); return sourceFileState; } @@ -185,12 +185,12 @@ struct StoreContext { Offset32Ptr<OffsetString> value; - if (m_stringMap.TryGetValue(in, value)) + if (m_stringMap.tryGetValue(in, value)) { return value; } value = m_container->newString(in.getUnownedSlice()); - m_stringMap.Add(in, value); + m_stringMap.add(in, value); return value; } Offset32Ptr<OffsetString> fromName(Name* name) @@ -212,7 +212,7 @@ struct StoreContext OffsetBase& base = m_container->asBase(); Offset32Ptr<PathInfoState> pathInfo; - if (!m_pathInfoMap.TryGetValue(srcPathInfo, pathInfo)) + if (!m_pathInfoMap.tryGetValue(srcPathInfo, pathInfo)) { // Get the associated file Offset32Ptr<FileState> fileState; @@ -237,7 +237,7 @@ struct StoreContext dst.loadFileResult = srcPathInfo->m_loadFileResult; dst.pathType = srcPathInfo->m_pathType; - m_pathInfoMap.Add(srcPathInfo, pathInfo); + m_pathInfoMap.add(srcPathInfo, pathInfo); } // Fill in info on the file @@ -273,7 +273,7 @@ struct StoreContext { typedef ReproUtil::StringPair StringPair; - Offset32Array<StringPair> dstDefines = m_container->newArray<StringPair>(srcDefines.Count()); + Offset32Array<StringPair> dstDefines = m_container->newArray<StringPair>(srcDefines.getCount()); OffsetBase& base = m_container->asBase(); @@ -281,8 +281,8 @@ struct StoreContext for (const auto& srcDefine : srcDefines) { // Do allocation before setting - const auto key = fromString(srcDefine.Key); - const auto value = fromString(srcDefine.Value); + const auto key = fromString(srcDefine.key); + const auto value = fromString(srcDefine.value); auto& dstDefine = base[dstDefines[index]]; dstDefine.first = key; @@ -447,22 +447,22 @@ static String _scrubName(const String& in) { const auto& srcTargetInfos = request->m_targetInfos; - if (RefPtr<EndToEndCompileRequest::TargetInfo>* infosPtr = srcTargetInfos.TryGetValue(srcTargetRequest)) + if (RefPtr<EndToEndCompileRequest::TargetInfo>* infosPtr = srcTargetInfos.tryGetValue(srcTargetRequest)) { EndToEndCompileRequest::TargetInfo* infos = *infosPtr; const auto& entryPointOutputPaths = infos->entryPointOutputPaths; - Offset32Array<OutputState> dstOutputStates = inOutContainer.newArray<OutputState>(entryPointOutputPaths.Count()); + Offset32Array<OutputState> dstOutputStates = inOutContainer.newArray<OutputState>(entryPointOutputPaths.getCount()); Index index = 0; for (const auto& pair : entryPointOutputPaths) { - Offset32Ptr<OffsetString> outputPath = inOutContainer.newString(pair.Value.getUnownedSlice()); + Offset32Ptr<OffsetString> outputPath = inOutContainer.newString(pair.value.getUnownedSlice()); auto& dstOutputState = base[dstOutputStates[index]]; - dstOutputState.entryPointIndex = int32_t(pair.Key); + dstOutputState.entryPointIndex = int32_t(pair.key); dstOutputState.outputPath = outputPath; index++; @@ -542,13 +542,13 @@ static String _scrubName(const String& in) { const auto& srcFiles = cacheFileSystem->getPathMap(); - Offset32Array<PathAndPathInfo> pathMap = inOutContainer.newArray<PathAndPathInfo>(srcFiles.Count()); + Offset32Array<PathAndPathInfo> pathMap = inOutContainer.newArray<PathAndPathInfo>(srcFiles.getCount()); Index index = 0; for (const auto& pair : srcFiles) { - const auto path = context.fromString(pair.Key); - const auto pathInfo = context.addPathInfo(pair.Value); + const auto path = context.fromString(pair.key); + const auto pathInfo = context.addPathInfo(pair.value); PathAndPathInfo& dstInfo = base[pathMap[index]]; dstInfo.path = path; @@ -599,7 +599,7 @@ static String _scrubName(const String& in) StringBuilder uniqueName; for (Index j = 0; j < 0x10000; j++) { - uniqueName.Clear(); + uniqueName.clear(); uniqueName << filename; if (j > 0) @@ -613,7 +613,7 @@ static String _scrubName(const String& in) } int dummy = 0; - if (!uniqueNameMap.TryGetValueOrAdd(uniqueName, dummy)) + if (!uniqueNameMap.tryGetValueOrAdd(uniqueName, dummy)) { // It was added so we are done break; @@ -634,12 +634,12 @@ static String _scrubName(const String& in) // Save all the SourceFile state { const auto& srcSourceFiles = context.m_sourceFileMap; - auto dstSourceFiles = inOutContainer.newArray<Offset32Ptr<SourceFileState>>(srcSourceFiles.Count()); + auto dstSourceFiles = inOutContainer.newArray<Offset32Ptr<SourceFileState>>(srcSourceFiles.getCount()); Index index = 0; for (const auto& pair : srcSourceFiles) { - base[dstSourceFiles[index]] = pair.Value; + base[dstSourceFiles[index]] = pair.value; index++; } base[requestState]->sourceFiles = dstSourceFiles; @@ -665,7 +665,7 @@ struct LoadContext } CacheFileSystem::PathInfo* dstInfo = nullptr; - if (!m_fileToPathInfoMap.TryGetValue(file, dstInfo)) + if (!m_fileToPathInfoMap.tryGetValue(file, dstInfo)) { ComPtr<ISlangBlob> blob; @@ -703,7 +703,7 @@ struct LoadContext dstInfo->m_fileBlob = blob; // Add to map, even if the blob is nullptr (say from a failed read) - m_fileToPathInfoMap.Add(file, dstInfo); + m_fileToPathInfoMap.add(file, dstInfo); } return dstInfo; @@ -723,7 +723,7 @@ struct LoadContext } SourceFile* dstFile; - if (!m_sourceFileMap.TryGetValue(sourceFile, dstFile)) + if (!m_sourceFileMap.tryGetValue(sourceFile, dstFile)) { FileState* file = m_base->asRaw(sourceFile->file); ISlangBlob* blob = getFileBlobFromFile(file); @@ -750,7 +750,7 @@ struct LoadContext dstFile->setContents(blob); // Add to map - m_sourceFileMap.Add(sourceFile, dstFile); + m_sourceFileMap.add(sourceFile, dstFile); // Add to manager m_sourceManager->addSourceFile(pathInfo.uniqueIdentity, dstFile); @@ -766,7 +766,7 @@ struct LoadContext } CacheFileSystem::PathInfo* pathInfo; - if (m_pathInfoMap.TryGetValue(srcInfo, pathInfo)) + if (m_pathInfoMap.tryGetValue(srcInfo, pathInfo)) { return pathInfo; } @@ -790,7 +790,7 @@ struct LoadContext dstInfo->m_loadFileResult = srcInfo->loadFileResult; dstInfo->m_pathType = srcInfo->pathType; - m_pathInfoMap.Add(srcInfo, dstInfo); + m_pathInfoMap.add(srcInfo, dstInfo); return dstInfo; } @@ -809,11 +809,11 @@ struct LoadContext void loadDefines(const Offset32Array<ReproUtil::StringPair>& in, Dictionary<String, String>& out) { - out.Clear(); + out.clear(); for (const auto& define : in) { - out.Add(m_base->asRaw(m_base->asRaw(define).first)->getSlice(), m_base->asRaw(m_base->asRaw(define).second)->getSlice()); + out.add(m_base->asRaw(m_base->asRaw(define).first)->getSlice(), m_base->asRaw(m_base->asRaw(define).second)->getSlice()); } } @@ -857,7 +857,7 @@ struct LoadContext if (fileState->foundPath) { String foundPath = base.asRaw(fileState->foundPath)->getSlice(); - dstPathMap.AddIfNotExists(foundPath, pathInfo); + dstPathMap.addIfNotExists(foundPath, pathInfo); } } @@ -867,7 +867,7 @@ struct LoadContext { const auto& pair = base.asRaw(pairOffset); CacheFileSystem::PathInfo* pathInfo = context.addPathInfo(base.asRaw(pair.pathInfo)); - dstPathMap.AddIfNotExists(base.asRaw(pair.path)->getSlice(), pathInfo); + dstPathMap.addIfNotExists(base.asRaw(pair.path)->getSlice(), pathInfo); } } @@ -875,16 +875,16 @@ struct LoadContext { for (const auto& pair : context.m_fileToPathInfoMap) { - CacheFileSystem::PathInfo* pathInfo = pair.Value; + CacheFileSystem::PathInfo* pathInfo = pair.value; SLANG_ASSERT(pathInfo->m_uniqueIdentity.getLength()); - dstUniqueMap.Add(pathInfo->m_uniqueIdentity, pathInfo); + dstUniqueMap.add(pathInfo->m_uniqueIdentity, pathInfo); // Add canonical paths too.. if (pathInfo->m_canonicalPath.getLength()) { String canonicalPath = pathInfo->m_canonicalPath; - dstPathMap.AddIfNotExists(canonicalPath, pathInfo); + dstPathMap.addIfNotExists(canonicalPath, pathInfo); } } } @@ -902,7 +902,7 @@ struct LoadContext // TODO(JS): Really should be more exhaustive here, and set up to initial state ideally // Reset state { - request->m_targetInfos.Clear(); + request->m_targetInfos.clear(); // Remove any requests linkage->targets.clear(); } @@ -959,7 +959,7 @@ struct LoadContext entryPointPath = base.asRaw(srcOutputState.outputPath)->getSlice(); } - dstTargetInfo->entryPointOutputPaths.Add(srcOutputState.entryPointIndex, entryPointPath); + dstTargetInfo->entryPointOutputPaths.add(srcOutputState.entryPointIndex, entryPointPath); } } } @@ -1064,14 +1064,14 @@ struct LoadContext auto srcPathInfo = base.asRaw(pair.pathInfo); CacheFileSystem::PathInfo* pathInfo = context.addPathInfo(srcPathInfo); - dstPathMap.Add(base.asRaw(pair.path)->getSlice(), pathInfo); + dstPathMap.add(base.asRaw(pair.path)->getSlice(), pathInfo); } } // Put all the path infos in the cache system { for (const auto& pair : context.m_fileToPathInfoMap) { - CacheFileSystem::PathInfo* pathInfo = pair.Value; + CacheFileSystem::PathInfo* pathInfo = pair.value; // TODO(JS): It's not 100% clear why we are ending up // with entries that don't have a unique identity. @@ -1082,7 +1082,7 @@ struct LoadContext continue; } SLANG_ASSERT(pathInfo->m_uniqueIdentity.getLength()); - dstUniqueMap.Add(pathInfo->m_uniqueIdentity, pathInfo); + dstUniqueMap.add(pathInfo->m_uniqueIdentity, pathInfo); } } @@ -1368,7 +1368,7 @@ static SlangResult _calcCommandLine(OffsetBase& base, ReproUtil::RequestState* r entryPointPath = base.asRaw(srcOutputState.outputPath)->getSlice(); } - dstTargetInfo->entryPointOutputPaths.Add(srcOutputState.entryPointIndex, entryPointPath); + dstTargetInfo->entryPointOutputPaths.add(srcOutputState.entryPointIndex, entryPointPath); } } #endif diff --git a/source/slang/slang-serialize-container.cpp b/source/slang/slang-serialize-container.cpp index 09aea6c8b..3eea5caf7 100644 --- a/source/slang/slang-serialize-container.cpp +++ b/source/slang/slang-serialize-container.cpp @@ -292,10 +292,10 @@ static List<ExtensionDecl*>& _getCandidateExtensionList( Dictionary<AggTypeDecl*, RefPtr<CandidateExtensionList>>& mapTypeToCandidateExtensions) { RefPtr<CandidateExtensionList> entry; - if (!mapTypeToCandidateExtensions.TryGetValue(typeDecl, entry)) + if (!mapTypeToCandidateExtensions.tryGetValue(typeDecl, entry)) { entry = new CandidateExtensionList(); - mapTypeToCandidateExtensions.Add(typeDecl, entry); + mapTypeToCandidateExtensions.add(typeDecl, entry); } return entry->candidateExtensions; } @@ -537,20 +537,20 @@ static List<ExtensionDecl*>& _getCandidateExtensionList( else if (SyntaxDecl* syntaxDecl = dynamicCast<SyntaxDecl>(nodeBase)) { // Set up the dictionary lazily - if (syntaxKeywordDict.Count() == 0) + if (syntaxKeywordDict.getCount() == 0) { NamePool* namePool = options.session->getNamePool(); for (Index i = 0; i < syntaxParseInfos.getCount(); ++i) { const auto& entry = syntaxParseInfos[i]; - syntaxKeywordDict.Add(namePool->getName(entry.keywordName), i); + syntaxKeywordDict.add(namePool->getName(entry.keywordName), i); } // Must have something in it at this point - SLANG_ASSERT(syntaxKeywordDict.Count()); + SLANG_ASSERT(syntaxKeywordDict.getCount()); } // Look up the index - Index* entryIndexPtr = syntaxKeywordDict.TryGetValue(syntaxDecl->getName()); + Index* entryIndexPtr = syntaxKeywordDict.tryGetValue(syntaxDecl->getName()); if (entryIndexPtr) { // Set up SyntaxDecl based on the ParseSyntaxIndo diff --git a/source/slang/slang-serialize-ir.cpp b/source/slang/slang-serialize-ir.cpp index 062f1ed1a..d87fc38e2 100644 --- a/source/slang/slang-serialize-ir.cpp +++ b/source/slang/slang-serialize-ir.cpp @@ -27,10 +27,10 @@ static bool _isConstant(IROp opIn) void IRSerialWriter::_addInstruction(IRInst* inst) { // It cannot already be in the map - SLANG_ASSERT(!m_instMap.ContainsKey(inst)); + SLANG_ASSERT(!m_instMap.containsKey(inst)); // Add to the map - m_instMap.Add(inst, Ser::InstIndex(m_insts.getCount())); + m_instMap.add(inst, Ser::InstIndex(m_insts.getCount())); m_insts.add(inst); } @@ -117,7 +117,7 @@ Result IRSerialWriter::write(IRModule* module, SerialSourceLocWriter* sourceLocW m_insts.add(nullptr); // Reset - m_instMap.Clear(); + m_instMap.clear(); m_decorations.clear(); // Stack for parentInst @@ -135,7 +135,7 @@ Result IRSerialWriter::write(IRModule* module, SerialSourceLocWriter* sourceLocW // If it's in the stack it is assumed it is already in the inst map IRInst* parentInst = parentInstStack.getLast(); parentInstStack.removeLast(); - SLANG_ASSERT(m_instMap.ContainsKey(parentInst)); + SLANG_ASSERT(m_instMap.containsKey(parentInst)); // Okay we go through each of the children in order. If they are IRInstParent derived, we add to stack to process later // cos we want breadth first so the order of children is the same as their index order, meaning we don't need to store explicit indices @@ -145,7 +145,7 @@ Result IRSerialWriter::write(IRModule* module, SerialSourceLocWriter* sourceLocW for (IRInst* child : childrenList) { // This instruction can't be in the map... - SLANG_ASSERT(!m_instMap.ContainsKey(child)); + SLANG_ASSERT(!m_instMap.containsKey(child)); _addInstruction(child); @@ -168,8 +168,8 @@ Result IRSerialWriter::write(IRModule* module, SerialSourceLocWriter* sourceLocW { List<IRInst*> workInsts; calcInstructionList(module, workInsts); - SLANG_ASSERT(workInsts.Count() == m_insts.Count()); - for (UInt i = 0; i < workInsts.Count(); ++i) + SLANG_ASSERT(workInsts.getCount() == m_insts.getCount()); + for (UInt i = 0; i < workInsts.getCount(); ++i) { SLANG_ASSERT(workInsts[i] == m_insts[i]); } diff --git a/source/slang/slang-serialize-reflection.cpp b/source/slang/slang-serialize-reflection.cpp index 6430da55e..434d4b90e 100644 --- a/source/slang/slang-serialize-reflection.cpp +++ b/source/slang/slang-serialize-reflection.cpp @@ -44,7 +44,7 @@ static uint32_t _calcRangeRec(ReflectClassInfo* classInfo, const Dictionary<cons { classInfo->m_classId = index++; // Do the calc range for all the children - auto list = childMap.TryGetValue(classInfo); + auto list = childMap.tryGetValue(classInfo); if (list) { @@ -90,10 +90,10 @@ static ReflectClassInfo* _calcRoot(ReflectClassInfo* classInfo) if (typeInfo->m_superClass) { // Add to that item - List<ThisType*>* list = childMap.TryGetValueOrAdd(typeInfo->m_superClass, emptyList); + List<ThisType*>* list = childMap.tryGetValueOrAdd(typeInfo->m_superClass, emptyList); if (!list) { - list = childMap.TryGetValue(typeInfo->m_superClass); + list = childMap.tryGetValue(typeInfo->m_superClass); } SLANG_ASSERT(list); list->add(typeInfo); diff --git a/source/slang/slang-serialize-source-loc.cpp b/source/slang/slang-serialize-source-loc.cpp index 35473a1be..2ec732f93 100644 --- a/source/slang/slang-serialize-source-loc.cpp +++ b/source/slang/slang-serialize-source-loc.cpp @@ -57,14 +57,14 @@ SerialSourceLocData::SourceLoc SerialSourceLocWriter::addSourceLoc(SourceLoc sou SourceFile* sourceFile = sourceView->getSourceFile(); Source* debugSourceFile; { - RefPtr<Source>* ptrDebugSourceFile = m_sourceFileMap.TryGetValue(sourceFile); + RefPtr<Source>* ptrDebugSourceFile = m_sourceFileMap.tryGetValue(sourceFile); if (ptrDebugSourceFile == nullptr) { const SourceLoc::RawValue baseSourceLoc = m_freeSourceLoc; m_freeSourceLoc += SourceLoc::RawValue(sourceView->getRange().getSize() + 1); debugSourceFile = new Source(sourceFile, baseSourceLoc); - m_sourceFileMap.Add(sourceFile, debugSourceFile); + m_sourceFileMap.add(sourceFile, debugSourceFile); } else { @@ -126,7 +126,7 @@ void SerialSourceLocWriter::write(SerialSourceLocData* outSourceLocData) for (auto& pair : m_sourceFileMap) { - Source* debugSourceFile = pair.Value; + Source* debugSourceFile = pair.value; SourceFile* sourceFile = debugSourceFile->m_sourceFile; SerialSourceLocData::SourceInfo sourceInfo; diff --git a/source/slang/slang-serialize-type-info.h b/source/slang/slang-serialize-type-info.h index b6cea58f5..971d45197 100644 --- a/source/slang/slang-serialize-type-info.h +++ b/source/slang/slang-serialize-type-info.h @@ -280,7 +280,7 @@ struct SerialTypeInfo<Dictionary<KEY, VALUE>> List<KeySerialType> keys; List<ValueSerialType> values; - Index count = Index(src.Count()); + Index count = Index(src.getCount()); keys.setCount(count); values.setCount(count); @@ -293,8 +293,8 @@ struct SerialTypeInfo<Dictionary<KEY, VALUE>> Index i = 0; for (const auto& pair : src) { - SerialTypeInfo<KEY>::toSerial(writer, &pair.Key, &keys[i]); - SerialTypeInfo<VALUE>::toSerial(writer, &pair.Value, &values[i]); + SerialTypeInfo<KEY>::toSerial(writer, &pair.key, &keys[i]); + SerialTypeInfo<VALUE>::toSerial(writer, &pair.value, &values[i]); i++; } @@ -321,7 +321,7 @@ struct SerialTypeInfo<Dictionary<KEY, VALUE>> const Index count = keys.getCount(); for (Index i = 0; i < count; ++i) { - dst.Add(keys[i], values[i]); + dst.add(keys[i], values[i]); } } }; @@ -350,7 +350,7 @@ struct SerialTypeInfo<OrderedDictionary<KEY, VALUE>> List<KeySerialType> keys; List<ValueSerialType> values; - Index count = Index(src.Count()); + Index count = Index(src.getCount()); keys.setCount(count); values.setCount(count); @@ -363,8 +363,8 @@ struct SerialTypeInfo<OrderedDictionary<KEY, VALUE>> Index i = 0; for (const auto& pair : src) { - SerialTypeInfo<KEY>::toSerial(writer, &pair.Key, &keys[i]); - SerialTypeInfo<VALUE>::toSerial(writer, &pair.Value, &values[i]); + SerialTypeInfo<KEY>::toSerial(writer, &pair.key, &keys[i]); + SerialTypeInfo<VALUE>::toSerial(writer, &pair.value, &values[i]); i++; } @@ -391,7 +391,7 @@ struct SerialTypeInfo<OrderedDictionary<KEY, VALUE>> const Index count = keys.getCount(); for (Index i = 0; i < count; ++i) { - dst.Add(keys[i], values[i]); + dst.add(keys[i], values[i]); } } }; @@ -418,16 +418,16 @@ struct SerialTypeInfo<KeyValuePair<KEY, VALUE>> auto& src = *(const NativeType*)native; auto& dst = *(SerialType*)serial; - SerialTypeInfo<KEY>::toSerial(writer, &src.Key, &dst.key); - SerialTypeInfo<VALUE>::toSerial(writer, &src.Value, &dst.value); + SerialTypeInfo<KEY>::toSerial(writer, &src.key, &dst.key); + SerialTypeInfo<VALUE>::toSerial(writer, &src.value, &dst.value); } static void toNative(SerialReader* reader, const void* serial, void* native) { auto& src = *(const SerialType*)serial; auto& dst = *(NativeType*)native; - SerialTypeInfo<KEY>::toNative(reader, &src.key, &dst.Key); - SerialTypeInfo<VALUE>::toNative(reader, &src.value, &dst.Value); + SerialTypeInfo<KEY>::toNative(reader, &src.key, &dst.key); + SerialTypeInfo<VALUE>::toNative(reader, &src.value, &dst.value); } }; diff --git a/source/slang/slang-serialize.cpp b/source/slang/slang-serialize.cpp index 9b63d47c5..2e8d6c6ba 100644 --- a/source/slang/slang-serialize.cpp +++ b/source/slang/slang-serialize.cpp @@ -218,7 +218,7 @@ SerialWriter::SerialWriter(SerialClasses* classes, SerialFilter* filter, Flags f { // 0 is always the null pointer m_entries.add(nullptr); - m_ptrMap.Add(nullptr, 0); + m_ptrMap.add(nullptr, 0); } SerialIndex SerialWriter::writeObject(const SerialClass* serialCls, const void* ptr) @@ -229,7 +229,7 @@ SerialIndex SerialWriter::writeObject(const SerialClass* serialCls, const void* } // This pointer cannot be in the map - SLANG_ASSERT(m_ptrMap.TryGetValue(ptr) == nullptr); + SLANG_ASSERT(m_ptrMap.tryGetValue(ptr) == nullptr); typedef SerialInfo::ObjectEntry ObjectEntry; @@ -296,12 +296,12 @@ SerialIndex SerialWriter::writeObject(const RefObject* obj) void SerialWriter::setPointerIndex(const NodeBase* ptr, SerialIndex index) { - m_ptrMap.Add(ptr, Index(index)); + m_ptrMap.add(ptr, Index(index)); } void SerialWriter::setPointerIndex(const RefObject* ptr, SerialIndex index) { - m_ptrMap.Add(ptr, Index(index)); + m_ptrMap.add(ptr, Index(index)); } SerialIndex SerialWriter::addPointer(const NodeBase* node) @@ -312,7 +312,7 @@ SerialIndex SerialWriter::addPointer(const NodeBase* node) return SerialIndex(0); } // Look up in the map - Index* indexPtr = m_ptrMap.TryGetValue(node); + Index* indexPtr = m_ptrMap.tryGetValue(node); if (indexPtr) { return SerialIndex(*indexPtr); @@ -336,7 +336,7 @@ SerialIndex SerialWriter::addPointer(const RefObject* obj) return SerialIndex(0); } // Look up in the map - Index* indexPtr = m_ptrMap.TryGetValue(obj); + Index* indexPtr = m_ptrMap.tryGetValue(obj); if (indexPtr) { return SerialIndex(*indexPtr); @@ -349,7 +349,7 @@ SerialIndex SerialWriter::addPointer(const RefObject* obj) if (auto stringRep = dynamicCast<StringRepresentation>(obj)) { SerialIndex index = addString(StringRepresentation::asSlice(stringRep)); - m_ptrMap.Add(obj, Index(index)); + m_ptrMap.add(obj, Index(index)); return index; } else if (auto name = dynamicCast<const Name>(obj)) @@ -377,7 +377,7 @@ SerialIndex SerialWriter::_addStringSlice(SerialTypeKind typeKind, SliceMap& sli return SerialIndex(0); } - Index* indexPtr = sliceMap.TryGetValue(slice); + Index* indexPtr = sliceMap.tryGetValue(slice); if (indexPtr) { return SerialIndex(*indexPtr); @@ -405,7 +405,7 @@ SerialIndex SerialWriter::_addStringSlice(SerialTypeKind typeKind, SliceMap& sli UnownedStringSlice keySlice(((const char*)dst) + encodeCount, slice.getLength()); Index newIndex = m_entries.getCount(); - sliceMap.Add(keySlice, newIndex); + sliceMap.add(keySlice, newIndex); m_entries.add(entry); return SerialIndex(newIndex); @@ -424,14 +424,14 @@ SerialIndex SerialWriter::addName(const Name* name) } // Look it up - Index* indexPtr = m_ptrMap.TryGetValue(name); + Index* indexPtr = m_ptrMap.tryGetValue(name); if (indexPtr) { return SerialIndex(*indexPtr); } SerialIndex index = addString(name->text); - m_ptrMap.Add(name, Index(index)); + m_ptrMap.add(name, Index(index)); return index; } diff --git a/source/slang/slang-serialize.h b/source/slang/slang-serialize.h index 581ce2e5f..cc617034d 100644 --- a/source/slang/slang-serialize.h +++ b/source/slang/slang-serialize.h @@ -403,7 +403,7 @@ protected: // Okay I need to allocate space for this SerialIndex index = SerialIndex(m_entries.getCount() - 1); // Add to the map - m_ptrMap.Add(nativePtr, Index(index)); + m_ptrMap.add(nativePtr, Index(index)); return index; } diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 1c2726551..9587c3c6c 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -280,7 +280,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // for each of its requirements. RequirementWitness requirementWitness; auto witnessTable = inheritanceDeclRef.getDecl()->witnessTable; - if(witnessTable && witnessTable->requirementDictionary.TryGetValue(requirementKey, requirementWitness)) + if(witnessTable && witnessTable->requirementDictionary.tryGetValue(requirementKey, requirementWitness)) { // The `inheritanceDeclRef` has substitutions applied to it that // *aren't* present in the `requirementWitness`, because it was @@ -343,7 +343,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt { auto table = midWitness.getWitnessTable(); RequirementWitness result; - if (table->requirementDictionary.TryGetValue(requirementKey, result)) + if (table->requirementDictionary.tryGetValue(requirementKey, result)) { result = result.specialize(astBuilder, midKey.substitutions); } @@ -372,9 +372,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt void WitnessTable::add(Decl* decl, RequirementWitness const& witness) { - SLANG_ASSERT(!requirementDictionary.ContainsKey(decl)); + SLANG_ASSERT(!requirementDictionary.containsKey(decl)); - requirementDictionary.Add(decl, witness); + requirementDictionary.add(decl, witness); } // diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 3da0cc95a..90ab89ab1 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -1822,15 +1822,15 @@ RefPtr<TypeLayout> applyOffsetToTypeLayout( newStructTypeLayout->fields.add(newField); - mapOldFieldToNew.Add(oldField.Ptr(), newField.Ptr()); + mapOldFieldToNew.add(oldField.Ptr(), newField.Ptr()); } for (auto entry : oldStructTypeLayout->mapVarToLayout) { VarLayout* newFieldLayout = nullptr; - if (mapOldFieldToNew.TryGetValue(entry.Value.Ptr(), newFieldLayout)) + if (mapOldFieldToNew.tryGetValue(entry.value.Ptr(), newFieldLayout)) { - newStructTypeLayout->mapVarToLayout.Add(entry.Key, newFieldLayout); + newStructTypeLayout->mapVarToLayout.add(entry.key, newFieldLayout); } } @@ -2734,7 +2734,7 @@ Type* findGlobalGenericSpecializationArg( GlobalGenericParamDecl* decl) { Val* arg = nullptr; - context.programLayout->globalGenericArgs.TryGetValue(decl, arg); + context.programLayout->globalGenericArgs.tryGetValue(decl, arg); return as<Type>(arg); } @@ -2984,17 +2984,17 @@ static RefPtr<TypeLayout> maybeAdjustLayoutForArrayElementType( adjustedStructTypeLayout->fields.add(adjustedField); - mapOriginalFieldToAdjusted.Add(originalField, adjustedField); + mapOriginalFieldToAdjusted.add(originalField, adjustedField); } for( auto p : originalStructTypeLayout->mapVarToLayout ) { - VarDeclBase* key = p.Key; - RefPtr<VarLayout> originalVal = p.Value; + VarDeclBase* key = p.key; + RefPtr<VarLayout> originalVal = p.value; RefPtr<VarLayout> adjustedVal; - if( mapOriginalFieldToAdjusted.TryGetValue(originalVal, adjustedVal) ) + if( mapOriginalFieldToAdjusted.tryGetValue(originalVal, adjustedVal) ) { - adjustedStructTypeLayout->mapVarToLayout.Add(key, adjustedVal); + adjustedStructTypeLayout->mapVarToLayout.add(key, adjustedVal); } } @@ -3123,7 +3123,7 @@ RefPtr<VarLayout> StructTypeLayoutBuilder::addField( if( field ) { - m_typeLayout->mapVarToLayout.Add(field.getDecl(), fieldLayout); + m_typeLayout->mapVarToLayout.add(field.getDecl(), fieldLayout); } // Set up uniform offset information, if there is any uniform data in the field diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp index 309d4e51d..4d33b34c0 100644 --- a/source/slang/slang-workspace-version.cpp +++ b/source/slang/slang-workspace-version.cpp @@ -20,7 +20,7 @@ struct DirEnumerationContext { String canonicalPath; Path::getCanonical(path, canonicalPath); - if (!paths.Add(canonicalPath)) + if (!paths.add(canonicalPath)) break; path = Path::getParentDirectory(path); if (!path.startsWith(root)) @@ -34,7 +34,7 @@ DocumentVersion* Workspace::openDoc(String path, String text) doc->setText(text.getUnownedSlice()); doc->setPath(path); openedDocuments[path] = doc; - workspaceSearchPaths.Add(Path::getParentDirectory(path)); + workspaceSearchPaths.add(Path::getParentDirectory(path)); invalidate(); return doc.Ptr(); } @@ -42,7 +42,7 @@ DocumentVersion* Workspace::openDoc(String path, String text) void Workspace::changeDoc(const String& path, LanguageServerProtocol::Range range, const String& text) { RefPtr<DocumentVersion> doc; - if (openedDocuments.TryGetValue(path, doc)) + if (openedDocuments.tryGetValue(path, doc)) { Index line, col; doc->zeroBasedUTF16LocToOneBasedUTF8Loc(range.start.line, range.start.character, line, col); @@ -68,7 +68,7 @@ void Workspace::changeDoc(DocumentVersion* doc, const String& newText) void Workspace::closeDoc(const String& path) { - openedDocuments.Remove(path); + openedDocuments.remove(path); invalidate(); } @@ -205,7 +205,7 @@ void WorkspaceVersion::parseDiagnostics(String compilerOutput) continue; String fileName = line.subString(0, lparentIndex); Path::getCanonical(fileName, fileName); - auto& diagnosticList = diagnostics.GetOrAddValue(fileName, DocumentDiagnostics()); + auto& diagnosticList = diagnostics.getOrAddValue(fileName, DocumentDiagnostics()); LanguageServerProtocol::Diagnostic diagnostic; Index pos = lparentIndex + 1; @@ -251,7 +251,7 @@ void WorkspaceVersion::parseDiagnostics(String compilerOutput) diagnostic.range.end.character += tokenLength; } - if (auto doc = workspace->openedDocuments.TryGetValue(fileName)) + if (auto doc = workspace->openedDocuments.tryGetValue(fileName)) { // If the file is open, translate to UTF16 positions using the document. Index lineUTF16, colUTF16; @@ -272,8 +272,8 @@ void WorkspaceVersion::parseDiagnostics(String compilerOutput) diagnostic.range.end.line--; diagnostic.range.end.character--; } - diagnosticList.messages.Add(diagnostic); - if (diagnosticList.messages.Count() >= 1000) + diagnosticList.messages.add(diagnostic); + if (diagnosticList.messages.getCount() >= 1000) break; } } @@ -301,8 +301,8 @@ RefPtr<WorkspaceVersion> Workspace::createWorkspaceVersion() HashSet<String> set; for (auto& p : openedDocuments) { - auto dir = Path::getParentDirectory(p.Key.getBuffer()); - if (set.Add(dir)) + auto dir = Path::getParentDirectory(p.key.getBuffer()); + if (set.add(dir)) searchPathsRaw.add(dir.getBuffer()); } } @@ -332,7 +332,7 @@ SlangResult Workspace::loadFile(const char* path, ISlangBlob** outBlob) String canonnicalPath; SLANG_RETURN_ON_FAIL(Path::getCanonical(path, canonnicalPath)); RefPtr<DocumentVersion> doc; - if (openedDocuments.TryGetValue(canonnicalPath, doc)) + if (openedDocuments.tryGetValue(canonnicalPath, doc)) { *outBlob = StringBlob::create(doc->getText()).detach(); return SLANG_OK; @@ -484,7 +484,7 @@ int DocumentVersion::getTokenLength(Index line, Index col) ASTMarkup* WorkspaceVersion::getOrCreateMarkupAST(ModuleDecl* module) { RefPtr<ASTMarkup> astMarkup; - if (markupASTs.TryGetValue(module, astMarkup)) + if (markupASTs.tryGetValue(module, astMarkup)) return astMarkup.Ptr(); DiagnosticSink sink; astMarkup = new ASTMarkup(); @@ -497,11 +497,11 @@ ASTMarkup* WorkspaceVersion::getOrCreateMarkupAST(ModuleDecl* module) Module* WorkspaceVersion::getOrLoadModule(String path) { Module* module; - if (modules.TryGetValue(path, module)) + if (modules.tryGetValue(path, module)) { return module; } - auto doc = workspace->openedDocuments.TryGetValue(path); + auto doc = workspace->openedDocuments.tryGetValue(path); if (!doc) return nullptr; ComPtr<ISlangBlob> diagnosticBlob; @@ -531,7 +531,7 @@ Module* WorkspaceVersion::getOrLoadModule(String path) { auto diagnosticString = String((const char*)diagnosticBlob->getBufferPointer()); parseDiagnostics(diagnosticString); - auto docDiagnostic = diagnostics.TryGetValue(path); + auto docDiagnostic = diagnostics.tryGetValue(path); if (docDiagnostic) docDiagnostic->originalOutput = diagnosticString; } @@ -540,7 +540,7 @@ Module* WorkspaceVersion::getOrLoadModule(String path) MacroDefinitionContentAssistInfo* WorkspaceVersion::tryGetMacroDefinition(UnownedStringSlice name) { - if (macroDefinitions.Count() == 0) + if (macroDefinitions.getCount() == 0) { // build dictionary. for (auto& def : linkage->contentAssistInfo.preprocessorInfo.macroDefinitions) @@ -552,7 +552,7 @@ MacroDefinitionContentAssistInfo* WorkspaceVersion::tryGetMacroDefinition(Unowne auto namePtr = linkage->getNamePool()->tryGetName(name); if (!namePtr) return nullptr; - macroDefinitions.TryGetValue(namePtr, result); + macroDefinitions.tryGetValue(namePtr, result); return result; } diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 637b22090..b5a8585ff 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -293,7 +293,7 @@ SlangResult Session::checkPassThroughSupport(SlangPassThrough inPassThrough) SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags) { - if (m_builtinLinkage->mapNameToLoadedModules.Count()) + if (m_builtinLinkage->mapNameToLoadedModules.getCount()) { // Already have a StdLib loaded return SLANG_FAIL; @@ -348,7 +348,7 @@ SlangResult Session::compileStdLib(slang::CompileStdLibFlags compileFlags) SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) { - if (m_builtinLinkage->mapNameToLoadedModules.Count()) + if (m_builtinLinkage->mapNameToLoadedModules.getCount()) { // Already have a StdLib loaded return SLANG_FAIL; @@ -367,7 +367,7 @@ SlangResult Session::loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) SlangResult Session::saveStdLib(SlangArchiveType archiveType, ISlangBlob** outBlob) { - if (m_builtinLinkage->mapNameToLoadedModules.Count() == 0) + if (m_builtinLinkage->mapNameToLoadedModules.getCount() == 0) { // There is no standard lib loaded return SLANG_FAIL; @@ -386,8 +386,8 @@ SlangResult Session::saveStdLib(SlangArchiveType archiveType, ISlangBlob** outBl for (auto& pair : m_builtinLinkage->mapNameToLoadedModules) { - const Name* moduleName = pair.Key; - Module* module = pair.Value; + const Name* moduleName = pair.key; + Module* module = pair.value; // Set up options SerialContainerUtil::WriteOptions options; @@ -479,7 +479,7 @@ SlangResult Session::_readBuiltinModule(ISlangFileSystem* fileSystem, Scope* sco module->setIRModule(srcModule.irModule); // Put in the loaded module map - linkage->mapNameToLoadedModules.Add(sessionNamePool->getName(moduleName), module); + linkage->mapNameToLoadedModules.add(sessionNamePool->getName(moduleName), module); // Add the resulting code to the appropriate scope if (!scope->containerDecl) @@ -912,7 +912,7 @@ Linkage::Linkage(Session* session, ASTBuilder* astBuilder, Linkage* builtinLinka { for (const auto& pair : builtinLinkage->mapNameToLoadedModules) { - mapNameToLoadedModules.Add(pair.Key, pair.Value); + mapNameToLoadedModules.add(pair.key, pair.value); } } @@ -1039,7 +1039,7 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModuleFromSource( { auto name = getNamePool()->getName(moduleName); RefPtr<LoadedModule> loadedModule; - if (mapNameToLoadedModules.TryGetValue(name, loadedModule)) + if (mapNameToLoadedModules.tryGetValue(name, loadedModule)) { return loadedModule; } @@ -1172,7 +1172,7 @@ SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL Linkage::getContainerType( Type* containerTypeReflection = nullptr; ContainerTypeKey key = {inType, containerType}; - if (!m_containerTypes.TryGetValue(key, containerTypeReflection)) + if (!m_containerTypes.tryGetValue(key, containerTypeReflection)) { switch (containerType) { @@ -1215,7 +1215,7 @@ SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL Linkage::getContainerType( break; } - m_containerTypes.Add(key, containerTypeReflection); + m_containerTypes.add(key, containerTypeReflection); } SLANG_UNUSED(outDiagnostics); @@ -1267,17 +1267,17 @@ SLANG_NO_THROW SlangResult SLANG_MCALL Linkage::getTypeConformanceWitnessSequent auto name = getMangledNameForConformanceWitness(subType->getASTBuilder(), subType, supType); auto interfaceName = getMangledTypeName(supType->getASTBuilder(), supType); uint32_t resultIndex = 0; - if (mapMangledNameToRTTIObjectIndex.TryGetValue(name, resultIndex)) + if (mapMangledNameToRTTIObjectIndex.tryGetValue(name, resultIndex)) { if (outId) *outId = resultIndex; return SLANG_OK; } - auto idAllocator = mapInterfaceMangledNameToSequentialIDCounters.TryGetValue(interfaceName); + auto idAllocator = mapInterfaceMangledNameToSequentialIDCounters.tryGetValue(interfaceName); if (!idAllocator) { mapInterfaceMangledNameToSequentialIDCounters[interfaceName] = 0; - idAllocator = mapInterfaceMangledNameToSequentialIDCounters.TryGetValue(interfaceName); + idAllocator = mapInterfaceMangledNameToSequentialIDCounters.tryGetValue(interfaceName); } resultIndex = (*idAllocator); ++(*idAllocator); @@ -1341,8 +1341,8 @@ void Linkage::buildHash(DigestBuilder<SHA1>& builder, SlangInt targetIndex) // Add the preprocessor definitions to the hash for (auto& key : preprocessorDefinitions) { - builder.append(key.Key); - builder.append(key.Value); + builder.append(key.key); + builder.append(key.value); } // Add the target specified by targetIndex @@ -1536,7 +1536,7 @@ TypeLayout* TargetRequest::getTypeLayout(Type* type) auto layoutContext = getInitialLayoutContextForTarget(this, nullptr); RefPtr<TypeLayout> result; - if (getTypeLayouts().TryGetValue(type, result)) + if (getTypeLayouts().tryGetValue(type, result)) return result.Ptr(); result = createTypeLayout(layoutContext, type); getTypeLayouts()[type] = result; @@ -1819,7 +1819,7 @@ Type* ComponentType::getTypeFromString( // then we can re-use it. // Type* type = nullptr; - if(m_types.TryGetValue(typeStr, type)) + if(m_types.tryGetValue(typeStr, type)) return type; @@ -1987,7 +1987,7 @@ typedef Dictionary<SourceView*, List<SourceView*>> ViewInitiatingHierarchy; static void _calcViewInitiatingHierarchy(SourceManager* sourceManager, ViewInitiatingHierarchy& outHierarchy) { const List<SourceView*> emptyList; - outHierarchy.Clear(); + outHierarchy.clear(); // Iterate over all managers for (SourceManager* curManager = sourceManager; curManager; curManager = curManager->getParent()) @@ -2001,7 +2001,7 @@ static void _calcViewInitiatingHierarchy(SourceManager* sourceManager, ViewIniti SourceView* parentView = sourceManager->findSourceViewRecursively(view->getInitiatingSourceLoc()); if (parentView) { - List<SourceView*>& children = outHierarchy.GetOrAddValue(parentView, emptyList); + List<SourceView*>& children = outHierarchy.getOrAddValue(parentView, emptyList); // It shouldn't have already been added SLANG_ASSERT(children.indexOf(view) < 0); children.add(view); @@ -2015,7 +2015,7 @@ static void _calcViewInitiatingHierarchy(SourceManager* sourceManager, ViewIniti // This assumes they increase in SourceLoc implies an later within a source file - this is true currently. for (auto& pair : outHierarchy) { - pair.Value.sort([](SourceView* a, SourceView* b) -> bool { return a->getInitiatingSourceLoc().getRaw() < b->getInitiatingSourceLoc().getRaw(); }); + pair.value.sort([](SourceView* a, SourceView* b) -> bool { return a->getInitiatingSourceLoc().getRaw() < b->getInitiatingSourceLoc().getRaw(); }); } } @@ -2085,7 +2085,7 @@ static void _outputIncludesRec(SourceView* sourceView, Index depth, ViewInitiati _outputInclude(sourceFile, depth, sink); // Now recurse to all of the children at the next depth - List<SourceView*>* children = hierarchy.TryGetValue(sourceView); + List<SourceView*>* children = hierarchy.tryGetValue(sourceView); if (children) { for (SourceView* child : *children) @@ -2171,11 +2171,11 @@ void FrontEndCompileRequest::parseTranslationUnit( // that may be desirable or not... Dictionary<String, String> combinedPreprocessorDefinitions; for(auto& def : getLinkage()->preprocessorDefinitions) - combinedPreprocessorDefinitions.Add(def.Key, def.Value); + combinedPreprocessorDefinitions.add(def.key, def.value); for(auto& def : preprocessorDefinitions) - combinedPreprocessorDefinitions.Add(def.Key, def.Value); + combinedPreprocessorDefinitions.add(def.key, def.value); for(auto& def : translationUnit->preprocessorDefinitions) - combinedPreprocessorDefinitions.Add(def.Key, def.Value); + combinedPreprocessorDefinitions.add(def.key, def.value); // Define standard macros, if not already defined. This style assumes using `#if __SOME_VAR` style, as in // @@ -2188,28 +2188,28 @@ void FrontEndCompileRequest::parseTranslationUnit( // Of course this means using #ifndef/#ifdef/defined() is probably not appropraite with thes variables. { // Used to identify level of HLSL language compatibility - combinedPreprocessorDefinitions.AddIfNotExists("__HLSL_VERSION", "2020"); + combinedPreprocessorDefinitions.addIfNotExists("__HLSL_VERSION", "2020"); // Indicates this is being compiled by the slang *compiler* - combinedPreprocessorDefinitions.AddIfNotExists("__SLANG_COMPILER__", "1"); + combinedPreprocessorDefinitions.addIfNotExists("__SLANG_COMPILER__", "1"); // Set macro depending on source type switch (translationUnit->sourceLanguage) { case SourceLanguage::HLSL: // Used to indicate compiled as HLSL language - combinedPreprocessorDefinitions.AddIfNotExists("__HLSL__", "1"); + combinedPreprocessorDefinitions.addIfNotExists("__HLSL__", "1"); break; case SourceLanguage::Slang: // Used to indicate compiled as Slang language - combinedPreprocessorDefinitions.AddIfNotExists("__SLANG__", "1"); + combinedPreprocessorDefinitions.addIfNotExists("__SLANG__", "1"); break; default: break; } // If not set, define as 0. - combinedPreprocessorDefinitions.AddIfNotExists("__HLSL__", "0"); - combinedPreprocessorDefinitions.AddIfNotExists("__SLANG__", "0"); + combinedPreprocessorDefinitions.addIfNotExists("__HLSL__", "0"); + combinedPreprocessorDefinitions.addIfNotExists("__SLANG__", "0"); } auto module = translationUnit->getModule(); @@ -2340,7 +2340,7 @@ void FrontEndCompileRequest::checkAllTranslationUnits() // another translation unit added later to the compilation request. // We should output an error message when we detect such a case, or support // this scenario with a recursive style checking. - loadedModules.Add(translationUnit->moduleName, translationUnit->getModule()); + loadedModules.add(translationUnit->moduleName, translationUnit->getModule()); } checkEntryPoints(); } @@ -2853,7 +2853,7 @@ int FrontEndCompileRequest::addEntryPoint( entryPointProfile); m_entryPointReqs.add(entryPointReq); -// translationUnitReq->entryPoints.Add(entryPointReq); +// translationUnitReq->entryPoints.add(entryPointReq); return int(result); } @@ -2901,8 +2901,8 @@ void Linkage::loadParsedModule( String mostUniqueIdentity = pathInfo.getMostUniqueIdentity(); SLANG_ASSERT(mostUniqueIdentity.getLength() > 0); - mapPathToLoadedModule.Add(mostUniqueIdentity, loadedModule); - mapNameToLoadedModules.Add(name, loadedModule); + mapPathToLoadedModule.add(mostUniqueIdentity, loadedModule); + mapNameToLoadedModules.add(name, loadedModule); auto sink = translationUnit->compileRequest->getSink(); @@ -3069,7 +3069,7 @@ RefPtr<Module> Linkage::findOrImportModule( // Have we already loaded a module matching this name? // RefPtr<LoadedModule> loadedModule; - if (mapNameToLoadedModules.TryGetValue(name, loadedModule)) + if (mapNameToLoadedModules.tryGetValue(name, loadedModule)) { // If the map shows a null module having been loaded, // then that means there was a prior load attempt, @@ -3097,7 +3097,7 @@ RefPtr<Module> Linkage::findOrImportModule( // unit to use previously checked translation units in the same // FrontEndCompileRequest. Module* previouslyLoadedModule = nullptr; - if (loadedModules && loadedModules->TryGetValue(name, previouslyLoadedModule)) + if (loadedModules && loadedModules->tryGetValue(name, previouslyLoadedModule)) { return previouslyLoadedModule; } @@ -3145,7 +3145,7 @@ RefPtr<Module> Linkage::findOrImportModule( } // Maybe this was loaded previously at a different relative name? - if (mapPathToLoadedModule.TryGetValue(filePathInfo.getMostUniqueIdentity(), loadedModule)) + if (mapPathToLoadedModule.tryGetValue(filePathInfo.getMostUniqueIdentity(), loadedModule)) return loadedModule; // Try to load it @@ -3199,11 +3199,11 @@ void ModuleDependencyList::addLeafDependency(Module* module) void ModuleDependencyList::_addDependency(Module* module) { - if(m_moduleSet.Contains(module)) + if(m_moduleSet.contains(module)) return; m_moduleList.add(module); - m_moduleSet.Add(module); + m_moduleSet.add(module); } // @@ -3212,11 +3212,11 @@ void ModuleDependencyList::_addDependency(Module* module) void FileDependencyList::addDependency(SourceFile* sourceFile) { - if(m_fileSet.Contains(sourceFile)) + if(m_fileSet.contains(sourceFile)) return; m_fileList.add(sourceFile); - m_fileSet.Add(sourceFile); + m_fileSet.add(sourceFile); } void FileDependencyList::addDependency(Module* module) @@ -3778,7 +3778,7 @@ CompositeComponentType::CompositeComponentType( { child->enumerateModules([&](Module* module) { - requirementsSet.Add(module); + requirementsSet.add(module); }); } @@ -3817,9 +3817,9 @@ CompositeComponentType::CompositeComponentType( for(Index rr = 0; rr < childRequirementCount; ++rr) { auto childRequirement = child->getRequirement(rr); - if(!requirementsSet.Contains(childRequirement)) + if(!requirementsSet.contains(childRequirement)) { - requirementsSet.Add(childRequirement); + requirementsSet.add(childRequirement); m_requirements.add(childRequirement); } } @@ -3941,14 +3941,14 @@ struct SpecializationArgModuleCollector : ComponentTypeVisitor void addModule(Module* module) { m_modulesList.add(module); - m_modulesSet.Add(module); + m_modulesSet.add(module); } void maybeAddModule(Module* module) { if(!module) return; - if(m_modulesSet.Contains(module)) + if(m_modulesSet.contains(module)) return; addModule(module); @@ -4101,7 +4101,7 @@ SpecializedComponentType::SpecializedComponentType( // base->enumerateModules([&](Module* module) { - moduleCollector.m_modulesSet.Add(module); + moduleCollector.m_modulesSet.add(module); }); // In order to collect the additional modules, we need @@ -4174,7 +4174,7 @@ SpecializedComponentType::SpecializedComponentType( // HashSet<SourceFile*> fileDependencySet; for(SourceFile* sourceFile : m_fileDependencies) - fileDependencySet.Add(sourceFile); + fileDependencySet.add(sourceFile); for(auto module : moduleCollector.m_modulesList) { @@ -4202,9 +4202,9 @@ SpecializedComponentType::SpecializedComponentType( // for(SourceFile* sourceFile : module->getFileDependencies()) { - if(fileDependencySet.Contains(sourceFile)) + if(fileDependencySet.contains(sourceFile)) continue; - fileDependencySet.Add(sourceFile); + fileDependencySet.add(sourceFile); m_fileDependencies.add(sourceFile); } @@ -4399,7 +4399,7 @@ void ComponentTypeVisitor::visitChildren(SpecializedComponentType* specialized) TargetProgram* ComponentType::getTargetProgram(TargetRequest* target) { RefPtr<TargetProgram> targetProgram; - if(!m_targetPrograms.TryGetValue(target, targetProgram)) + if(!m_targetPrograms.tryGetValue(target, targetProgram)) { targetProgram = new TargetProgram(this, target); m_targetPrograms[target] = targetProgram; @@ -4544,7 +4544,7 @@ void Session::addBuiltinSource( auto moduleDecl = module->getModuleDecl(); // Put in the loaded module map - linkage->mapNameToLoadedModules.Add(moduleName, module); + linkage->mapNameToLoadedModules.add(moduleName, module); // Add the resulting code to the appropriate scope if (!scope->containerDecl) diff --git a/tools/gfx/debug-layer/debug-shader-object.cpp b/tools/gfx/debug-layer/debug-shader-object.cpp index d078ba583..eb67c46ab 100644 --- a/tools/gfx/debug-layer/debug-shader-object.cpp +++ b/tools/gfx/debug-layer/debug-shader-object.cpp @@ -26,7 +26,7 @@ void DebugShaderObject::checkCompleteness() { if (layout->getBindingRangeBindingCount(i) != 0) { - if (!m_initializedBindingRanges.Contains(i)) + if (!m_initializedBindingRanges.contains(i)) { auto var = layout->getBindingRangeLeafVariable(i); GFX_DIAGNOSE_ERROR_FORMAT( @@ -86,7 +86,7 @@ Result DebugShaderObject::getObject(ShaderOffset const& offset, IShaderObject** auto resultCode = baseObject->getObject(offset, innerObject.writeRef()); SLANG_RETURN_ON_FAIL(resultCode); RefPtr<DebugShaderObject> debugShaderObject; - if (m_objects.TryGetValue(ShaderOffsetKey{offset}, debugShaderObject)) + if (m_objects.tryGetValue(ShaderOffsetKey{offset}, debugShaderObject)) { if (debugShaderObject->baseObject == innerObject) { @@ -107,7 +107,7 @@ Result DebugShaderObject::setObject(ShaderOffset const& offset, IShaderObject* o SLANG_GFX_API_FUNC; auto objectImpl = getDebugObj(object); m_objects[ShaderOffsetKey{offset}] = objectImpl; - m_initializedBindingRanges.Add(offset.bindingRangeIndex); + m_initializedBindingRanges.add(offset.bindingRangeIndex); objectImpl->checkCompleteness(); return baseObject->setObject(offset, getInnerObj(object)); } @@ -117,7 +117,7 @@ Result DebugShaderObject::setResource(ShaderOffset const& offset, IResourceView* SLANG_GFX_API_FUNC; auto viewImpl = getDebugObj(resourceView); m_resources[ShaderOffsetKey{offset}] = viewImpl; - m_initializedBindingRanges.Add(offset.bindingRangeIndex); + m_initializedBindingRanges.add(offset.bindingRangeIndex); return baseObject->setResource(offset, getInnerObj(resourceView)); } @@ -126,7 +126,7 @@ Result DebugShaderObject::setSampler(ShaderOffset const& offset, ISamplerState* SLANG_GFX_API_FUNC; auto samplerImpl = getDebugObj(sampler); m_samplers[ShaderOffsetKey{offset}] = samplerImpl; - m_initializedBindingRanges.Add(offset.bindingRangeIndex); + m_initializedBindingRanges.add(offset.bindingRangeIndex); return baseObject->setSampler(offset, getInnerObj(sampler)); } @@ -140,7 +140,7 @@ Result DebugShaderObject::setCombinedTextureSampler( m_samplers[ShaderOffsetKey{offset}] = samplerImpl; auto viewImpl = getDebugObj(textureView); m_resources[ShaderOffsetKey{offset}] = viewImpl; - m_initializedBindingRanges.Add(offset.bindingRangeIndex); + m_initializedBindingRanges.add(offset.bindingRangeIndex); return baseObject->setCombinedTextureSampler( offset, getInnerObj(viewImpl), getInnerObj(sampler)); } @@ -198,9 +198,9 @@ Result DebugRootShaderObject::setSpecializationArgs( void DebugRootShaderObject::reset() { m_entryPoints.clear(); - m_objects.Clear(); - m_resources.Clear(); - m_samplers.Clear(); + m_objects.clear(); + m_resources.clear(); + m_samplers.clear(); baseObject.detach(); } diff --git a/tools/gfx/mutable-shader-object.h b/tools/gfx/mutable-shader-object.h index 9653986ad..1864be158 100644 --- a/tools/gfx/mutable-shader-object.h +++ b/tools/gfx/mutable-shader-object.h @@ -142,7 +142,7 @@ namespace gfx setObject(ShaderOffset const& offset, IShaderObject* object) override { Super::setObject(offset, object); - m_objectOffsets.Add(offset); + m_objectOffsets.add(offset); markDirty(); return SLANG_OK; } @@ -182,9 +182,9 @@ namespace gfx allocateShaderObject(static_cast<TransientResourceHeapBase*>(transientHeap)); SLANG_RETURN_ON_FAIL(object->setData(ShaderOffset(), this->m_data.getBuffer(), this->m_data.getCount())); for (auto res : m_resources) - SLANG_RETURN_ON_FAIL(object->setResource(res.Key, res.Value)); + SLANG_RETURN_ON_FAIL(object->setResource(res.key, res.value)); for (auto sampler : m_samplers) - SLANG_RETURN_ON_FAIL(object->setSampler(sampler.Key, sampler.Value)); + SLANG_RETURN_ON_FAIL(object->setSampler(sampler.key, sampler.value)); for (auto offset : m_objectOffsets) { if (offset.bindingRangeIndex < 0) @@ -304,7 +304,7 @@ namespace gfx *object = nullptr; Slang::RefPtr<ShaderObjectBase> subObject; - if (m_objects.TryGetValue(offset, subObject)) + if (m_objects.tryGetValue(offset, subObject)) { returnComPtr(object, subObject); } diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index 445f22e5a..c32cc3d90 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -715,10 +715,10 @@ Result RendererBase::getShaderObjectLayout( slang::TypeLayoutReflection* typeLayout, ShaderObjectLayoutBase** outLayout) { RefPtr<ShaderObjectLayoutBase> shaderObjectLayout; - if (!m_shaderObjectLayoutCache.TryGetValue(typeLayout, shaderObjectLayout)) + if (!m_shaderObjectLayoutCache.tryGetValue(typeLayout, shaderObjectLayout)) { SLANG_RETURN_ON_FAIL(createShaderObjectLayout(typeLayout, shaderObjectLayout.writeRef())); - m_shaderObjectLayoutCache.Add(typeLayout, shaderObjectLayout); + m_shaderObjectLayoutCache.add(typeLayout, shaderObjectLayout); } *outLayout = shaderObjectLayout.detach(); return SLANG_OK; @@ -803,13 +803,13 @@ ShaderComponentID ShaderCache::getComponentId(UnownedStringSlice name) ShaderComponentID ShaderCache::getComponentId(ComponentKey key) { ShaderComponentID componentId = 0; - if (componentIds.TryGetValue(key, componentId)) + if (componentIds.tryGetValue(key, componentId)) return componentId; OwningComponentKey owningTypeKey; owningTypeKey.hash = key.hash; owningTypeKey.typeName = key.typeName; owningTypeKey.specializationArgs.addRange(key.specializationArgs); - ShaderComponentID resultId = static_cast<ShaderComponentID>(componentIds.Count()); + ShaderComponentID resultId = static_cast<ShaderComponentID>(componentIds.getCount()); componentIds[owningTypeKey] = resultId; return resultId; } @@ -1187,20 +1187,20 @@ Result ShaderObjectBase::copyFrom(IShaderObject* object, ITransientResourceHeap* for (auto& kv : srcObj->m_objects) { ComPtr<IShaderObject> subObject; - SLANG_RETURN_ON_FAIL(kv.Value->getCurrentVersion(transientHeap, subObject.writeRef())); - setObject(kv.Key, subObject); + SLANG_RETURN_ON_FAIL(kv.value->getCurrentVersion(transientHeap, subObject.writeRef())); + setObject(kv.key, subObject); } for (auto& kv : srcObj->m_resources) { - setResource(kv.Key, kv.Value.Ptr()); + setResource(kv.key, kv.value.Ptr()); } for (auto& kv : srcObj->m_samplers) { - setSampler(kv.Key, kv.Value.Ptr()); + setSampler(kv.key, kv.value.Ptr()); } for (auto& kv : srcObj->m_specializationArgs) { - setSpecializationArgs(kv.Key, kv.Value.begin(), (uint32_t)kv.Value.getCount()); + setSpecializationArgs(kv.key, kv.value.begin(), (uint32_t)kv.value.getCount()); } return SLANG_OK; } diff --git a/tools/gfx/renderer-shared.h b/tools/gfx/renderer-shared.h index c7137f0fa..38aa775be 100644 --- a/tools/gfx/renderer-shared.h +++ b/tools/gfx/renderer-shared.h @@ -1121,7 +1121,7 @@ public: Slang::RefPtr<PipelineStateBase> getSpecializedPipelineState(PipelineKey programKey) { Slang::RefPtr<PipelineStateBase> result; - if (specializedPipelines.TryGetValue(programKey, result)) + if (specializedPipelines.tryGetValue(programKey, result)) return result; return nullptr; } @@ -1199,7 +1199,7 @@ public: TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder) { - if (auto ptr = m_deviceBuffers.TryGetValue(pipeline)) + if (auto ptr = m_deviceBuffers.tryGetValue(pipeline)) { return ptr->Ptr(); } diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index 92594f652..b9dbb264f 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -608,55 +608,55 @@ Result DeviceImpl::initVulkanInstanceAndDevice( HashSet<String> extensionNames; for (const auto& e : extensions) { - extensionNames.Add(e.extensionName); + extensionNames.add(e.extensionName); } - if (extensionNames.Contains("VK_KHR_external_memory")) + if (extensionNames.contains("VK_KHR_external_memory")) { deviceExtensions.add(VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME); #if SLANG_WINDOWS_FAMILY - if (extensionNames.Contains("VK_KHR_external_memory_win32")) + if (extensionNames.contains("VK_KHR_external_memory_win32")) { deviceExtensions.add(VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); } #endif m_features.add("external-memory"); } - if (extensionNames.Contains(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) + if (extensionNames.contains(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) { deviceExtensions.add(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME); m_features.add("conservative-rasterization-3"); m_features.add("conservative-rasterization-2"); m_features.add("conservative-rasterization-1"); } - if (extensionNames.Contains(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) + if (extensionNames.contains(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) { deviceExtensions.add(VK_EXT_DEBUG_REPORT_EXTENSION_NAME); - if (extensionNames.Contains(VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) + if (extensionNames.contains(VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) { deviceExtensions.add(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); } } - if (extensionNames.Contains(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME)) + if (extensionNames.contains(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME)) { deviceExtensions.add(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME); } - if (extensionNames.Contains(VK_NVX_BINARY_IMPORT_EXTENSION_NAME)) + if (extensionNames.contains(VK_NVX_BINARY_IMPORT_EXTENSION_NAME)) { deviceExtensions.add(VK_NVX_BINARY_IMPORT_EXTENSION_NAME); m_features.add("nvx-binary-import"); } - if (extensionNames.Contains(VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME)) + if (extensionNames.contains(VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME)) { deviceExtensions.add(VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME); m_features.add("nvx-image-view-handle"); } - if (extensionNames.Contains(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME)) + if (extensionNames.contains(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME)) { deviceExtensions.add(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); m_features.add("push-descriptor"); } - if (extensionNames.Contains(VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME)) + if (extensionNames.contains(VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME)) { deviceExtensions.add(VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME); m_features.add("barycentrics"); @@ -1759,15 +1759,15 @@ Result DeviceImpl::getFormatSupportedResourceStates(Format format, ResourceState m_api.vkGetPhysicalDeviceSurfaceFormatsKHR(m_api.m_physicalDevice, VK_NULL_HANDLE, &surfaceFormatCount, surfaceFormats.getBuffer()); for (auto surfaceFormat : surfaceFormats) { - presentableFormats.Add(surfaceFormat.format); + presentableFormats.add(surfaceFormat.format); } #else // Until we have a solution to query presentable formats without needing a surface, // hard code presentable formats that is supported by most drivers. - presentableFormats.Add(VK_FORMAT_R8G8B8A8_UNORM); - presentableFormats.Add(VK_FORMAT_B8G8R8A8_UNORM); - presentableFormats.Add(VK_FORMAT_R8G8B8A8_SRGB); - presentableFormats.Add(VK_FORMAT_B8G8R8A8_SRGB); + presentableFormats.add(VK_FORMAT_R8G8B8A8_UNORM); + presentableFormats.add(VK_FORMAT_B8G8R8A8_UNORM); + presentableFormats.add(VK_FORMAT_R8G8B8A8_SRGB); + presentableFormats.add(VK_FORMAT_B8G8R8A8_SRGB); #endif ResourceStateSet allowedStates; @@ -1813,7 +1813,7 @@ Result DeviceImpl::getFormatSupportedResourceStates(Format format, ResourceState allowedStates.add(ResourceState::DepthWrite); } // Present - if (presentableFormats.Contains(vkFormat)) + if (presentableFormats.contains(vkFormat)) allowedStates.add(ResourceState::Present); // IndirectArgument allowedStates.add(ResourceState::IndirectArgument); diff --git a/tools/gfx/vulkan/vk-pipeline-state.cpp b/tools/gfx/vulkan/vk-pipeline-state.cpp index 06bd13197..4be9877af 100644 --- a/tools/gfx/vulkan/vk-pipeline-state.cpp +++ b/tools/gfx/vulkan/vk-pipeline-state.cpp @@ -329,7 +329,7 @@ uint32_t RayTracingPipelineStateImpl::findEntryPointIndexByName( if (!name) return VK_SHADER_UNUSED_KHR; - auto indexPtr = entryPointNameToIndex.TryGetValue(String(name)); + auto indexPtr = entryPointNameToIndex.tryGetValue(String(name)); if (indexPtr) return (uint32_t)*indexPtr; // TODO: Error reporting? @@ -360,7 +360,7 @@ Result RayTracingPipelineStateImpl::createVKRayTracingPipelineState() { auto stageCreateInfo = programImpl->m_stageCreateInfos[i]; auto entryPointName = programImpl->m_entryPointNames[i]; - entryPointNameToIndex.Add(entryPointName, i); + entryPointNameToIndex.add(entryPointName, i); if (stageCreateInfo.stage & (VK_SHADER_STAGE_ANY_HIT_BIT_KHR | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_INTERSECTION_BIT_KHR)) @@ -380,7 +380,7 @@ Result RayTracingPipelineStateImpl::createVKRayTracingPipelineState() auto shaderGroupName = entryPointName; auto shaderGroupIndex = shaderGroupInfos.getCount(); shaderGroupInfos.add(shaderGroupInfo); - shaderGroupNameToIndex.Add(shaderGroupName, shaderGroupIndex); + shaderGroupNameToIndex.add(shaderGroupName, shaderGroupIndex); } for (int32_t i = 0; i < desc.rayTracing.hitGroupDescs.getCount(); ++i) @@ -404,7 +404,7 @@ Result RayTracingPipelineStateImpl::createVKRayTracingPipelineState() auto shaderGroupIndex = shaderGroupInfos.getCount(); shaderGroupInfos.add(shaderGroupInfo); - shaderGroupNameToIndex.Add(String(groupDesc.hitGroupName), shaderGroupIndex); + shaderGroupNameToIndex.add(String(groupDesc.hitGroupName), shaderGroupIndex); } raytracingPipelineInfo.groupCount = (uint32_t)shaderGroupInfos.getCount(); diff --git a/tools/gfx/vulkan/vk-shader-object-layout.cpp b/tools/gfx/vulkan/vk-shader-object-layout.cpp index e1d06c791..03dc1f11a 100644 --- a/tools/gfx/vulkan/vk-shader-object-layout.cpp +++ b/tools/gfx/vulkan/vk-shader-object-layout.cpp @@ -12,7 +12,7 @@ namespace vk Index ShaderObjectLayoutImpl::Builder::findOrAddDescriptorSet(Index space) { Index index; - if (m_mapSpaceToDescriptorSetIndex.TryGetValue(space, index)) + if (m_mapSpaceToDescriptorSetIndex.tryGetValue(space, index)) return index; DescriptorSetInfo info = {}; @@ -21,7 +21,7 @@ Index ShaderObjectLayoutImpl::Builder::findOrAddDescriptorSet(Index space) index = m_descriptorSetBuildInfos.getCount(); m_descriptorSetBuildInfos.add(info); - m_mapSpaceToDescriptorSetIndex.Add(space, index); + m_mapSpaceToDescriptorSetIndex.add(space, index); return index; } diff --git a/tools/gfx/vulkan/vk-shader-table.cpp b/tools/gfx/vulkan/vk-shader-table.cpp index a47750ddb..f40331432 100644 --- a/tools/gfx/vulkan/vk-shader-table.cpp +++ b/tools/gfx/vulkan/vk-shader-table.cpp @@ -77,7 +77,7 @@ RefPtr<BufferResource> ShaderTableImpl::createDeviceBuffer( auto dstHandlePtr = subTablePtr + i * rtProps.shaderGroupBaseAlignment; auto shaderGroupName = m_shaderGroupNames[shaderTableEntryCounter++]; auto shaderGroupIndexPtr = - pipelineImpl->shaderGroupNameToIndex.TryGetValue(shaderGroupName); + pipelineImpl->shaderGroupNameToIndex.tryGetValue(shaderGroupName); if (!shaderGroupIndexPtr) continue; @@ -93,7 +93,7 @@ RefPtr<BufferResource> ShaderTableImpl::createDeviceBuffer( auto dstHandlePtr = subTablePtr + i * handleSize; auto shaderGroupName = m_shaderGroupNames[shaderTableEntryCounter++]; auto shaderGroupIndexPtr = - pipelineImpl->shaderGroupNameToIndex.TryGetValue(shaderGroupName); + pipelineImpl->shaderGroupNameToIndex.tryGetValue(shaderGroupName); if (!shaderGroupIndexPtr) continue; @@ -108,7 +108,7 @@ RefPtr<BufferResource> ShaderTableImpl::createDeviceBuffer( auto dstHandlePtr = subTablePtr + i * handleSize; auto shaderGroupName = m_shaderGroupNames[shaderTableEntryCounter++]; auto shaderGroupIndexPtr = - pipelineImpl->shaderGroupNameToIndex.TryGetValue(shaderGroupName); + pipelineImpl->shaderGroupNameToIndex.tryGetValue(shaderGroupName); if (!shaderGroupIndexPtr) continue; diff --git a/tools/platform/linux/x11-key-code.cpp b/tools/platform/linux/x11-key-code.cpp index ce4e8945c..c078a6d1c 100644 --- a/tools/platform/linux/x11-key-code.cpp +++ b/tools/platform/linux/x11-key-code.cpp @@ -124,7 +124,7 @@ namespace platform KeyCode translateKeyCode(int keyCode) { KeyCode result = KeyCode::None; - keyCodeMap.TryGetValue(keyCode, result); + keyCodeMap.tryGetValue(keyCode, result); return result; } diff --git a/tools/platform/linux/x11-window.cpp b/tools/platform/linux/x11-window.cpp index 2721c00f3..be807ac33 100644 --- a/tools/platform/linux/x11-window.cpp +++ b/tools/platform/linux/x11-window.cpp @@ -179,7 +179,7 @@ public: { if (handle) { - X11AppContext::windows.Remove(handle); + X11AppContext::windows.remove(handle); XDestroyWindow(X11AppContext::xdisplay, handle); handle = 0; } @@ -382,7 +382,7 @@ void doEventsImpl(bool waitForEvents) else if (X11AppContext::keyStates[iKeyCode] == KeyState::Pressed) X11AppContext::keyStates[iKeyCode] = KeyState::Hold; } - if (X11AppContext::windows.TryGetValue(nextEvent.xkey.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xkey.window, sysWindow)) { wchar_t keyChar = getKeyChar(vKeyCode, nextEvent.xkey.state); sysWindow->handleKeyEvent(KeyEvent::Press, vKeyCode, keyChar, nextEvent.xkey.state); @@ -395,13 +395,13 @@ void doEventsImpl(bool waitForEvents) { X11AppContext::keyStates[iKeyCode] = KeyState::Released; } - if (X11AppContext::windows.TryGetValue(nextEvent.xkey.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xkey.window, sysWindow)) { sysWindow->handleKeyEvent(KeyEvent::Release, vKeyCode, 0, nextEvent.xkey.state); } break; case MotionNotify: - if (X11AppContext::windows.TryGetValue(nextEvent.xmotion.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xmotion.window, sysWindow)) { X11AppContext::currentMouseEventWindow = sysWindow; sysWindow->handleMouseEvent(MouseEvent::Move, nextEvent.xmotion.x, nextEvent.xmotion.y, 0, @@ -409,7 +409,7 @@ void doEventsImpl(bool waitForEvents) } break; case ButtonPress: - if (X11AppContext::windows.TryGetValue(nextEvent.xbutton.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xbutton.window, sysWindow)) { X11AppContext::currentMouseEventWindow = sysWindow; if (nextEvent.xbutton.button <= Button3) @@ -424,7 +424,7 @@ void doEventsImpl(bool waitForEvents) } break; case ButtonRelease: - if (X11AppContext::windows.TryGetValue(nextEvent.xbutton.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xbutton.window, sysWindow)) { X11AppContext::currentMouseEventWindow = sysWindow; sysWindow->handleMouseEvent(MouseEvent::Up, nextEvent.xbutton.x, nextEvent.xbutton.y, 0, @@ -432,19 +432,19 @@ void doEventsImpl(bool waitForEvents) } break; case ConfigureNotify: - if (X11AppContext::windows.TryGetValue(nextEvent.xconfigure.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xconfigure.window, sysWindow)) { sysWindow->handleResizeEvent(nextEvent.xconfigure.width, nextEvent.xconfigure.height); } break; case Expose: - if (X11AppContext::windows.TryGetValue(nextEvent.xexpose.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xexpose.window, sysWindow)) { sysWindow->handleExposeEvent(); } break; case ClientMessage: - if (X11AppContext::windows.TryGetValue(nextEvent.xclient.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xclient.window, sysWindow)) { Atom wmDelete = XInternAtom(X11AppContext::xdisplay, "WM_DELETE_WINDOW", True); if (nextEvent.xclient.data.l[0] == wmDelete) @@ -454,13 +454,13 @@ void doEventsImpl(bool waitForEvents) } break; case FocusIn: - if (X11AppContext::windows.TryGetValue(nextEvent.xfocus.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xfocus.window, sysWindow)) { sysWindow->handleFocus(true); } break; case FocusOut: - if (X11AppContext::windows.TryGetValue(nextEvent.xfocus.window, sysWindow)) + if (X11AppContext::windows.tryGetValue(nextEvent.xfocus.window, sysWindow)) { sysWindow->handleFocus(false); } diff --git a/tools/platform/windows/win-window.cpp b/tools/platform/windows/win-window.cpp index d785b0fb7..896bbd2c6 100644 --- a/tools/platform/windows/win-window.cpp +++ b/tools/platform/windows/win-window.cpp @@ -71,7 +71,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { bool useDefProc = true; Window* window = nullptr; - Win32AppContext::windows.TryGetValue(hWnd, window); + Win32AppContext::windows.tryGetValue(hWnd, window); switch (message) { case WM_LBUTTONUP: @@ -400,7 +400,7 @@ public: { if (handle) { - Win32AppContext::windows.Remove(handle); + Win32AppContext::windows.remove(handle); } DestroyWindow(handle); handle = NULL; diff --git a/tools/slang-cpp-extractor/identifier-lookup.cpp b/tools/slang-cpp-extractor/identifier-lookup.cpp index c429a29a4..6b60f573c 100644 --- a/tools/slang-cpp-extractor/identifier-lookup.cpp +++ b/tools/slang-cpp-extractor/identifier-lookup.cpp @@ -96,7 +96,7 @@ void IdentifierLookup::initDefault(const UnownedStringSlice& markPrefix) StringBuilder buf; for (Index i = 0; i < SLANG_COUNT_OF(names); ++i) { - buf.Clear(); + buf.clear(); buf << markPrefix << names[i]; set(buf.getUnownedSlice(), styles[i]); } diff --git a/tools/slang-cpp-extractor/node.cpp b/tools/slang-cpp-extractor/node.cpp index 3fbbf9c56..b606e4edf 100644 --- a/tools/slang-cpp-extractor/node.cpp +++ b/tools/slang-cpp-extractor/node.cpp @@ -156,7 +156,7 @@ void Node::calcAbsoluteName(StringBuilder& outName) const EnumNode* enumNode = as<EnumNode>(node); if (enumNode && enumNode->m_kind == Node::Kind::Enum) { - Node** nodePtr = enumNode->m_childMap.TryGetValue(name); + Node** nodePtr = enumNode->m_childMap.tryGetValue(name); if (nodePtr) { return *nodePtr; @@ -310,13 +310,13 @@ void ScopeNode::addChild(Node* child) if (child->m_name.hasContent()) { - m_childMap.Add(child->m_name.getContent(), child); + m_childMap.add(child->m_name.getContent(), child); } } Node* ScopeNode::findChild(const UnownedStringSlice& name) const { - Node** nodePtr = m_childMap.TryGetValue(name); + Node** nodePtr = m_childMap.tryGetValue(name); if (nodePtr) { return *nodePtr; diff --git a/tools/slang-embed/slang-embed.cpp b/tools/slang-embed/slang-embed.cpp index 7fb865eee..d3936af71 100644 --- a/tools/slang-embed/slang-embed.cpp +++ b/tools/slang-embed/slang-embed.cpp @@ -93,7 +93,7 @@ struct App String canonicalPath; if (SLANG_SUCCEEDED(Slang::Path::getCanonical(inputPath, canonicalPath))) { - if (!includedFiles.Add(canonicalPath)) + if (!includedFiles.add(canonicalPath)) return; } diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index ab0d3a01e..9989d8164 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -17,13 +17,13 @@ TestCategory* TestCategorySet::add(String const& name, TestCategory* parent) category->name = name; category->parent = parent; - m_categoryMap.Add(name, category); + m_categoryMap.add(name, category); return category; } TestCategory* TestCategorySet::find(String const& name) { - if (auto category = m_categoryMap.TryGetValue(name)) + if (auto category = m_categoryMap.tryGetValue(name)) { return category->Ptr(); } @@ -239,7 +239,7 @@ static bool _isSubCommand(const char* arg) auto category = categorySet->findOrError(*argCursor++); if (category) { - optionsOut->includeCategories.Add(category, category); + optionsOut->includeCategories.add(category, category); } } else if (strcmp(arg, "-exclude") == 0) @@ -252,7 +252,7 @@ static bool _isSubCommand(const char* arg) auto category = categorySet->findOrError(*argCursor++); if (category) { - optionsOut->excludeCategories.Add(category, category); + optionsOut->excludeCategories.add(category, category); } } else if (strcmp(arg, "-api") == 0) diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 739ea840e..94329831b 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -82,11 +82,11 @@ struct TestOptions // Small helper to help consistently interrogating for filecheck usage bool getFileCheckPrefix(String& prefix) const { - return commandOptions.TryGetValue("filecheck", prefix); + return commandOptions.tryGetValue("filecheck", prefix); } bool getFileCheckBufferPrefix(String& prefix) const { - return commandOptions.TryGetValue("filecheck-buffer", prefix); + return commandOptions.tryGetValue("filecheck-buffer", prefix); } Type type = Type::Normal; @@ -160,7 +160,7 @@ static SlangResult _readTestFile(const TestInput& input, const String& suffix, S return r; } - buf.Clear(); + buf.clear(); buf << input.filePath << suffix; return Slang::File::readAllText(buf, out); } @@ -335,11 +335,11 @@ static SlangResult _parseCommandArguments(char const** ioCursor, TestOptions& ou auto i = option.indexOf('='); if(i == -1) { - out.commandOptions.Add(option.trim(), ""); + out.commandOptions.add(option.trim(), ""); } else { - out.commandOptions.Add(option.head(i).trim(), option.tail(i+1).trim()); + out.commandOptions.add(option.head(i).trim(), option.tail(i+1).trim()); } } } @@ -1345,7 +1345,7 @@ String findExpectedPath(const TestInput& input, const char* postFix) // Try the default name StringBuilder defaultBuf; - defaultBuf.Clear(); + defaultBuf.clear(); defaultBuf << input.filePath; if (postFix) { @@ -3610,7 +3610,7 @@ bool testCategoryMatches( { for( auto item : categorySet ) { - if(testCategoryMatches(categoryToMatch, item.Value)) + if(testCategoryMatches(categoryToMatch, item.value)) return true; } return false; @@ -4381,15 +4381,15 @@ SlangResult innerMain(int argc, char** argv) return func(StdWriters::getSingleton(), context.getSession(), int(args.getCount()), args.getBuffer()); } - if( options.includeCategories.Count() == 0 ) + if( options.includeCategories.getCount() == 0 ) { - options.includeCategories.Add(fullTestCategory, fullTestCategory); + options.includeCategories.add(fullTestCategory, fullTestCategory); } // Don't include OptiX tests unless the client has explicit opted into them. - if( !options.includeCategories.ContainsKey(optixTestCategory) ) + if( !options.includeCategories.containsKey(optixTestCategory) ) { - options.excludeCategories.Add(optixTestCategory, optixTestCategory); + options.excludeCategories.add(optixTestCategory, optixTestCategory); } // Exclude rendering tests when building under AppVeyor. @@ -4397,8 +4397,8 @@ SlangResult innerMain(int argc, char** argv) // TODO: this is very ad hoc, and we should do something cleaner. if( options.outputMode == TestOutputMode::AppVeyor ) { - options.excludeCategories.Add(renderTestCategory, renderTestCategory); - options.excludeCategories.Add(vulkanTestCategory, vulkanTestCategory); + options.excludeCategories.add(renderTestCategory, renderTestCategory); + options.excludeCategories.add(vulkanTestCategory, vulkanTestCategory); } { diff --git a/tools/slang-test/test-context.cpp b/tools/slang-test/test-context.cpp index 15b07444c..e0f2749b9 100644 --- a/tools/slang-test/test-context.cpp +++ b/tools/slang-test/test-context.cpp @@ -111,7 +111,7 @@ TestContext::~TestContext() TestContext::InnerMainFunc TestContext::getInnerMainFunc(const String& dirPath, const String& name) { { - SharedLibraryTool* tool = m_sharedLibTools.TryGetValue(name); + SharedLibraryTool* tool = m_sharedLibTools.tryGetValue(name); if (tool) { return tool->m_func; @@ -135,13 +135,13 @@ TestContext::InnerMainFunc TestContext::getInnerMainFunc(const String& dirPath, tool.m_func = (InnerMainFunc)tool.m_sharedLibrary->findFuncByName("innerMain"); } - m_sharedLibTools.Add(name, tool); + m_sharedLibTools.add(name, tool); return tool.m_func; } void TestContext::setInnerMainFunc(const String& name, InnerMainFunc func) { - SharedLibraryTool* tool = m_sharedLibTools.TryGetValue(name); + SharedLibraryTool* tool = m_sharedLibTools.tryGetValue(name); if (tool) { tool->m_sharedLibrary.setNull(); @@ -151,7 +151,7 @@ void TestContext::setInnerMainFunc(const String& name, InnerMainFunc func) { SharedLibraryTool tool = {}; tool.m_func = func; - m_sharedLibTools.Add(name, tool); + m_sharedLibTools.add(name, tool); } } diff --git a/tools/slang-test/test-reporter.cpp b/tools/slang-test/test-reporter.cpp index b2d0d1a54..2d252ebed 100644 --- a/tools/slang-test/test-reporter.cpp +++ b/tools/slang-test/test-reporter.cpp @@ -121,7 +121,7 @@ void TestReporter::startTest(const char* testName) m_currentInfo = TestInfo(); m_currentInfo.name = testName; - m_currentMessage.Clear(); + m_currentMessage.clear(); } void TestReporter::endTest() diff --git a/tools/slang-unit-test/unit-test-process.cpp b/tools/slang-unit-test/unit-test-process.cpp index 839a19f5d..d24120716 100644 --- a/tools/slang-unit-test/unit-test-process.cpp +++ b/tools/slang-unit-test/unit-test-process.cpp @@ -102,7 +102,7 @@ static SlangResult _countTest(UnitTestContext* context, Index size, Index crashI if (crashIndex >= 0) { - buf.Clear(); + buf.clear(); buf << crashIndex; args.add(buf); } diff --git a/tools/slang-unit-test/unit-test-string.cpp b/tools/slang-unit-test/unit-test-string.cpp index 629ed2373..230cb72f8 100644 --- a/tools/slang-unit-test/unit-test-string.cpp +++ b/tools/slang-unit-test/unit-test-string.cpp @@ -159,13 +159,13 @@ SLANG_UNIT_TEST(string) StringBuilder builder; { - builder.Clear(); + builder.clear(); StringUtil::join(values, 0, ',', builder); SLANG_CHECK(builder == ""); } { - builder.Clear(); + builder.clear(); StringUtil::join(values, 1, ',', builder); SLANG_CHECK(builder == "hello"); @@ -174,7 +174,7 @@ SLANG_UNIT_TEST(string) } { - builder.Clear(); + builder.clear(); StringUtil::join(values, 2, ',', builder); SLANG_CHECK(builder == "hello,world"); @@ -183,7 +183,7 @@ SLANG_UNIT_TEST(string) } { - builder.Clear(); + builder.clear(); StringUtil::join(values, 3, UnownedStringSlice("ab"), builder); SLANG_CHECK(builder == "helloabworldab!"); @@ -212,7 +212,7 @@ SLANG_UNIT_TEST(string) for (auto value : values) { - buf.Clear(); + buf.clear(); _append(value, buf); UnownedStringSlice slice = buf.getUnownedSlice(); @@ -244,7 +244,7 @@ SLANG_UNIT_TEST(string) for (auto value : values) { - buf.Clear(); + buf.clear(); buf << value; diff --git a/tools/test-process/test-process-main.cpp b/tools/test-process/test-process-main.cpp index 4e40a954e..852b58cef 100644 --- a/tools/test-process/test-process-main.cpp +++ b/tools/test-process/test-process-main.cpp @@ -49,7 +49,7 @@ static SlangResult _outputCount(int argc, const char* const* argv) StringBuilder buf; for (Index i = 0; i < count; ++i) { - buf.Clear(); + buf.clear(); buf << i << "\n"; fwrite(buf.getBuffer(), 1, buf.getLength(), fileOut); diff --git a/tools/test-server/test-server-main.cpp b/tools/test-server/test-server-main.cpp index 77951d3d3..904a8db20 100644 --- a/tools/test-server/test-server-main.cpp +++ b/tools/test-server/test-server-main.cpp @@ -187,7 +187,7 @@ TestServer::~TestServer() { for (auto& pair : m_unitTestModules) { - pair.Value->destroy(); + pair.value->destroy(); } } @@ -209,7 +209,7 @@ slang::IGlobalSession* TestServer::getOrCreateGlobalSession() ISlangSharedLibrary* TestServer::loadSharedLibrary(const String& name, DiagnosticSink* sink) { ComPtr<ISlangSharedLibrary> lib; - if (m_sharedLibraryMap.TryGetValue(name, lib)) + if (m_sharedLibraryMap.tryGetValue(name, lib)) { return lib; } @@ -229,13 +229,13 @@ ISlangSharedLibrary* TestServer::loadSharedLibrary(const String& name, Diagnosti return nullptr; } - m_sharedLibraryMap.Add(name, sharedLibrary); + m_sharedLibraryMap.add(name, sharedLibrary); return sharedLibrary; } IUnitTestModule* TestServer::getUnitTestModule(const String& name, DiagnosticSink* sink) { - auto unitTestModulePtr = m_unitTestModules.TryGetValue(name); + auto unitTestModulePtr = m_unitTestModules.tryGetValue(name); if (unitTestModulePtr) { return *unitTestModulePtr; @@ -270,7 +270,7 @@ IUnitTestModule* TestServer::getUnitTestModule(const String& name, DiagnosticSin return nullptr; } - m_unitTestModules.Add(name, testModule); + m_unitTestModules.add(name, testModule); return testModule; } |
