blob: aa043eb8ae916592f6894cf509e1be2fe5b3bcac [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"
{{- /* Import the HLCPP bindings that we are using to fuzz. */}}
{{- if .HlcppBindingsHeader }}
#include <{{ .HlcppBindingsHeader }}>
{{ end -}}
{{ if .Headers -}}
{{ "" }}
{{ range .Headers -}}
#include <{{ . }}/{{ $.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 {{ .Natural.Name }} = {{ .Natural }};
{{- 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 }}
`