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-ir-lower-reinterpret.cpp | 48 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'source/slang/slang-ir-lower-reinterpret.cpp') diff --git a/source/slang/slang-ir-lower-reinterpret.cpp b/source/slang/slang-ir-lower-reinterpret.cpp index 34d4b77d9..9dd31aa4d 100644 --- a/source/slang/slang-ir-lower-reinterpret.cpp +++ b/source/slang/slang-ir-lower-reinterpret.cpp @@ -1,9 +1,10 @@ #include "slang-ir-lower-reinterpret.h" -#include "slang-ir.h" + +#include "slang-ir-any-value-inference.h" +#include "slang-ir-any-value-marshalling.h" #include "slang-ir-insts.h" #include "slang-ir-layout.h" -#include "slang-ir-any-value-marshalling.h" -#include "slang-ir-any-value-inference.h" +#include "slang-ir.h" namespace Slang { @@ -27,11 +28,8 @@ struct ReinterpretLoweringContext { switch (inst->getOp()) { - case kIROp_Reinterpret: - processReinterpret(inst); - break; - default: - break; + case kIROp_Reinterpret: processReinterpret(inst); break; + default: break; } } @@ -64,27 +62,37 @@ struct ReinterpretLoweringContext if (fromTypeSize < 0) { cantPack = true; - sink->diagnose(inst->sourceLoc, Slang::Diagnostics::typeCannotBePackedIntoAnyValue, fromType); + sink->diagnose( + inst->sourceLoc, + Slang::Diagnostics::typeCannotBePackedIntoAnyValue, + fromType); } SlangInt toTypeSize = getAnyValueSize(toType); if (toTypeSize < 0) { cantPack = true; - sink->diagnose(inst->sourceLoc, Slang::Diagnostics::typeCannotBePackedIntoAnyValue, toType); + sink->diagnose( + inst->sourceLoc, + Slang::Diagnostics::typeCannotBePackedIntoAnyValue, + toType); } - if (fromTypeSize != toTypeSize - && cantPack == false) + if (fromTypeSize != toTypeSize && cantPack == false) { - sink->diagnose(inst->sourceLoc, Slang::Diagnostics::notEqualReinterpretCastSize, fromType, fromTypeSize, toType, toTypeSize); + sink->diagnose( + inst->sourceLoc, + Slang::Diagnostics::notEqualReinterpretCastSize, + fromType, + fromTypeSize, + toType, + toTypeSize); } SlangInt anyValueSize = Math::Max(fromTypeSize, toTypeSize); IRBuilder builder(module); builder.setInsertBefore(inst); - auto anyValueType = builder.getAnyValueType(builder.getIntValue(builder.getUIntType(), anyValueSize)); - auto packInst = builder.emitPackAnyValue( - anyValueType, - operand); + auto anyValueType = + builder.getAnyValueType(builder.getIntValue(builder.getUIntType(), anyValueSize)); + auto packInst = builder.emitPackAnyValue(anyValueType, operand); auto unpackInst = builder.emitUnpackAnyValue(toType, packInst); inst->replaceUsesWith(unpackInst); inst->removeAndDeallocate(); @@ -93,9 +101,9 @@ struct ReinterpretLoweringContext void lowerReinterpret(TargetProgram* target, IRModule* module, DiagnosticSink* sink) { - // Before processing reinterpret insts, ensure that existential types without + // Before processing reinterpret insts, ensure that existential types without // user-defined sizes have inferred sizes where possible. - // + // inferAnyValueSizeWhereNecessary(target, module); ReinterpretLoweringContext context; @@ -105,4 +113,4 @@ void lowerReinterpret(TargetProgram* target, IRModule* module, DiagnosticSink* s context.processModule(); } -} +} // namespace Slang -- cgit v1.2.3