| 1 | /* | 
|---|
| 2 | * Copyright 2016 Google Inc. | 
|---|
| 3 | * | 
|---|
| 4 | * Use of this source code is governed by a BSD-style license that can be | 
|---|
| 5 | * found in the LICENSE file. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef SKSL_PROGRAMELEMENT | 
|---|
| 9 | #define SKSL_PROGRAMELEMENT | 
|---|
| 10 |  | 
|---|
| 11 | #include "src/sksl/ir/SkSLIRNode.h" | 
|---|
| 12 |  | 
|---|
| 13 | #include <memory> | 
|---|
| 14 |  | 
|---|
| 15 | namespace SkSL { | 
|---|
| 16 |  | 
|---|
| 17 | /** | 
|---|
| 18 | * Represents a top-level element (e.g. function or global variable) in a program. | 
|---|
| 19 | */ | 
|---|
| 20 | struct ProgramElement : public IRNode { | 
|---|
| 21 | enum Kind { | 
|---|
| 22 | kEnum_Kind, | 
|---|
| 23 | kExtension_Kind, | 
|---|
| 24 | kFunction_Kind, | 
|---|
| 25 | kInterfaceBlock_Kind, | 
|---|
| 26 | kModifiers_Kind, | 
|---|
| 27 | kSection_Kind, | 
|---|
| 28 | kVar_Kind | 
|---|
| 29 | }; | 
|---|
| 30 |  | 
|---|
| 31 | ProgramElement(int offset, Kind kind) | 
|---|
| 32 | : INHERITED(offset) | 
|---|
| 33 | , fKind(kind) {} | 
|---|
| 34 |  | 
|---|
| 35 | Kind fKind; | 
|---|
| 36 |  | 
|---|
| 37 | virtual std::unique_ptr<ProgramElement> clone() const = 0; | 
|---|
| 38 |  | 
|---|
| 39 | typedef IRNode INHERITED; | 
|---|
| 40 | }; | 
|---|
| 41 |  | 
|---|
| 42 | }  // namespace SkSL | 
|---|
| 43 |  | 
|---|
| 44 | #endif | 
|---|
| 45 |  | 
|---|