Line data Source code
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_CODEGENERATOR
9 : #define SKSL_CODEGENERATOR
10 :
11 : #include "ir/SkSLProgram.h"
12 :
13 : namespace SkSL {
14 :
15 : /**
16 : * Abstract superclass of all code generators, which take a Program as input and produce code as
17 : * output.
18 : */
19 : class CodeGenerator {
20 : public:
21 0 : CodeGenerator(const Program* program, ErrorReporter* errors, OutputStream* out)
22 0 : : fProgram(*program)
23 : , fErrors(*errors)
24 0 : , fOut(out) {}
25 :
26 0 : virtual ~CodeGenerator() {}
27 :
28 : virtual bool generateCode() = 0;
29 :
30 : protected:
31 :
32 : const Program& fProgram;
33 : ErrorReporter& fErrors;
34 : OutputStream* fOut;
35 : };
36 :
37 : } // namespace
38 :
39 : #endif
|