From f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 29 Oct 2024 14:49:26 +0800 Subject: format * format * Minor test fixes * enable checking cpp format in ci --- source/slang/slang-serialize-reflection.cpp | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'source/slang/slang-serialize-reflection.cpp') diff --git a/source/slang/slang-serialize-reflection.cpp b/source/slang/slang-serialize-reflection.cpp index 434d4b90e..60ab31e17 100644 --- a/source/slang/slang-serialize-reflection.cpp +++ b/source/slang/slang-serialize-reflection.cpp @@ -3,7 +3,8 @@ #include "slang-serialize.h" -namespace Slang { +namespace Slang +{ bool ReflectClassInfo::isSubClassOfSlow(const ThisType& super) const { @@ -40,7 +41,10 @@ static bool _checkSubClassRange(ReflectClassInfo*const* typeInfos, Index typeInf #endif -static uint32_t _calcRangeRec(ReflectClassInfo* classInfo, const Dictionary >& childMap, uint32_t index) +static uint32_t _calcRangeRec( + ReflectClassInfo* classInfo, + const Dictionary>& childMap, + uint32_t index) { classInfo->m_classId = index++; // Do the calc range for all the children @@ -68,29 +72,35 @@ static ReflectClassInfo* _calcRoot(ReflectClassInfo* classInfo) } -/* static */void ReflectClassInfo::calcClassIdHierachy(uint32_t baseIndex, ReflectClassInfo*const* typeInfos, Index typeInfosCount) +/* static */ void ReflectClassInfo::calcClassIdHierachy( + uint32_t baseIndex, + ReflectClassInfo* const* typeInfos, + Index typeInfosCount) { SLANG_ASSERT(typeInfosCount > 0); // TODO(JS): - // Note that the calculating of the ranges could be done more efficiently by adding to an array of struct { super, class }, sorting, by super classs - // and using a dictionary to map from class it's first in list of super class use. This works for now though. + // Note that the calculating of the ranges could be done more efficiently by adding to an array + // of struct { super, class }, sorting, by super classs and using a dictionary to map from class + // it's first in list of super class use. This works for now though. - // The root cannot be shared with another hierarchy - as doing so will mean that the range will be incorrect (it would need to span both trees) + // The root cannot be shared with another hierarchy - as doing so will mean that the range will + // be incorrect (it would need to span both trees) ReflectClassInfo* root = _calcRoot(typeInfos[0]); // We want to produce a map from a node that holds all of it's children - Dictionary > childMap; + Dictionary> childMap; const List emptyList; { - for (Index i = 0; i < typeInfosCount; ++ i) + for (Index i = 0; i < typeInfosCount; ++i) { auto typeInfo = typeInfos[i]; if (typeInfo->m_superClass) { // Add to that item - List* list = childMap.tryGetValueOrAdd(typeInfo->m_superClass, emptyList); + List* list = + childMap.tryGetValueOrAdd(typeInfo->m_superClass, emptyList); if (!list) { list = childMap.tryGetValue(typeInfo->m_superClass); @@ -107,7 +117,7 @@ static ReflectClassInfo* _calcRoot(ReflectClassInfo* classInfo) // We want to recursively work out a range _calcRangeRec(root, childMap, baseIndex); - //SLANG_ASSERT(_checkSubClassRange(typeInfos, typeInfoCount)); + // SLANG_ASSERT(_checkSubClassRange(typeInfos, typeInfoCount)); } } // namespace Slang -- cgit v1.2.3