mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Swift: split generated C++ code into .h and .cpp
This commit is contained in:
42
swift/codegen/templates/cpp_classes_h.mustache
Normal file
42
swift/codegen/templates/cpp_classes_h.mustache
Normal file
@@ -0,0 +1,42 @@
|
||||
// generated by {{generator}} from {{source}}
|
||||
// clang-format off
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "swift/extractor/trap/TrapLabel.h"
|
||||
#include "swift/extractor/trap/TrapTagTraits.h"
|
||||
#include "./TrapEntries.h"
|
||||
|
||||
namespace codeql {
|
||||
{{#classes}}
|
||||
|
||||
struct {{name}}{{#has_bases}} : {{#bases}}{{^first}}, {{/first}}{{ref.name}}{{/bases}}{{/has_bases}} {
|
||||
{{#final}}
|
||||
explicit {{name}}(TrapLabel<{{name}}Tag> id) : id{id} {}
|
||||
|
||||
TrapLabel<{{name}}Tag> id{};
|
||||
{{/final}}
|
||||
{{#fields}}
|
||||
{{type}} {{field_name}}{};
|
||||
{{/fields}}
|
||||
{{#final}}
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, const {{name}}& x) {
|
||||
x.emit(out);
|
||||
return out;
|
||||
}
|
||||
{{/final}}
|
||||
|
||||
protected:
|
||||
void emit({{^final}}TrapLabel<{{name}}Tag> id, {{/final}}std::ostream& out) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct detail::ToTrapClassFunctor<{{name}}Tag> {
|
||||
using type = {{name}};
|
||||
};
|
||||
{{/classes}}
|
||||
}
|
||||
Reference in New Issue
Block a user