Documentation
¶
Index ¶
- Constants
- Variables
- func DisposeSources(sources []cl.Source)
- func Dump(node clang.Cursor, ns, dir string)
- func ParseFlags(includeDirs []string, lang string) []string
- 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 ( DbgFlagSettings = 1 << iota DbgFlagAll = DbgFlagSettings )
Variables ¶
View Source
var ( // ErrDirRequired is returned when the Dir field in the configuration is empty. // It indicates that the directory containing the header files is required. ErrDirRequired = errors.New("Dir (contains the header files) 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 ParseFlags ¶ added in v0.9.2
ParseFlags constructs the command-line flags for parsing C/C++ source files with clang.
Types ¶
type Config ¶
type Config struct {
Name string `json:"Name"` // required, sub package name should start with '/'
Language string `json:"Language"` // c, c++, etc. required
Dir string `json:"Dir"` // dir or dir/... (recursive), required
Files []string `json:"Files"` // selected header files relative to Dir; overrides auto-discovery, optional.
Stdlib string `json:"Stdlib"` // C stdlib include dir, optional
LLGoPackage string `json:"LLGoPackage"` // optional
CFlags string `json:"CFlags"` // optional
Deps []string `json:"Deps"` // dependencies (module 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
VarPrefix []string `json:"VarPrefix"` // global variable prefix to remove
EnumPrefix []string `json:"EnumPrefix"` // enum value prefix to remove
MacroPrefix []string `json:"MacroPrefix"` // macro 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
TypeIgnore []string `json:"TypeIgnore"` // C/C++ type names to ignore
NSIgnore []string `json:"NSIgnore"` // namespaces (Go style names) to ignore
Pkgs []string `json:"Pkgs"` // sub-packages to generate, optional
}
func (*Config) Apply ¶ added in v0.9.2
Apply applies the parent configuration to the current configuration.
func (*Config) NewPackage ¶ added in v0.9.0
func (cfg *Config) NewPackage(pkgPath, pkgName, workDir string, index clang.Index) (ret cl.Package, lang cl.Language, err error)
NewPackage loads the source files and converts them into a Go package according to the configuration.
func (*Config) StdlibDirs ¶ added in v0.9.2
StdlibDirs returns the standard library include directories.
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.
func (Module) IncludeDir ¶ added in v0.9.2
IncludeDir returns the include directory for the specified module path. It looks up the module version in the go.mod file and retrieves the include directory from the module cache.
Click to show internal directories.
Click to hide internal directories.