Documentation
¶
Index ¶
- Constants
- Variables
- func DisposeSources(sources []cl.Source)
- func Dump(node clang.Cursor, ns, dir string)
- func Gen(destDir, srcDir string, index clang.Index) (err error)
- func ParseSources(index clang.Index, headerFiles, includeDirs []string, lang string) ([]cl.Source, error)
- func SetDebug(flags int)
- type Config
- type Module
Constants ¶
View Source
const ( DbgFlagLoadSource = 1 << iota DbgFlagImport DbgFlagAll = DbgFlagLoadSource | DbgFlagImport )
Variables ¶
View Source
var ( // ErrStdlibRequired is returned when the stdlib field is not specified in the // configuration. ErrStdlibRequired = errors.New("stdlib is required") )
View Source
var (
// GeneratedHeader is the header comment for llcppg generated Go files.
GeneratedHeader = "// Code generated by llcppg; DO NOT EDIT.\n\n"
)
Functions ¶
func DisposeSources ¶ added in v0.9.0
DisposeSources disposes the given translation units.
func Gen ¶ added in v0.9.0
Gen generates Go files from the C/C++ header files and llcppg.cfg in the specified source directory and writes them to the destination directory. It uses the provided clang index for parsing.
Types ¶
type Config ¶
type Config struct {
Name string `json:"Name"` // required
Language string `json:"Language"` // c, c++, etc. required
Dir string `json:"Dir"` // dir or dir/... (recursive), required
Stdlib string `json:"Stdlib"` // C stdlib include dir, required
LLGoPackage string `json:"LLGoPackage"` // optional
CFlags string `json:"CFlags"` // optional
Deps []string `json:"Deps"` // dependencies (package paths), optional
Class []string `json:"Class"` // typedef names to be treated as classes
NonClass []string `json:"NonClass"` // typedef names to be treated as non-classes
FuncPrefix []string `json:"FuncPrefix"` // global function prefix to remove
EnumPrefix []string `json:"EnumPrefix"` // enum value prefix to remove
TypePrefix []string `json:"TypePrefix"` // type prefix to remove
TypeAbbr map[string]string `json:"TypeAbbr"` // Go type name to its abbr, used in function names
Rename map[string]string `json:"Rename"` // renaming of C/C++ names to Go names
Ignore []string `json:"Ignore"` // C/C++ names to ignore
}
type Module ¶ added in v0.9.0
type Module struct {
// contains filtered or unexported fields
}
Module represents a llcppg module.
func LoadModuleFrom ¶ added in v0.9.0
LoadModuleFrom loads a llcppg module from the specified directory.
Click to show internal directories.
Click to hide internal directories.