summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h b/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
index db8699327c..7a3b1963f2 100644
--- a/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
+++ b/src/3rdparty/angle/src/compiler/translator/RemoveSwitchFallThrough.h
@@ -3,41 +3,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
+// RemoveSwitchFallThrough.h: Remove fall-through from switch statements.
+// Note that it is unsafe to do further AST transformations on the AST generated
+// by this function. It leaves duplicate nodes in the AST making replacements
+// unreliable.
#ifndef COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
#define COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
-#include "compiler/translator/IntermNode.h"
-
-class RemoveSwitchFallThrough : public TIntermTraverser
+namespace sh
{
- public:
- // When given a statementList from a switch AST node, return an updated
- // statementList that has fall-through removed.
- static TIntermAggregate *removeFallThrough(TIntermAggregate *statementList);
-
- private:
- RemoveSwitchFallThrough(TIntermAggregate *statementList);
- void visitSymbol(TIntermSymbol *node) override;
- void visitConstantUnion(TIntermConstantUnion *node) override;
- bool visitBinary(Visit, TIntermBinary *node) override;
- bool visitUnary(Visit, TIntermUnary *node) override;
- bool visitSelection(Visit visit, TIntermSelection *node) override;
- bool visitSwitch(Visit, TIntermSwitch *node) override;
- bool visitCase(Visit, TIntermCase *node) override;
- bool visitAggregate(Visit, TIntermAggregate *node) override;
- bool visitLoop(Visit, TIntermLoop *node) override;
- bool visitBranch(Visit, TIntermBranch *node) override;
+class TIntermBlock;
+class PerformanceDiagnostics;
- void outputSequence(TIntermSequence *sequence, size_t startIndex);
- void handlePreviousCase();
+// When given a statementList from a switch AST node, return an updated
+// statementList that has fall-through removed.
+TIntermBlock *RemoveSwitchFallThrough(TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics);
- TIntermAggregate *mStatementList;
- TIntermAggregate *mStatementListOut;
- bool mLastStatementWasBreak;
- TIntermAggregate *mPreviousCase;
- std::vector<TIntermAggregate *> mCasesSharingBreak;
-};
+} // namespace sh
-#endif // COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
+#endif // COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_