1 //
2 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #ifndef COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITECASEDECLARATIONS_H_
8 #define COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITECASEDECLARATIONS_H_
9 
10 #include "common/angleutils.h"
11 #include "compiler/translator/Compiler.h"
12 
13 namespace sh
14 {
15 
16 // EXAMPLE
17 //    switch (expr)
18 //    {
19 //      case 0:
20 //        int x = 0;
21 //        break;
22 //      case 1:
23 //        int y = 0;
24 //        {
25 //          int z = 0;
26 //        }
27 //        break;
28 //    }
29 // Becomes
30 //    {
31 //      int x;
32 //      int y;
33 //      switch (expr)
34 //      {
35 //        case 0:
36 //          x = 0;
37 //          break;
38 //        case 1:
39 //          y = 0;
40 //          {
41 //            int z = 0;
42 //          }
43 //          break;
44 //      }
45 //    }
46 ANGLE_NO_DISCARD bool RewriteCaseDeclarations(TCompiler &compiler, TIntermBlock &root);
47 
48 }  // namespace sh
49 
50 #endif  // COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_REWRITECASEDECLARATIONS_H_
51