2016-07-01 15:22:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2017-03-31 17:56:23 +00:00
|
|
|
|
2016-07-01 15:22:01 +00:00
|
|
|
#ifndef SKSL_PROGRAMELEMENT
|
|
|
|
#define SKSL_PROGRAMELEMENT
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/sksl/ir/SkSLIRNode.h"
|
2016-07-01 15:22:01 +00:00
|
|
|
|
2019-06-26 17:54:14 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2016-07-01 15:22:01 +00:00
|
|
|
namespace SkSL {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a top-level element (e.g. function or global variable) in a program.
|
|
|
|
*/
|
|
|
|
struct ProgramElement : public IRNode {
|
|
|
|
enum Kind {
|
2017-11-10 20:34:03 +00:00
|
|
|
kEnum_Kind,
|
|
|
|
kExtension_Kind,
|
2016-07-01 15:22:01 +00:00
|
|
|
kFunction_Kind,
|
|
|
|
kInterfaceBlock_Kind,
|
2017-06-29 14:03:38 +00:00
|
|
|
kModifiers_Kind,
|
2017-11-10 20:34:03 +00:00
|
|
|
kSection_Kind,
|
|
|
|
kVar_Kind
|
2016-07-01 15:22:01 +00:00
|
|
|
};
|
|
|
|
|
2017-09-11 20:50:14 +00:00
|
|
|
ProgramElement(int offset, Kind kind)
|
|
|
|
: INHERITED(offset)
|
2016-07-01 15:22:01 +00:00
|
|
|
, fKind(kind) {}
|
|
|
|
|
|
|
|
Kind fKind;
|
|
|
|
|
2018-07-31 13:44:36 +00:00
|
|
|
virtual std::unique_ptr<ProgramElement> clone() const = 0;
|
|
|
|
|
2016-07-01 15:22:01 +00:00
|
|
|
typedef IRNode INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|