Make use of CreateBoolNode in traversers
This is just refactoring to clean up some duplicate code. A new test
is added to make sure this doesn't break UnfoldShortCircuitAST.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I108e646f71ba631cbd5dad2055b64e6a30159742
Reviewed-on: https://chromium-review.googlesource.com/894207
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/AddAndTrueToLoopCondition.cpp b/src/compiler/translator/AddAndTrueToLoopCondition.cpp
index 6a05104..27662f1 100644
--- a/src/compiler/translator/AddAndTrueToLoopCondition.cpp
+++ b/src/compiler/translator/AddAndTrueToLoopCondition.cpp
@@ -6,6 +6,7 @@
#include "compiler/translator/AddAndTrueToLoopCondition.h"
+#include "compiler/translator/IntermNode_util.h"
#include "compiler/translator/IntermTraverse.h"
namespace sh
@@ -36,9 +37,7 @@
}
// Constant true.
- TConstantUnion *trueConstant = new TConstantUnion();
- trueConstant->setBConst(true);
- TIntermTyped *trueValue = new TIntermConstantUnion(trueConstant, TType(EbtBool));
+ TIntermTyped *trueValue = CreateBoolNode(true);
// CONDITION && true.
TIntermBinary *andOp = new TIntermBinary(EOpLogicalAnd, loop->getCondition(), trueValue);