Fix up translator style.
Using git cl format.
BUG=angleproject:650
Change-Id: I7d3f98d2b0dcfb0a8de6c35327db74e55c28d761
Reviewed-on: https://chromium-review.googlesource.com/419059
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/intermOut.cpp b/src/compiler/translator/intermOut.cpp
index 53ee1d0..1959060 100644
--- a/src/compiler/translator/intermOut.cpp
+++ b/src/compiler/translator/intermOut.cpp
@@ -36,12 +36,8 @@
class TOutputTraverser : public TIntermTraverser
{
public:
- TOutputTraverser(TInfoSinkBase &i)
- : TIntermTraverser(true, false, false),
- sink(i)
- {
- }
- TInfoSinkBase& sink;
+ TOutputTraverser(TInfoSinkBase &i) : TIntermTraverser(true, false, false), sink(i) {}
+ TInfoSinkBase &sink;
protected:
void visitSymbol(TIntermSymbol *) override;
@@ -103,7 +99,7 @@
bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
{
- TInfoSinkBase& out = sink;
+ TInfoSinkBase &out = sink;
OutputTreeText(out, node, mDepth);
@@ -260,8 +256,7 @@
// Special handling for direct indexes. Because constant
// unions are not aware they are struct indexes, treat them
// here where we have that contextual knowledge.
- if (node->getOp() == EOpIndexDirectStruct ||
- node->getOp() == EOpIndexDirectInterfaceBlock)
+ if (node->getOp() == EOpIndexDirectStruct || node->getOp() == EOpIndexDirectInterfaceBlock)
{
mDepth++;
node->getLeft()->traverse(this);
@@ -273,8 +268,8 @@
OutputTreeText(out, intermConstantUnion, mDepth + 1);
// The following code finds the field name from the constant union
- const TConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
- const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
+ const TStructure *structure = node->getLeft()->getType().getStruct();
const TInterfaceBlock *interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
ASSERT(structure || interfaceBlock);
@@ -292,86 +287,196 @@
bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node)
{
- TInfoSinkBase& out = sink;
+ TInfoSinkBase &out = sink;
OutputTreeText(out, node, mDepth);
switch (node->getOp())
{
- case EOpNegative: out << "Negate value"; break;
- case EOpPositive: out << "Positive sign"; break;
- case EOpVectorLogicalNot:
- case EOpLogicalNot: out << "Negate conditional"; break;
- case EOpBitwiseNot: out << "bit-wise not"; break;
+ case EOpNegative:
+ out << "Negate value";
+ break;
+ case EOpPositive:
+ out << "Positive sign";
+ break;
+ case EOpVectorLogicalNot:
+ case EOpLogicalNot:
+ out << "Negate conditional";
+ break;
+ case EOpBitwiseNot:
+ out << "bit-wise not";
+ break;
- case EOpPostIncrement: out << "Post-Increment"; break;
- case EOpPostDecrement: out << "Post-Decrement"; break;
- case EOpPreIncrement: out << "Pre-Increment"; break;
- case EOpPreDecrement: out << "Pre-Decrement"; break;
+ case EOpPostIncrement:
+ out << "Post-Increment";
+ break;
+ case EOpPostDecrement:
+ out << "Post-Decrement";
+ break;
+ case EOpPreIncrement:
+ out << "Pre-Increment";
+ break;
+ case EOpPreDecrement:
+ out << "Pre-Decrement";
+ break;
- case EOpRadians: out << "radians"; break;
- case EOpDegrees: out << "degrees"; break;
- case EOpSin: out << "sine"; break;
- case EOpCos: out << "cosine"; break;
- case EOpTan: out << "tangent"; break;
- case EOpAsin: out << "arc sine"; break;
- case EOpAcos: out << "arc cosine"; break;
- case EOpAtan: out << "arc tangent"; break;
+ case EOpRadians:
+ out << "radians";
+ break;
+ case EOpDegrees:
+ out << "degrees";
+ break;
+ case EOpSin:
+ out << "sine";
+ break;
+ case EOpCos:
+ out << "cosine";
+ break;
+ case EOpTan:
+ out << "tangent";
+ break;
+ case EOpAsin:
+ out << "arc sine";
+ break;
+ case EOpAcos:
+ out << "arc cosine";
+ break;
+ case EOpAtan:
+ out << "arc tangent";
+ break;
- case EOpSinh: out << "hyperbolic sine"; break;
- case EOpCosh: out << "hyperbolic cosine"; break;
- case EOpTanh: out << "hyperbolic tangent"; break;
- case EOpAsinh: out << "arc hyperbolic sine"; break;
- case EOpAcosh: out << "arc hyperbolic cosine"; break;
- case EOpAtanh: out << "arc hyperbolic tangent"; break;
+ case EOpSinh:
+ out << "hyperbolic sine";
+ break;
+ case EOpCosh:
+ out << "hyperbolic cosine";
+ break;
+ case EOpTanh:
+ out << "hyperbolic tangent";
+ break;
+ case EOpAsinh:
+ out << "arc hyperbolic sine";
+ break;
+ case EOpAcosh:
+ out << "arc hyperbolic cosine";
+ break;
+ case EOpAtanh:
+ out << "arc hyperbolic tangent";
+ break;
- case EOpExp: out << "exp"; break;
- case EOpLog: out << "log"; break;
- case EOpExp2: out << "exp2"; break;
- case EOpLog2: out << "log2"; break;
- case EOpSqrt: out << "sqrt"; break;
- case EOpInverseSqrt: out << "inverse sqrt"; break;
+ case EOpExp:
+ out << "exp";
+ break;
+ case EOpLog:
+ out << "log";
+ break;
+ case EOpExp2:
+ out << "exp2";
+ break;
+ case EOpLog2:
+ out << "log2";
+ break;
+ case EOpSqrt:
+ out << "sqrt";
+ break;
+ case EOpInverseSqrt:
+ out << "inverse sqrt";
+ break;
- case EOpAbs: out << "Absolute value"; break;
- case EOpSign: out << "Sign"; break;
- case EOpFloor: out << "Floor"; break;
- case EOpTrunc: out << "Truncate"; break;
- case EOpRound: out << "Round"; break;
- case EOpRoundEven: out << "Round half even"; break;
- case EOpCeil: out << "Ceiling"; break;
- case EOpFract: out << "Fraction"; break;
- case EOpIsNan: out << "Is not a number"; break;
- case EOpIsInf: out << "Is infinity"; break;
+ case EOpAbs:
+ out << "Absolute value";
+ break;
+ case EOpSign:
+ out << "Sign";
+ break;
+ case EOpFloor:
+ out << "Floor";
+ break;
+ case EOpTrunc:
+ out << "Truncate";
+ break;
+ case EOpRound:
+ out << "Round";
+ break;
+ case EOpRoundEven:
+ out << "Round half even";
+ break;
+ case EOpCeil:
+ out << "Ceiling";
+ break;
+ case EOpFract:
+ out << "Fraction";
+ break;
+ case EOpIsNan:
+ out << "Is not a number";
+ break;
+ case EOpIsInf:
+ out << "Is infinity";
+ break;
- case EOpFloatBitsToInt: out << "float bits to int"; break;
- case EOpFloatBitsToUint: out << "float bits to uint"; break;
- case EOpIntBitsToFloat: out << "int bits to float"; break;
- case EOpUintBitsToFloat: out << "uint bits to float"; break;
+ case EOpFloatBitsToInt:
+ out << "float bits to int";
+ break;
+ case EOpFloatBitsToUint:
+ out << "float bits to uint";
+ break;
+ case EOpIntBitsToFloat:
+ out << "int bits to float";
+ break;
+ case EOpUintBitsToFloat:
+ out << "uint bits to float";
+ break;
- case EOpPackSnorm2x16: out << "pack Snorm 2x16"; break;
- case EOpPackUnorm2x16: out << "pack Unorm 2x16"; break;
- case EOpPackHalf2x16: out << "pack half 2x16"; break;
+ case EOpPackSnorm2x16:
+ out << "pack Snorm 2x16";
+ break;
+ case EOpPackUnorm2x16:
+ out << "pack Unorm 2x16";
+ break;
+ case EOpPackHalf2x16:
+ out << "pack half 2x16";
+ break;
- case EOpUnpackSnorm2x16: out << "unpack Snorm 2x16"; break;
- case EOpUnpackUnorm2x16: out << "unpack Unorm 2x16"; break;
- case EOpUnpackHalf2x16: out << "unpack half 2x16"; break;
+ case EOpUnpackSnorm2x16:
+ out << "unpack Snorm 2x16";
+ break;
+ case EOpUnpackUnorm2x16:
+ out << "unpack Unorm 2x16";
+ break;
+ case EOpUnpackHalf2x16:
+ out << "unpack half 2x16";
+ break;
- case EOpLength: out << "length"; break;
- case EOpNormalize: out << "normalize"; break;
- // case EOpDPdx: out << "dPdx"; break;
- // case EOpDPdy: out << "dPdy"; break;
- // case EOpFwidth: out << "fwidth"; break;
+ case EOpLength:
+ out << "length";
+ break;
+ case EOpNormalize:
+ out << "normalize";
+ break;
+ // case EOpDPdx: out << "dPdx"; break;
+ // case EOpDPdy: out << "dPdy"; break;
+ // case EOpFwidth: out << "fwidth"; break;
- case EOpDeterminant: out << "determinant"; break;
- case EOpTranspose: out << "transpose"; break;
- case EOpInverse: out << "inverse"; break;
+ case EOpDeterminant:
+ out << "determinant";
+ break;
+ case EOpTranspose:
+ out << "transpose";
+ break;
+ case EOpInverse:
+ out << "inverse";
+ break;
- case EOpAny: out << "any"; break;
- case EOpAll: out << "all"; break;
+ case EOpAny:
+ out << "any";
+ break;
+ case EOpAll:
+ out << "all";
+ break;
- default:
- out.prefix(EPrefixError);
- out << "Bad unary op";
+ default:
+ out.prefix(EPrefixError);
+ out << "Bad unary op";
}
out << " (" << node->getCompleteString() << ")";
@@ -403,79 +508,182 @@
return true;
}
-
switch (node->getOp())
{
- case EOpFunctionCall:
- OutputFunction(out, "Function Call", node->getFunctionSymbolInfo());
- break;
- case EOpParameters: out << "Function Parameters: "; break;
- case EOpPrototype:
- OutputFunction(out, "Function Prototype", node->getFunctionSymbolInfo());
- break;
+ case EOpFunctionCall:
+ OutputFunction(out, "Function Call", node->getFunctionSymbolInfo());
+ break;
+ case EOpParameters:
+ out << "Function Parameters: ";
+ break;
+ case EOpPrototype:
+ OutputFunction(out, "Function Prototype", node->getFunctionSymbolInfo());
+ break;
- case EOpConstructFloat: out << "Construct float"; break;
- case EOpConstructVec2: out << "Construct vec2"; break;
- case EOpConstructVec3: out << "Construct vec3"; break;
- case EOpConstructVec4: out << "Construct vec4"; break;
- case EOpConstructBool: out << "Construct bool"; break;
- case EOpConstructBVec2: out << "Construct bvec2"; break;
- case EOpConstructBVec3: out << "Construct bvec3"; break;
- case EOpConstructBVec4: out << "Construct bvec4"; break;
- case EOpConstructInt: out << "Construct int"; break;
- case EOpConstructIVec2: out << "Construct ivec2"; break;
- case EOpConstructIVec3: out << "Construct ivec3"; break;
- case EOpConstructIVec4: out << "Construct ivec4"; break;
- case EOpConstructUInt: out << "Construct uint"; break;
- case EOpConstructUVec2: out << "Construct uvec2"; break;
- case EOpConstructUVec3: out << "Construct uvec3"; break;
- case EOpConstructUVec4: out << "Construct uvec4"; break;
- case EOpConstructMat2: out << "Construct mat2"; break;
- case EOpConstructMat2x3: out << "Construct mat2x3"; break;
- case EOpConstructMat2x4: out << "Construct mat2x4"; break;
- case EOpConstructMat3x2: out << "Construct mat3x2"; break;
- case EOpConstructMat3: out << "Construct mat3"; break;
- case EOpConstructMat3x4: out << "Construct mat3x4"; break;
- case EOpConstructMat4x2: out << "Construct mat4x2"; break;
- case EOpConstructMat4x3: out << "Construct mat4x3"; break;
- case EOpConstructMat4: out << "Construct mat4"; break;
- case EOpConstructStruct: out << "Construct structure"; break;
+ case EOpConstructFloat:
+ out << "Construct float";
+ break;
+ case EOpConstructVec2:
+ out << "Construct vec2";
+ break;
+ case EOpConstructVec3:
+ out << "Construct vec3";
+ break;
+ case EOpConstructVec4:
+ out << "Construct vec4";
+ break;
+ case EOpConstructBool:
+ out << "Construct bool";
+ break;
+ case EOpConstructBVec2:
+ out << "Construct bvec2";
+ break;
+ case EOpConstructBVec3:
+ out << "Construct bvec3";
+ break;
+ case EOpConstructBVec4:
+ out << "Construct bvec4";
+ break;
+ case EOpConstructInt:
+ out << "Construct int";
+ break;
+ case EOpConstructIVec2:
+ out << "Construct ivec2";
+ break;
+ case EOpConstructIVec3:
+ out << "Construct ivec3";
+ break;
+ case EOpConstructIVec4:
+ out << "Construct ivec4";
+ break;
+ case EOpConstructUInt:
+ out << "Construct uint";
+ break;
+ case EOpConstructUVec2:
+ out << "Construct uvec2";
+ break;
+ case EOpConstructUVec3:
+ out << "Construct uvec3";
+ break;
+ case EOpConstructUVec4:
+ out << "Construct uvec4";
+ break;
+ case EOpConstructMat2:
+ out << "Construct mat2";
+ break;
+ case EOpConstructMat2x3:
+ out << "Construct mat2x3";
+ break;
+ case EOpConstructMat2x4:
+ out << "Construct mat2x4";
+ break;
+ case EOpConstructMat3x2:
+ out << "Construct mat3x2";
+ break;
+ case EOpConstructMat3:
+ out << "Construct mat3";
+ break;
+ case EOpConstructMat3x4:
+ out << "Construct mat3x4";
+ break;
+ case EOpConstructMat4x2:
+ out << "Construct mat4x2";
+ break;
+ case EOpConstructMat4x3:
+ out << "Construct mat4x3";
+ break;
+ case EOpConstructMat4:
+ out << "Construct mat4";
+ break;
+ case EOpConstructStruct:
+ out << "Construct structure";
+ break;
- case EOpLessThan: out << "Compare Less Than"; break;
- case EOpGreaterThan: out << "Compare Greater Than"; break;
- case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
- case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
- case EOpVectorEqual: out << "Equal"; break;
- case EOpVectorNotEqual: out << "NotEqual"; break;
+ case EOpLessThan:
+ out << "Compare Less Than";
+ break;
+ case EOpGreaterThan:
+ out << "Compare Greater Than";
+ break;
+ case EOpLessThanEqual:
+ out << "Compare Less Than or Equal";
+ break;
+ case EOpGreaterThanEqual:
+ out << "Compare Greater Than or Equal";
+ break;
+ case EOpVectorEqual:
+ out << "Equal";
+ break;
+ case EOpVectorNotEqual:
+ out << "NotEqual";
+ break;
- case EOpMod: out << "mod"; break;
- case EOpModf: out << "modf"; break;
- case EOpPow: out << "pow"; break;
+ case EOpMod:
+ out << "mod";
+ break;
+ case EOpModf:
+ out << "modf";
+ break;
+ case EOpPow:
+ out << "pow";
+ break;
- case EOpAtan: out << "arc tangent"; break;
+ case EOpAtan:
+ out << "arc tangent";
+ break;
- case EOpMin: out << "min"; break;
- case EOpMax: out << "max"; break;
- case EOpClamp: out << "clamp"; break;
- case EOpMix: out << "mix"; break;
- case EOpStep: out << "step"; break;
- case EOpSmoothStep: out << "smoothstep"; break;
+ case EOpMin:
+ out << "min";
+ break;
+ case EOpMax:
+ out << "max";
+ break;
+ case EOpClamp:
+ out << "clamp";
+ break;
+ case EOpMix:
+ out << "mix";
+ break;
+ case EOpStep:
+ out << "step";
+ break;
+ case EOpSmoothStep:
+ out << "smoothstep";
+ break;
- case EOpDistance: out << "distance"; break;
- case EOpDot: out << "dot-product"; break;
- case EOpCross: out << "cross-product"; break;
- case EOpFaceForward: out << "face-forward"; break;
- case EOpReflect: out << "reflect"; break;
- case EOpRefract: out << "refract"; break;
- case EOpMul: out << "component-wise multiply"; break;
+ case EOpDistance:
+ out << "distance";
+ break;
+ case EOpDot:
+ out << "dot-product";
+ break;
+ case EOpCross:
+ out << "cross-product";
+ break;
+ case EOpFaceForward:
+ out << "face-forward";
+ break;
+ case EOpReflect:
+ out << "reflect";
+ break;
+ case EOpRefract:
+ out << "refract";
+ break;
+ case EOpMul:
+ out << "component-wise multiply";
+ break;
- case EOpOuterProduct: out << "outer product"; break;
+ case EOpOuterProduct:
+ out << "outer product";
+ break;
- case EOpInvariantDeclaration: out << "Invariant Declaration: "; break;
+ case EOpInvariantDeclaration:
+ out << "Invariant Declaration: ";
+ break;
- default:
- out.prefix(EPrefixError);
- out << "Bad aggregation op";
+ default:
+ out.prefix(EPrefixError);
+ out << "Bad aggregation op";
}
if (node->getOp() != EOpParameters)
@@ -616,30 +824,32 @@
OutputTreeText(out, node, mDepth);
switch (node->getUnionArrayPointer()[i].getType())
{
- case EbtBool:
- if (node->getUnionArrayPointer()[i].getBConst())
- out << "true";
- else
- out << "false";
+ case EbtBool:
+ if (node->getUnionArrayPointer()[i].getBConst())
+ out << "true";
+ else
+ out << "false";
- out << " (" << "const bool" << ")";
- out << "\n";
- break;
- case EbtFloat:
- out << node->getUnionArrayPointer()[i].getFConst();
- out << " (const float)\n";
- break;
- case EbtInt:
- out << node->getUnionArrayPointer()[i].getIConst();
- out << " (const int)\n";
- break;
- case EbtUInt:
- out << node->getUnionArrayPointer()[i].getUConst();
- out << " (const uint)\n";
- break;
- default:
- out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
- break;
+ out << " ("
+ << "const bool"
+ << ")";
+ out << "\n";
+ break;
+ case EbtFloat:
+ out << node->getUnionArrayPointer()[i].getFConst();
+ out << " (const float)\n";
+ break;
+ case EbtInt:
+ out << node->getUnionArrayPointer()[i].getIConst();
+ out << " (const int)\n";
+ break;
+ case EbtUInt:
+ out << node->getUnionArrayPointer()[i].getUConst();
+ out << " (const uint)\n";
+ break;
+ default:
+ out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
+ break;
}
}
}
@@ -699,11 +909,21 @@
switch (node->getFlowOp())
{
- case EOpKill: out << "Branch: Kill"; break;
- case EOpBreak: out << "Branch: Break"; break;
- case EOpContinue: out << "Branch: Continue"; break;
- case EOpReturn: out << "Branch: Return"; break;
- default: out << "Branch: Unknown Branch"; break;
+ case EOpKill:
+ out << "Branch: Kill";
+ break;
+ case EOpBreak:
+ out << "Branch: Break";
+ break;
+ case EOpContinue:
+ out << "Branch: Continue";
+ break;
+ case EOpReturn:
+ out << "Branch: Return";
+ break;
+ default:
+ out << "Branch: Unknown Branch";
+ break;
}
if (node->getExpression())