func (f *File) AddHeader(includePath string, headerFile clang.File) {
	hdr := new(Header)
	if headerFile.Name() == "" {
		hdr.fileid = ToFileID(notExistHeaderName(filepath.Clean(headerFile.Name())))
		hdr.mtime = time.Now()
	} else {
		hdr.fileid = ToFileID(filepath.Clean(headerFile.Name()))
		hdr.mtime = headerFile.Time()
	}
	f.headers = append(f.headers, hdr)
}
AddHeader add header data into File.
package symbol
import (
	"path/filepath"
	"reflect"
	"time"
	"github.com/go-clang/v3.9/clang"
	flatbuffers "github.com/google/flatbuffers/go"
	"github.com/zchee/clang-server/internal/symbol"
)
type File struct {
	name            string
	flags           []string
	translationUnit []byte
	locations       map[Location]ID
	symbols         map[ID]*Info
	headers         []*Header
	builder *flatbuffers.Builder
	file *symbol.File
}
type SymbolFile = symbol.File
func NewFile(name string, flags []string) *File {
	return &File{
		name:      name,
		flags:     flags,
		locations: make(map[Location]ID),
		symbols:   make(map[ID]*Info),
		builder:   flatbuffers.NewBuilder(0),
	}
}
func GetRootAsFile(buf []byte, offset flatbuffers.UOffsetT) *File {
	return &File{
		file: symbol.GetRootAsFile(buf, offset),
	}
}
func (f *File) Name() string {
	if f.name != "" {
		return f.name
	}
	return string(f.file.Name())
}
func (f *File) Flags() []string {
	if len(f.flags) > 0 {
		return f.flags
	}
	n := f.file.FlagsLength()
	flags := make([]string, n)
	for i := 0; i < n; i++ {
		flags[i] = string(f.file.Flags(i))
	}
	return flags
}
func (f *File) TranslationUnit() []byte {
	if len(f.translationUnit) > 0 {
		return f.translationUnit
	}
	return f.file.TranslationUnit()
}
func (f *File) Symbols() []*Info {
	if len(f.symbols) > 0 {
		symbols := make([]*Info, len(f.symbols))
		for _, v := range f.symbols {
			symbols = append(symbols, v)
		}
		return symbols
	}
	n := f.file.SymbolsLength()
	symbols := make([]*Info, n)
	for i := 0; i < n; i++ {
		obj := new(symbol.Info)
		if f.file.Symbols(obj, i) {
			symbols[i] = &Info{info: obj}
		}
	}
	return symbols
}
func (f *File) Headers() []*Header {
	if len(f.headers) > 0 {
		return f.headers
	}
	n := f.file.HeadersLength()
	headers := make([]*Header, n)
	for i := 0; i < n; i++ {
		obj := new(symbol.Header)
		if f.file.Headers(obj, i) {
			headers[i] = &Header{header: obj}
		}
	}
	return headers
}
func (f *File) AddTranslationUnit(buf []byte) {
	f.translationUnit = buf
}
func (f *File) addSymbol(loc, def Location) {
	id := ToID(loc.usr)
	sym, ok := f.symbols[id]
	if !ok {
		sym = &Info{id: id}
	}
	sym.decls = append(sym.decls, loc)
	if def.isExist() {
		sym.def = def
	}
	f.locations[loc] = id
	f.symbols[id] = sym
}
func (f *File) AddDecl(loc Location) {
	f.addSymbol(loc, Location{})
}
func (f *File) AddDefinition(loc, def Location) {
	f.addSymbol(loc, def)
}
func notExistHeaderName(headPath string) string {
	return "IDoNotReallyExist-" + filepath.Base(headPath)
}