Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code for PR #5525 #3

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions source/slang/slang-ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ struct IRInst
template<typename T>
T* getNextChildOfType(IRInst* child = nullptr)
{
for (IRInst* cc = child ? child->getNextInst() : getFirstDecorationOrChild(); cc != nullptr; cc = cc->getNextInst())
for (IRInst* cc = child ? child->getNextInst() : getFirstDecorationOrChild(); cc != nullptr;
cc = cc->getNextInst())
{
if (T* cct = as<T>(cc))
return cct;
Expand Down Expand Up @@ -792,10 +793,11 @@ struct IRInst
void removeOperand(Index index);

/// Transfer any decorations of this instruction to the `target` instruction.
// TODO: rewrite as transferDecorationsTo(target) -> transferChildrenOfTypeTo<IRDecoration>(target)
// TODO: rewrite as transferDecorationsTo(target) ->
// transferChildrenOfTypeTo<IRDecoration>(target)
void transferDecorationsTo(IRInst* target);

template <typename T>
template<typename T>
void transferChildrenOfTypeTo(IRInst* target)
{
for (T* cc = getNextChildOfType<T>(); cc != nullptr; cc = getNextChildOfType<T>(cc))
Expand Down
6 changes: 4 additions & 2 deletions source/slang/slang-legalize-types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,11 @@ struct TupleTypeBuilder

// TODO: shallow clone of modifiers, etc.
IRStructField* originalField = findStructField(originalStructType, ee.fieldKey);
IRStructField* newField = builder->createStructField(ordinaryStructType, ee.fieldKey, fieldType);
IRStructField* newField =
builder->createStructField(ordinaryStructType, ee.fieldKey, fieldType);
// In case the original struct had offsets calculated, transfer those as well.
// The original offsets should still be valid, since we only skip fields of types that aren't representable in memory.
// The original offsets should still be valid, since we only skip fields of types
// that aren't representable in memory.
originalField->transferChildrenOfTypeTo<IROffsetDecoration>(newField);
}

Expand Down
Loading