blob: aa23c96efd91dfe1e31c088403d9e5e79c7dacdb (
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
|
#pragma once
#include "compiler-core/slang-diagnostic-sink.h"
#include "slang-cpp-parser/diagnostics.h"
#include "slang-cpp-parser/node-tree.h"
#include "slang-cpp-parser/options.h"
namespace CppExtract
{
using namespace Slang;
using namespace CppParse;
/* A class that writes out macros that define type hierarchies, as well as fields of types */
class MacroWriter
{
public:
/// Write output
SlangResult writeOutput(NodeTree* tree);
/// Write def files
SlangResult writeDefs(NodeTree* tree);
/// Calculate the header
SlangResult calcTypeHeader(NodeTree* tree, TypeSet* typeSet, StringBuilder& out);
SlangResult calcChildrenHeader(NodeTree* tree, TypeSet* typeSet, StringBuilder& out);
SlangResult calcOriginHeader(NodeTree* tree, StringBuilder& out);
SlangResult calcDef(NodeTree* tree, SourceOrigin* origin, StringBuilder& out);
/// Ctor.
MacroWriter(DiagnosticSink* sink, const Options* options)
: m_sink(sink), m_options(options)
{
}
protected:
const Options* m_options = nullptr;
DiagnosticSink* m_sink;
};
} // namespace CppExtract
|