MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / addForLoop

Method addForLoop

glslang/MachineIndependent/Intermediate.cpp:2677–2694  ·  view source on GitHub ↗

Create a for-loop sequence.

Source from the content-addressed store, hash-verified

2675// Create a for-loop sequence.
2676//
2677TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermNode* test,
2678 TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TIntermLoop*& node)
2679{
2680 node = new TIntermLoop(body, test, terminal, testFirst);
2681 node->setLoc(loc);
2682
2683 // make a sequence of the initializer and statement, but try to reuse the
2684 // aggregate already created for whatever is in the initializer, if there is one
2685 TIntermAggregate* loopSequence = (initializer == nullptr ||
2686 initializer->getAsAggregate() == nullptr) ? makeAggregate(initializer, loc)
2687 : initializer->getAsAggregate();
2688 if (loopSequence != nullptr && (loopSequence->getOp() == EOpSequence || loopSequence->getOp() == EOpScope))
2689 loopSequence->setOp(EOpNull);
2690 loopSequence = growAggregate(loopSequence, node);
2691 loopSequence->setOperator(getDebugInfo() ? EOpScope : EOpSequence);
2692
2693 return loopSequence;
2694}
2695
2696//
2697// Add branches.

Callers 1

Calls 5

setLocMethod · 0.80
getOpMethod · 0.80
setOpMethod · 0.80
setOperatorMethod · 0.80
getAsAggregateMethod · 0.45

Tested by

no test coverage detected