14#ifndef LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
15#define LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
26#define TRY_TO(CALL_EXPR) \
28 if (!getDerived()->CALL_EXPR) \
92#define GENERATE_TRAVERSE_METHOD(CLASS, BASE) \
93 bool traverse##CLASS(const CLASS *Record) { \
94 TRY_TO(walkUpFrom##CLASS(Record)); \
95 TRY_TO(traverseRecordContext(dyn_cast<RecordContext>(Record))); \
99#define GENERATE_WALKUP_AND_VISIT_METHODS(CLASS, BASE) \
100 bool walkUpFrom##CLASS(const CLASS *Record) { \
101 TRY_TO(walkUpFrom##BASE(Record)); \
102 TRY_TO(visit##CLASS(Record)); \
105 bool visit##CLASS(const CLASS *Record) { return true; }
107#define CONCRETE_RECORD(CLASS, BASE, KIND) \
108 GENERATE_TRAVERSE_METHOD(CLASS, BASE) \
109 GENERATE_WALKUP_AND_VISIT_METHODS(CLASS, BASE)
111#define ABSTRACT_RECORD(CLASS, BASE) \
112 GENERATE_WALKUP_AND_VISIT_METHODS(CLASS, BASE)
114#include "../APIRecords.inc"
116#undef GENERATE_WALKUP_AND_VISIT_METHODS
117#undef GENERATE_TRAVERSE_METHOD
135 Derived *
getDerived() {
return static_cast<Derived *
>(
this); };
138template <
typename Derived>
144 for (
auto *Child : Context->records())
145 TRY_TO(traverseAPIRecord(Child));
150template <
typename Derived>
152 switch (
Record->getKind()) {
153#define CONCRETE_RECORD(CLASS, BASE, KIND) \
154 case APIRecord::KIND: { \
155 TRY_TO(traverse##CLASS(static_cast<const CLASS *>(Record))); \
158#include "../APIRecords.inc"
164 llvm_unreachable(
"API Record with uninstantiable kind");
This file defines the APIRecord-based structs and the APISet class.
llvm::MachO::Record Record
#define TRY_TO(CALL_EXPR)
The JSON file list parser is used to communicate input to InstallAPI.