preprocessor

package
v0.0.0-...-78f7ddb Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compiler

func Compiler(isCPP bool) (compiler string, compilerFlag []string)

func GetIeraphyIncludeList

func GetIeraphyIncludeList(inputFiles, clangFlags []string, cppCode bool) (
	lines []string, err error)

GetIeraphyIncludeList - Get list of include files in ierarphy Example: clang -MM -H ./tests/math.c . ./tests/tests.h .. /usr/include/string.h ... /usr/include/features.h .... /usr/include/stdc-predef.h .... /usr/include/x86_64-linux-gnu/sys/cdefs.h ..... /usr/include/x86_64-linux-gnu/bits/wordsize.h .... /usr/include/x86_64-linux-gnu/gnu/stubs.h ..... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h ... /usr/lib/llvm-6.0/lib/clang/6.0.0/include/stddef.h ... /usr/include/xlocale.h .. /usr/include/math.h ... /usr/include/x86_64-linux-gnu/bits/math-vector.h

func GetIncludeFullList

func GetIncludeFullList(inputFiles, clangFlags []string, cppCode bool) (
	lines []string, err error)

GetIncludeFullList - Get full list of include files Example: $ clang -M -c triangle.c

triangle.o: triangle.c /usr/include/stdio.h /usr/include/features.h \
  /usr/include/stdc-predef.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
  /usr/include/x86_64-linux-gnu/bits/wordsize.h \
  /usr/include/x86_64-linux-gnu/gnu/stubs.h \
  /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
  / ........ and other

func GetIncludeListWithUserSource

func GetIncludeListWithUserSource(inputFiles, clangFlags []string, cppCode bool) (
	lines []string, err error)

GetIncludeListWithUserSource - Get list of include files Example: $ clang -MM -c exit.c exit.o: exit.c tests.h

Types

type Comment

type Comment struct {
	File    string
	Line    int
	Comment string
}

Comment - position of line comment '//...'

type FilePP

type FilePP struct {
	// contains filtered or unexported fields
}

FilePP a struct with all information about preprocessor C code

func NewFilePP

func NewFilePP(inputFiles, clangFlags []string, cppCode bool) (
	f FilePP, err error)

NewFilePP create a struct FilePP with results of analyzing preprocessor C code

func (FilePP) GetBaseInclude

func (f FilePP) GetBaseInclude(in string) string

GetBaseInclude return base include

func (FilePP) GetComments

func (f FilePP) GetComments() []Comment

GetComments return comments in preprocessor C code

func (FilePP) GetIncludeFiles

func (f FilePP) GetIncludeFiles() []IncludeHeader

GetIncludeFiles return list of '#include' file in C sources

func (FilePP) GetSnippet

func (f FilePP) GetSnippet(file string,
	line, lineEnd int,
	col, colEnd int) (
	buffer []byte, err error)

GetSnippet return short part of code inside preprocessor C code

func (FilePP) GetSource

func (f FilePP) GetSource() []byte

GetSource return source of preprocessor C code

func (FilePP) IsUserSource

func (f FilePP) IsUserSource(in string) bool

IsUserSource get is it source from user

type IncludeHeader

type IncludeHeader struct {
	HeaderName     string
	BaseHeaderName string
	IsUserSource   bool
}

IncludeHeader - struct for C include header

Jump to

Keyboard shortcuts

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