• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2002 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_TREEOPS_SEPARATEDECLARATIONS_H_
8 #define COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_
9 
10 #include "common/angleutils.h"
11 
12 namespace sh
13 {
14 class TCompiler;
15 class TIntermBlock;
16 
17 // Transforms declarations so that in the end each declaration contains only one declarator.
18 // This is useful as an intermediate step when initialization needs to be separated from
19 // declaration, or when things need to be unfolded out of the initializer.
20 // Examples:
21 // Input:
22 //     int a[1] = int[1](1), b[1] = int[1](2);
23 // Output:
24 //     int a[1] = int[1](1);
25 //     int b[1] = int[1](2);
26 // Input:
27 //    struct S { vec3 d; } a, b;
28 // Output:
29 //    struct S { vec3 d; } a;
30 //    S b;
31 // Input:
32 //    struct { vec3 d; } a, b;
33 // Output:
34 //    struct s1234 { vec3 d; } a;
35 //    s1234 b;
36 [[nodiscard]] bool SeparateDeclarations(TCompiler &compiler, TIntermBlock &root);
37 
38 }  // namespace sh
39 
40 #endif  // COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_
41