clang

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Dir     string
	Env     []string
	Verbose bool
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	// contains filtered or unexported fields
}

Cmd represents a clang command with environment and configuration support.

func New

func New(app string, config Config) *Cmd

New creates a new clang command with configuration.

func NewCXXCompiler added in v1.0.1

func NewCXXCompiler(config Config) *Cmd

NewCXXCompiler creates a C++ compiler command with proper flag merging.

func NewCompiler

func NewCompiler(config Config) *Cmd

NewCompiler creates a compiler command with proper flag merging.

func NewLinker

func NewLinker(config Config) *Cmd

NewLinker creates a linker command with proper flag merging.

func (*Cmd) CheckLinkArgs

func (c *Cmd) CheckLinkArgs(cmdArgs []string, wasm bool) error

CheckLinkArgs validates linking arguments by attempting a test compile.

func (*Cmd) Compile

func (c *Cmd) Compile(args ...string) error

Compile executes a compilation command with merged flags.

func (*Cmd) CompileArguments added in v1.0.7

func (c *Cmd) CompileArguments(args ...string) []string

CompileArguments returns the effective driver arguments without executing the compiler, including the command prefix and environment flags.

func (c *Cmd) Link(args ...string) error

Link executes a linking command with merged flags.

func (*Cmd) LinkArguments added in v1.0.5

func (c *Cmd) LinkArguments(args ...string) []string

LinkArguments returns the effective driver arguments, including its command prefix and environment flags, without executing the linker. Inspecting these arguments preserves explicit user options when selecting linker defaults.

type Config

type Config struct {
	CC                string   // Compiler to use (e.g., "clang", "clang++")
	CCArgs            []string // Arguments that are part of the CC command
	CXX               string   // C++ compiler to use
	CXXArgs           []string // Arguments that are part of the CXX command
	CCFLAGS           []string // Compiler flags for C/C++ compilation
	CFLAGS            []string // C-specific flags
	LDFLAGS           []string // Linker flags
	Linker            string   // Linker to use (e.g., "ld.lld", "avr-ld")
	LinkerArgs        []string // Arguments that are part of the linker command
	ResponseFileStyle ResponseFileStyle
}

Config represents clang configuration parameters.

func NewConfig

func NewConfig(cc string, ccflags, cflags, ldflags []string, linker string) Config

NewConfig creates a new Config with the specified parameters.

type ResponseFileStyle added in v1.0.1

type ResponseFileStyle uint8

ResponseFileStyle identifies the tokenizer used by a compiler or linker. Clang's GNU driver uses GNU tokenization even on Windows, while clang-cl, lld-link, link.exe, and cl.exe use Windows command-line tokenization.

const (
	ResponseFileAuto ResponseFileStyle = iota
	ResponseFileGNU
	ResponseFileWindows
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL