manifest.go raw
1 package main
2
3 // PackageManifest is the top-level manifest for a single package's corpus output.
4 type PackageManifest struct {
5 Package string `json:"package"`
6 Files []FileManifest `json:"files"`
7 }
8
9 // FileManifest describes one source file and its segments.
10 type FileManifest struct {
11 Path string `json:"path"`
12 FileIndex int `json:"file_index"`
13 Segments []SegmentManifest `json:"segments"`
14 }
15
16 // SegmentManifest describes one AST segment and its paired outputs.
17 type SegmentManifest struct {
18 ID string `json:"id"`
19 Kind string `json:"kind"`
20 Name string `json:"name"`
21 ASTFile string `json:"ast_file"`
22 SizeBytes int `json:"size_bytes"`
23 SourcePos SourcePos `json:"source_pos"`
24 Comments []string `json:"comments,omitempty"`
25 Generated bool `json:"generated"`
26 HasSpawn bool `json:"has_spawn"`
27 ASTDump string `json:"ast_dump,omitempty"`
28 IRFiles OptFileMap `json:"ir_files,omitempty"`
29 ASMFiles OptFileMap `json:"asm_files,omitempty"`
30 BinFiles OptFileMap `json:"bin_files,omitempty"`
31 Lineinfo *SizedFile `json:"lineinfo_file,omitempty"`
32 IRName string `json:"ir_name,omitempty"`
33 IRDebug *IRDebugInfo `json:"ir_debug,omitempty"`
34 }
35
36 type SourcePos struct {
37 Line int `json:"line"`
38 EndLine int `json:"end_line"`
39 }
40
41 type SizedFile struct {
42 File string `json:"file"`
43 SizeBytes int `json:"size_bytes"`
44 }
45
46 // OptFileMap maps optimization level to file+size. Nil entries mean the
47 // function was eliminated at that opt level.
48 type OptFileMap map[string]*SizedFile
49
50 type IRDebugInfo struct {
51 File string `json:"file"`
52 Line int `json:"line"`
53 }
54