blob: 6697724a7e6e439fe4bb97f2b964a6382256ca4a [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package codegen
const tmplHeader = `
{{- define "Header" -}}
// WARNING: This file is machine generated by fidlgen.
#pragma once
#include "lib/fidl/cpp/fuzzing/traits.h"
#include "lib/fidl/cpp/internal/header.h"
{{ range .Headers -}}
#include <{{ . }}/cpp/fidl.h>
{{- end }}
{{ if .FuzzerHeaders -}}
{{ "" }}
{{ $root := . -}}
{{ range .FuzzerHeaders -}}
#include <{{ . }}/{{ $root.IncludeStem }}.h>
{{ end -}}
{{ end -}}
// For ::std::max_element().
#include <algorithm>
// For uint64_t.
#include <stdint.h>
namespace fuzzing {
{{ range .Decls }}
{{- if and (NEq .Kind Kinds.Protocol) (NEq .Kind Kinds.Const) }}
using {{ .Name }} = {{ .Namespace }}::{{ .Name }};
{{- end }}
{{- end }}
{{ range .Decls }}
{{- if Eq .Kind Kinds.Bits }}{{ template "BitsSizeAndAlloc" . }}{{- end }}
{{- if Eq .Kind Kinds.Enum }}{{ template "EnumSizeAndAlloc" . }}{{- end }}
{{- if Eq .Kind Kinds.Struct }}{{ template "StructSizeAndAlloc" . }}{{- end }}
{{- if Eq .Kind Kinds.Table }}{{ template "TableSizeAndAlloc" . }}{{- end }}
{{- if Eq .Kind Kinds.Union }}{{ template "UnionSizeAndAlloc" . }}{{- end }}
{{- end }}
} // namespace fuzzing
{{ end }}
`