blob: 3aa790c86df2a199a35aedac1cac248db009a5e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// slang-serialize-ast.h
#ifndef SLANG_SERIALIZE_AST_H
#define SLANG_SERIALIZE_AST_H
#include "slang-ast-support-types.h"
#include "slang-ast-all.h"
#include "../core/slang-riff.h"
#include "slang-ast-builder.h"
#include "slang-serialize.h"
namespace Slang
{
/* Holds RIFF FourCC codes for AST types */
struct ASTSerialBinary
{
static const FourCC kRiffFourCC = RiffFourCC::kRiff;
/// AST module LIST container
static const FourCC kSlangASTModuleFourCC = SLANG_FOUR_CC('S', 'A', 'm', 'l');
/// AST module data
static const FourCC kSlangASTModuleDataFourCC = SLANG_FOUR_CC('S', 'A', 'm', 'd');
};
class ModuleSerialFilter : public SerialFilter
{
public:
// SerialFilter impl
virtual SerialIndex writePointer(SerialWriter* writer, const NodeBase* ptr) SLANG_OVERRIDE;
virtual SerialIndex writePointer(SerialWriter* writer, const RefObject* ptr) SLANG_OVERRIDE;
ModuleSerialFilter(ModuleDecl* moduleDecl):
m_moduleDecl(moduleDecl)
{
}
protected:
ModuleDecl* m_moduleDecl;
};
struct ASTSerialUtil
{
/// Add the AST related classes
static void addSerialClasses(SerialClasses* classes);
/// Tries to serialize out, read back in and test the results are the same.
/// Will write dumped out node to files
static SlangResult testSerialize(NodeBase* node, RootNamePool* rootNamePool, SharedASTBuilder* sharedASTBuilder, SourceManager* sourceManager);
};
} // namespace Slang
#endif
|