Run gofmt -w on everything. Add 'gogc' option to use Go garbage
collector for memory management.
This commit is contained in:
parent
d0654613ea
commit
9a4fabda24
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -9,3 +9,7 @@ examples/foundation/foundation
|
||||||
examples/foundation/ns
|
examples/foundation/ns
|
||||||
examples/simple/simple
|
examples/simple/simple
|
||||||
examples/simple/ClassOne
|
examples/simple/ClassOne
|
||||||
|
examples/memory/memory
|
||||||
|
examples/memory/ns
|
||||||
|
examples/gc/gc
|
||||||
|
examples/gc/ns
|
||||||
|
|
|
@ -6,23 +6,22 @@ import (
|
||||||
|
|
||||||
func TestAlignedAttr(t *testing.T) {
|
func TestAlignedAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f8a1d8ccfd0 <col:47, col:57> aligned`:
|
`0x7f8a1d8ccfd0 <col:47, col:57> aligned`: testNode{&AlignedAttr{
|
||||||
testNode{&AlignedAttr{
|
|
||||||
Addr: 0x7f8a1d8ccfd0,
|
Addr: 0x7f8a1d8ccfd0,
|
||||||
Pos: NewPositionFromString("col:47, col:57"),
|
Pos: NewPositionFromString("col:47, col:57"),
|
||||||
IsAligned: true,
|
IsAligned: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8a1d8ccfd0,
|
0x7f8a1d8ccfd0,
|
||||||
NewPositionFromString("col:47, col:57"),
|
NewPositionFromString("col:47, col:57"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x2c8ba10 <col:42>`: testNode{ &AlignedAttr{
|
`0x2c8ba10 <col:42>`: testNode{&AlignedAttr{
|
||||||
Addr: 0x2c8ba10,
|
Addr: 0x2c8ba10,
|
||||||
Pos: NewPositionFromString("col:42"),
|
Pos: NewPositionFromString("col:42"),
|
||||||
IsAligned: false,
|
IsAligned: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2c8ba10,
|
0x2c8ba10,
|
||||||
NewPositionFromString("col:42"),
|
NewPositionFromString("col:42"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
|
@ -31,4 +30,3 @@ func TestAlignedAttr(t *testing.T) {
|
||||||
|
|
||||||
runNodeTests(t, nodes)
|
runNodeTests(t, nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package ast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
//"git.wow.st/gmp/nswrap/util"
|
//"git.wow.st/gmp/nswrap/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,18 @@ import (
|
||||||
|
|
||||||
func TestAllocSizeAttr(t *testing.T) {
|
func TestAllocSizeAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f8e390a5d38 <col:100, col:114> 1 2`:
|
`0x7f8e390a5d38 <col:100, col:114> 1 2`: testNode{&AllocSizeAttr{
|
||||||
testNode{&AllocSizeAttr{
|
|
||||||
Addr: 0x7f8e390a5d38,
|
Addr: 0x7f8e390a5d38,
|
||||||
Pos: NewPositionFromString("col:100, col:114"),
|
Pos: NewPositionFromString("col:100, col:114"),
|
||||||
A: "1",
|
A: "1",
|
||||||
B: "2",
|
B: "2",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8e390a5d38,
|
0x7f8e390a5d38,
|
||||||
NewPositionFromString("col:100, col:114"),
|
NewPositionFromString("col:100, col:114"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1 0`:
|
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1 0`: testNode{&AllocSizeAttr{
|
||||||
testNode{&AllocSizeAttr{
|
|
||||||
Addr: 0x7fbd1a167f48,
|
Addr: 0x7fbd1a167f48,
|
||||||
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
||||||
Inherited: true,
|
Inherited: true,
|
||||||
|
@ -27,12 +25,11 @@ func TestAllocSizeAttr(t *testing.T) {
|
||||||
B: "0",
|
B: "0",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fbd1a167f48,
|
0x7fbd1a167f48,
|
||||||
NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1`:
|
`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1`: testNode{&AllocSizeAttr{
|
||||||
testNode{&AllocSizeAttr{
|
|
||||||
Addr: 0x7fbd1a167f48,
|
Addr: 0x7fbd1a167f48,
|
||||||
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
Pos: NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
||||||
Inherited: true,
|
Inherited: true,
|
||||||
|
@ -40,9 +37,9 @@ func TestAllocSizeAttr(t *testing.T) {
|
||||||
B: "",
|
B: "",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fbd1a167f48,
|
0x7fbd1a167f48,
|
||||||
NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
NewPositionFromString("/usr/include/stdlib.h:342:37"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestAlwaysInlineAttr(t *testing.T) {
|
func TestAlwaysInlineAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fce780f5018 </usr/include/sys/cdefs.h:313:68> always_inline`:
|
`0x7fce780f5018 </usr/include/sys/cdefs.h:313:68> always_inline`: testNode{&AlwaysInlineAttr{
|
||||||
testNode{&AlwaysInlineAttr{
|
|
||||||
Addr: 0x7fce780f5018,
|
Addr: 0x7fce780f5018,
|
||||||
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:313:68"),
|
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:313:68"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fce780f5018,
|
0x7fce780f5018,
|
||||||
NewPositionFromString("/usr/include/sys/cdefs.h:313:68"),
|
NewPositionFromString("/usr/include/sys/cdefs.h:313:68"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseArcWeakrefUnavailableAttr(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ArcWeakrefUnavailableAttr{
|
return &ArcWeakrefUnavailableAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestArcWeakrefUnavailableAttr(t *testing.T) {
|
func TestArcWeakrefUnavailableAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7>`: testNode{&ArcWeakrefUnavailableAttr{
|
||||||
testNode{&ArcWeakrefUnavailableAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
func TestArrayFiller(t *testing.T) {
|
func TestArrayFiller(t *testing.T) {
|
||||||
i := 0
|
i := 0
|
||||||
runNodeTest(t, Parse(`array filler`),
|
runNodeTest(t, Parse(`array filler`),
|
||||||
testNode{ &ArrayFiller{ ChildNodes: []Node{} },
|
testNode{&ArrayFiller{ChildNodes: []Node{}},
|
||||||
0,NewPositionFromString(""),[]Node{}},
|
0, NewPositionFromString(""), []Node{}},
|
||||||
&i)
|
&i)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ package ast
|
||||||
|
|
||||||
// ArraySubscriptExpr is expression.
|
// ArraySubscriptExpr is expression.
|
||||||
type ArraySubscriptExpr struct {
|
type ArraySubscriptExpr struct {
|
||||||
Addr Address
|
Addr Address
|
||||||
Pos Position
|
Pos Position
|
||||||
Type string
|
Type string
|
||||||
Type2 string
|
Type2 string
|
||||||
IsLvalue bool
|
IsLvalue bool
|
||||||
IsVectorComponent bool
|
IsVectorComponent bool
|
||||||
ChildNodes []Node
|
ChildNodes []Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseArraySubscriptExpr(line string) Node {
|
func parseArraySubscriptExpr(line string) Node {
|
||||||
|
@ -23,13 +23,13 @@ func parseArraySubscriptExpr(line string) Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ArraySubscriptExpr{
|
return &ArraySubscriptExpr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Type: groups["type"],
|
Type: groups["type"],
|
||||||
Type2: groups["type2"],
|
Type2: groups["type2"],
|
||||||
IsLvalue: len(groups["lvalue"]) > 0,
|
IsLvalue: len(groups["lvalue"]) > 0,
|
||||||
IsVectorComponent: len(groups["vcomp"]) > 0,
|
IsVectorComponent: len(groups["vcomp"]) > 0,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestArraySubscriptExpr(t *testing.T) {
|
func TestArraySubscriptExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fe35b85d180 <col:63, col:69> 'char *' lvalue`:
|
`0x7fe35b85d180 <col:63, col:69> 'char *' lvalue`: testNode{&ArraySubscriptExpr{
|
||||||
testNode{&ArraySubscriptExpr{
|
|
||||||
Addr: 0x7fe35b85d180,
|
Addr: 0x7fe35b85d180,
|
||||||
Pos: NewPositionFromString("col:63, col:69"),
|
Pos: NewPositionFromString("col:63, col:69"),
|
||||||
Type: "char *",
|
Type: "char *",
|
||||||
|
@ -15,12 +14,11 @@ func TestArraySubscriptExpr(t *testing.T) {
|
||||||
IsLvalue: true,
|
IsLvalue: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fe35b85d180,
|
0x7fe35b85d180,
|
||||||
NewPositionFromString("col:63, col:69"),
|
NewPositionFromString("col:63, col:69"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x2416660 <col:2, col:5> 'u32':'unsigned int' lvalue`:
|
`0x2416660 <col:2, col:5> 'u32':'unsigned int' lvalue`: testNode{&ArraySubscriptExpr{
|
||||||
testNode{&ArraySubscriptExpr{
|
|
||||||
Addr: 0x2416660,
|
Addr: 0x2416660,
|
||||||
Pos: NewPositionFromString("col:2, col:5"),
|
Pos: NewPositionFromString("col:2, col:5"),
|
||||||
Type: "u32",
|
Type: "u32",
|
||||||
|
@ -28,12 +26,11 @@ func TestArraySubscriptExpr(t *testing.T) {
|
||||||
IsLvalue: true,
|
IsLvalue: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2416660,
|
0x2416660,
|
||||||
NewPositionFromString("col:2, col:5"),
|
NewPositionFromString("col:2, col:5"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x3f147c0 <col:39, col:55> 'extCoord':'extCoord' lvalue`:
|
`0x3f147c0 <col:39, col:55> 'extCoord':'extCoord' lvalue`: testNode{&ArraySubscriptExpr{
|
||||||
testNode{&ArraySubscriptExpr{
|
|
||||||
Addr: 0x3f147c0,
|
Addr: 0x3f147c0,
|
||||||
Pos: NewPositionFromString("col:39, col:55"),
|
Pos: NewPositionFromString("col:39, col:55"),
|
||||||
Type: "extCoord",
|
Type: "extCoord",
|
||||||
|
@ -41,9 +38,9 @@ func TestArraySubscriptExpr(t *testing.T) {
|
||||||
IsLvalue: true,
|
IsLvalue: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x3f147c0,
|
0x3f147c0,
|
||||||
NewPositionFromString("col:39, col:55"),
|
NewPositionFromString("col:39, col:55"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,29 +6,27 @@ import (
|
||||||
|
|
||||||
func TestAsmLabelAttr(t *testing.T) {
|
func TestAsmLabelAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7ff26d8224e8 </usr/include/sys/cdefs.h:569:36> "_fopen"`:
|
`0x7ff26d8224e8 </usr/include/sys/cdefs.h:569:36> "_fopen"`: testNode{&AsmLabelAttr{
|
||||||
testNode{&AsmLabelAttr{
|
|
||||||
Addr: 0x7ff26d8224e8,
|
Addr: 0x7ff26d8224e8,
|
||||||
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:569:36"),
|
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:569:36"),
|
||||||
Inherited: false,
|
Inherited: false,
|
||||||
FunctionName: "_fopen",
|
FunctionName: "_fopen",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7ff26d8224e8,
|
0x7ff26d8224e8,
|
||||||
NewPositionFromString("/usr/include/sys/cdefs.h:569:36"),
|
NewPositionFromString("/usr/include/sys/cdefs.h:569:36"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fd55a169318 </usr/include/stdio.h:325:47> Inherited "_popen"`:
|
`0x7fd55a169318 </usr/include/stdio.h:325:47> Inherited "_popen"`: testNode{&AsmLabelAttr{
|
||||||
testNode{&AsmLabelAttr{
|
|
||||||
Addr: 0x7fd55a169318,
|
Addr: 0x7fd55a169318,
|
||||||
Pos: NewPositionFromString("/usr/include/stdio.h:325:47"),
|
Pos: NewPositionFromString("/usr/include/stdio.h:325:47"),
|
||||||
Inherited: true,
|
Inherited: true,
|
||||||
FunctionName: "_popen",
|
FunctionName: "_popen",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fd55a169318,
|
0x7fd55a169318,
|
||||||
NewPositionFromString("/usr/include/stdio.h:325:47"),
|
NewPositionFromString("/usr/include/stdio.h:325:47"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
TrackPositions bool = false
|
TrackPositions bool = false
|
||||||
Debug = false
|
Debug = false
|
||||||
)
|
)
|
||||||
|
|
||||||
// Node represents any node in the AST.
|
// Node represents any node in the AST.
|
||||||
|
@ -252,9 +252,9 @@ func Parse(fullline string) Node {
|
||||||
case "ObjCIndependentClassAttr":
|
case "ObjCIndependentClassAttr":
|
||||||
return parseObjCIndependentClassAttr(line)
|
return parseObjCIndependentClassAttr(line)
|
||||||
case "ObjCInterface":
|
case "ObjCInterface":
|
||||||
return parseObjCInterface(line,false)
|
return parseObjCInterface(line, false)
|
||||||
case "super ObjCInterface":
|
case "super ObjCInterface":
|
||||||
return parseObjCInterface(line,true)
|
return parseObjCInterface(line, true)
|
||||||
case "ObjCInterfaceDecl":
|
case "ObjCInterfaceDecl":
|
||||||
return parseObjCInterfaceDecl(line)
|
return parseObjCInterfaceDecl(line)
|
||||||
case "ObjCInterfaceType":
|
case "ObjCInterfaceType":
|
||||||
|
@ -394,7 +394,7 @@ func Parse(fullline string) Node {
|
||||||
case "NullStmt":
|
case "NullStmt":
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return parseUnknown(nodeName,line)
|
return parseUnknown(nodeName, line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type testNode struct {
|
type testNode struct {
|
||||||
n Node
|
n Node
|
||||||
addr Address
|
addr Address
|
||||||
pos Position
|
pos Position
|
||||||
children []Node
|
children []Node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,24 +30,24 @@ func formatMultiLine(o interface{}) string {
|
||||||
|
|
||||||
func runNodeTest(t *testing.T, actual Node, expected testNode, i *int) {
|
func runNodeTest(t *testing.T, actual Node, expected testNode, i *int) {
|
||||||
testName := fmt.Sprintf("Example%d", *i)
|
testName := fmt.Sprintf("Example%d", *i)
|
||||||
t.Run(testName + "a", func(t *testing.T) {
|
t.Run(testName+"a", func(t *testing.T) {
|
||||||
if !reflect.DeepEqual(expected.n, actual) {
|
if !reflect.DeepEqual(expected.n, actual) {
|
||||||
t.Errorf("%s", util.ShowDiff(formatMultiLine(expected.n),
|
t.Errorf("%s", util.ShowDiff(formatMultiLine(expected.n),
|
||||||
formatMultiLine(actual)))
|
formatMultiLine(actual)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
t.Run(testName+"b", func(t *testing.T) {
|
t.Run(testName+"b", func(t *testing.T) {
|
||||||
if !reflect.DeepEqual(actual.Address(),expected.addr) {
|
if !reflect.DeepEqual(actual.Address(), expected.addr) {
|
||||||
t.Errorf("Address mismatch")
|
t.Errorf("Address mismatch")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
t.Run(testName+"c", func(t *testing.T) {
|
t.Run(testName+"c", func(t *testing.T) {
|
||||||
if !reflect.DeepEqual(actual.Position(),expected.pos) {
|
if !reflect.DeepEqual(actual.Position(), expected.pos) {
|
||||||
t.Errorf("Position mismatch")
|
t.Errorf("Position mismatch")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
t.Run(testName+"d", func(t *testing.T) {
|
t.Run(testName+"d", func(t *testing.T) {
|
||||||
if !reflect.DeepEqual(actual.Children(),expected.children) {
|
if !reflect.DeepEqual(actual.Children(), expected.children) {
|
||||||
t.Errorf("Children mismatch")
|
t.Errorf("Children mismatch")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -55,8 +55,8 @@ func runNodeTest(t *testing.T, actual Node, expected testNode, i *int) {
|
||||||
cs := expected.children
|
cs := expected.children
|
||||||
node := &Unknown{}
|
node := &Unknown{}
|
||||||
actual.AddChild(node)
|
actual.AddChild(node)
|
||||||
cs = append(cs,node)
|
cs = append(cs, node)
|
||||||
if !reflect.DeepEqual(actual.Children(),cs) {
|
if !reflect.DeepEqual(actual.Children(), cs) {
|
||||||
t.Errorf("Children mismatch")
|
t.Errorf("Children mismatch")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -71,7 +71,7 @@ func runNodeTests(t *testing.T, tests map[string]testNode) {
|
||||||
name := reflect.TypeOf(expected.n).Elem().Name()
|
name := reflect.TypeOf(expected.n).Elem().Name()
|
||||||
actual := Parse(name + " " + line)
|
actual := Parse(name + " " + line)
|
||||||
|
|
||||||
runNodeTest(t,actual,expected,&i)
|
runNodeTest(t, actual, expected, &i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func TestPrint(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var lines = []string{
|
var lines = []string{
|
||||||
// c2go ast sqlite3.c | head -5000 | sed 's/^[ |`-]*//' | sed 's/<<<NULL>>>/NullStmt/g' | gawk 'length > 0 {print "`" $0 "`,"}'
|
// c2go ast sqlite3.c | head -5000 | sed 's/^[ |`-]*//' | sed 's/<<<NULL>>>/NullStmt/g' | gawk 'length > 0 {print "`" $0 "`,"}'
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkParse(b *testing.B) {
|
func BenchmarkParse(b *testing.B) {
|
||||||
|
@ -106,4 +106,3 @@ func BenchmarkParse(b *testing.B) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ func parseAttributedType(line string) Node {
|
||||||
return &AttributedType{
|
return &AttributedType{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Type: groups["type"],
|
Type: groups["type"],
|
||||||
Sugar: len(groups["sugar"])>0,
|
Sugar: len(groups["sugar"]) > 0,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,82 +6,75 @@ import (
|
||||||
|
|
||||||
func TestAttributedType(t *testing.T) {
|
func TestAttributedType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x10c0d6770 'CVDisplayLinkRef _Nonnull' sugar`:
|
`0x10c0d6770 'CVDisplayLinkRef _Nonnull' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x10c0d6770,
|
Addr: 0x10c0d6770,
|
||||||
Type: `CVDisplayLinkRef _Nonnull`,
|
Type: `CVDisplayLinkRef _Nonnull`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x10c0d6770,
|
0x10c0d6770,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x10c0d68b0 'const CVTimeStamp * _Nonnull' sugar`:
|
`0x10c0d68b0 'const CVTimeStamp * _Nonnull' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x10c0d68b0,
|
Addr: 0x10c0d68b0,
|
||||||
Type: `const CVTimeStamp * _Nonnull`,
|
Type: `const CVTimeStamp * _Nonnull`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x10c0d68b0,
|
0x10c0d68b0,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x10c0d6ab0 'CVOptionFlags * _Nonnull' sugar`:
|
`0x10c0d6ab0 'CVOptionFlags * _Nonnull' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x10c0d6ab0,
|
Addr: 0x10c0d6ab0,
|
||||||
Type: `CVOptionFlags * _Nonnull`,
|
Type: `CVOptionFlags * _Nonnull`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x10c0d6ab0,
|
0x10c0d6ab0,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x10c0fc7d0 'CVPixelBufferRef _Nonnull' sugar`:
|
`0x10c0fc7d0 'CVPixelBufferRef _Nonnull' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x10c0fc7d0,
|
Addr: 0x10c0fc7d0,
|
||||||
Type: `CVPixelBufferRef _Nonnull`,
|
Type: `CVPixelBufferRef _Nonnull`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x10c0fc7d0,
|
0x10c0fc7d0,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7faa1906d680 'NSError * _Nullable' sugar`:
|
`0x7faa1906d680 'NSError * _Nullable' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x7faa1906d680,
|
Addr: 0x7faa1906d680,
|
||||||
Type: `NSError * _Nullable`,
|
Type: `NSError * _Nullable`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7faa1906d680,
|
0x7faa1906d680,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7faa19085760 'id<NSSecureCoding> _Nullable' sugar`:
|
`0x7faa19085760 'id<NSSecureCoding> _Nullable' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x7faa19085760,
|
Addr: 0x7faa19085760,
|
||||||
Type: `id<NSSecureCoding> _Nullable`,
|
Type: `id<NSSecureCoding> _Nullable`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7faa19085760,
|
0x7faa19085760,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7faa19085840 'NSError * _Null_unspecified' sugar`:
|
`0x7faa19085840 'NSError * _Null_unspecified' sugar`: testNode{&AttributedType{
|
||||||
testNode{&AttributedType{
|
|
||||||
Addr: 0x7faa19085840,
|
Addr: 0x7faa19085840,
|
||||||
Type: `NSError * _Null_unspecified`,
|
Type: `NSError * _Null_unspecified`,
|
||||||
Sugar: true,
|
Sugar: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7faa19085840,
|
0x7faa19085840,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestAvailabilityAttr(t *testing.T) {
|
func TestAvailabilityAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc5ff8e5d18 </usr/include/AvailabilityInternal.h:21697:88, col:124> macos 10.10 0 0 "" ""`:
|
`0x7fc5ff8e5d18 </usr/include/AvailabilityInternal.h:21697:88, col:124> macos 10.10 0 0 "" ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8e5d18,
|
Addr: 0x7fc5ff8e5d18,
|
||||||
Pos: NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"),
|
Pos: NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"),
|
||||||
OS: "macos",
|
OS: "macos",
|
||||||
|
@ -20,12 +19,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8e5d18,
|
0x7fc5ff8e5d18,
|
||||||
NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"),
|
NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc5ff8e60d0 </usr/include/Availability.h:215:81, col:115> watchos 3.0 0 0 "" ""`:
|
`0x7fc5ff8e60d0 </usr/include/Availability.h:215:81, col:115> watchos 3.0 0 0 "" ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8e60d0,
|
Addr: 0x7fc5ff8e60d0,
|
||||||
Pos: NewPositionFromString("/usr/include/Availability.h:215:81, col:115"),
|
Pos: NewPositionFromString("/usr/include/Availability.h:215:81, col:115"),
|
||||||
OS: "watchos",
|
OS: "watchos",
|
||||||
|
@ -38,12 +36,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8e60d0,
|
0x7fc5ff8e60d0,
|
||||||
NewPositionFromString("/usr/include/Availability.h:215:81, col:115"),
|
NewPositionFromString("/usr/include/Availability.h:215:81, col:115"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc5ff8e6170 <col:81, col:115> tvos 10.0 0 0 "" ""`:
|
`0x7fc5ff8e6170 <col:81, col:115> tvos 10.0 0 0 "" ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8e6170,
|
Addr: 0x7fc5ff8e6170,
|
||||||
Pos: NewPositionFromString("col:81, col:115"),
|
Pos: NewPositionFromString("col:81, col:115"),
|
||||||
OS: "tvos",
|
OS: "tvos",
|
||||||
|
@ -56,12 +53,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8e6170,
|
0x7fc5ff8e6170,
|
||||||
NewPositionFromString("col:81, col:115"),
|
NewPositionFromString("col:81, col:115"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc5ff8e61d8 <col:81, col:115> ios 10.0 0 0 "" ""`:
|
`0x7fc5ff8e61d8 <col:81, col:115> ios 10.0 0 0 "" ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8e61d8,
|
Addr: 0x7fc5ff8e61d8,
|
||||||
Pos: NewPositionFromString("col:81, col:115"),
|
Pos: NewPositionFromString("col:81, col:115"),
|
||||||
OS: "ios",
|
OS: "ios",
|
||||||
|
@ -74,12 +70,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8e61d8,
|
0x7fc5ff8e61d8,
|
||||||
NewPositionFromString("col:81, col:115"),
|
NewPositionFromString("col:81, col:115"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc5ff8f0e18 </usr/include/sys/cdefs.h:275:50, col:99> swift 0 0 0 Unavailable "Use snprintf instead." ""`:
|
`0x7fc5ff8f0e18 </usr/include/sys/cdefs.h:275:50, col:99> swift 0 0 0 Unavailable "Use snprintf instead." ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8f0e18,
|
Addr: 0x7fc5ff8f0e18,
|
||||||
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"),
|
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"),
|
||||||
OS: "swift",
|
OS: "swift",
|
||||||
|
@ -92,12 +87,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8f0e18,
|
0x7fc5ff8f0e18,
|
||||||
NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"),
|
NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc5ff8f1988 <line:275:50, col:99> swift 0 0 0 Unavailable "Use mkstemp(3) instead." ""`:
|
`0x7fc5ff8f1988 <line:275:50, col:99> swift 0 0 0 Unavailable "Use mkstemp(3) instead." ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7fc5ff8f1988,
|
Addr: 0x7fc5ff8f1988,
|
||||||
Pos: NewPositionFromString("line:275:50, col:99"),
|
Pos: NewPositionFromString("line:275:50, col:99"),
|
||||||
OS: "swift",
|
OS: "swift",
|
||||||
|
@ -110,12 +104,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc5ff8f1988,
|
0x7fc5ff8f1988,
|
||||||
NewPositionFromString("line:275:50, col:99"),
|
NewPositionFromString("line:275:50, col:99"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x104035438 </usr/include/AvailabilityInternal.h:14571:88, col:124> macosx 10.10 0 0 ""`:
|
`0x104035438 </usr/include/AvailabilityInternal.h:14571:88, col:124> macosx 10.10 0 0 ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x104035438,
|
Addr: 0x104035438,
|
||||||
Pos: NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"),
|
Pos: NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"),
|
||||||
OS: "macosx",
|
OS: "macosx",
|
||||||
|
@ -128,12 +121,11 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x104035438,
|
0x104035438,
|
||||||
NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"),
|
NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f9bd588b1a8 </usr/include/gethostuuid.h:39:65, col:100> Inherited macos 10.5 0 0 "" ""`:
|
`0x7f9bd588b1a8 </usr/include/gethostuuid.h:39:65, col:100> Inherited macos 10.5 0 0 "" ""`: testNode{&AvailabilityAttr{
|
||||||
testNode{&AvailabilityAttr{
|
|
||||||
Addr: 0x7f9bd588b1a8,
|
Addr: 0x7f9bd588b1a8,
|
||||||
Pos: NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"),
|
Pos: NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"),
|
||||||
OS: "macos",
|
OS: "macos",
|
||||||
|
@ -146,9 +138,9 @@ func TestAvailabilityAttr(t *testing.T) {
|
||||||
IsInherited: true,
|
IsInherited: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9bd588b1a8,
|
0x7f9bd588b1a8,
|
||||||
NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"),
|
NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ func parseBinaryOperator(line string) Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &BinaryOperator{
|
return &BinaryOperator{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Type: groups["type1"],
|
Type: groups["type1"],
|
||||||
//Type2: groups["type2"],
|
//Type2: groups["type2"],
|
||||||
Operator: groups["operator"],
|
Operator: groups["operator"],
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
|
|
|
@ -6,20 +6,18 @@ import (
|
||||||
|
|
||||||
func TestBinaryOperator(t *testing.T) {
|
func TestBinaryOperator(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fca2d8070e0 <col:11, col:23> 'unsigned char' '='`:
|
`0x7fca2d8070e0 <col:11, col:23> 'unsigned char' '='`: testNode{&BinaryOperator{
|
||||||
testNode{&BinaryOperator{
|
|
||||||
Addr: 0x7fca2d8070e0,
|
Addr: 0x7fca2d8070e0,
|
||||||
Pos: NewPositionFromString("col:11, col:23"),
|
Pos: NewPositionFromString("col:11, col:23"),
|
||||||
Type: "unsigned char",
|
Type: "unsigned char",
|
||||||
Operator: "=",
|
Operator: "=",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fca2d8070e0,
|
0x7fca2d8070e0,
|
||||||
NewPositionFromString("col:11, col:23"),
|
NewPositionFromString("col:11, col:23"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x1ff95b8 <line:78:2, col:7> 'T_ENUM':'T_ENUM' '='`:
|
`0x1ff95b8 <line:78:2, col:7> 'T_ENUM':'T_ENUM' '='`: testNode{&BinaryOperator{
|
||||||
testNode{&BinaryOperator{
|
|
||||||
Addr: 0x1ff95b8,
|
Addr: 0x1ff95b8,
|
||||||
Pos: NewPositionFromString("line:78:2, col:7"),
|
Pos: NewPositionFromString("line:78:2, col:7"),
|
||||||
Type: "T_ENUM",
|
Type: "T_ENUM",
|
||||||
|
@ -27,9 +25,9 @@ func TestBinaryOperator(t *testing.T) {
|
||||||
Operator: "=",
|
Operator: "=",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x1ff95b8,
|
0x1ff95b8,
|
||||||
NewPositionFromString("line:78:2, col:7"),
|
NewPositionFromString("line:78:2, col:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestBlockCommandComment(t *testing.T) {
|
func TestBlockCommandComment(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x1069fae60 <col:4, line:163:57> Name="abstract"`:
|
`0x1069fae60 <col:4, line:163:57> Name="abstract"`: testNode{&BlockCommandComment{
|
||||||
testNode{&BlockCommandComment{
|
|
||||||
Addr: 0x1069fae60,
|
Addr: 0x1069fae60,
|
||||||
Pos: NewPositionFromString("col:4, line:163:57"),
|
Pos: NewPositionFromString("col:4, line:163:57"),
|
||||||
Name: "abstract",
|
Name: "abstract",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x1069fae60,
|
0x1069fae60,
|
||||||
NewPositionFromString("col:4, line:163:57"),
|
NewPositionFromString("col:4, line:163:57"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,25 +6,23 @@ import (
|
||||||
|
|
||||||
func TestBlockPointerType(t *testing.T) {
|
func TestBlockPointerType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fa3b88bbb30 'void (^)(void)'`:
|
`0x7fa3b88bbb30 'void (^)(void)'`: testNode{&BlockPointerType{
|
||||||
testNode{&BlockPointerType{
|
|
||||||
Addr: 0x7fa3b88bbb30,
|
Addr: 0x7fa3b88bbb30,
|
||||||
Type: `void (^)(void)`,
|
Type: `void (^)(void)`,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fa3b88bbb30,
|
0x7fa3b88bbb30,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fa3b88bbb30 'NSComparisonResult (^)(id _Nonnull, id _Nonnull)'`:
|
`0x7fa3b88bbb30 'NSComparisonResult (^)(id _Nonnull, id _Nonnull)'`: testNode{&BlockPointerType{
|
||||||
testNode{&BlockPointerType{
|
|
||||||
Addr: 0x7fa3b88bbb30,
|
Addr: 0x7fa3b88bbb30,
|
||||||
Type: `NSComparisonResult (^)(id _Nonnull, id _Nonnull)`,
|
Type: `NSComparisonResult (^)(id _Nonnull, id _Nonnull)`,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fa3b88bbb30,
|
0x7fa3b88bbb30,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestBreakStmt(t *testing.T) {
|
func TestBreakStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fca2d8070e0 <col:11, col:23>`:
|
`0x7fca2d8070e0 <col:11, col:23>`: testNode{&BreakStmt{
|
||||||
testNode{&BreakStmt{
|
|
||||||
Addr: 0x7fca2d8070e0,
|
Addr: 0x7fca2d8070e0,
|
||||||
Pos: NewPositionFromString("col:11, col:23"),
|
Pos: NewPositionFromString("col:11, col:23"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fca2d8070e0,
|
0x7fca2d8070e0,
|
||||||
NewPositionFromString("col:11, col:23"),
|
NewPositionFromString("col:11, col:23"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,25 +6,23 @@ import (
|
||||||
|
|
||||||
func TestBuiltinType(t *testing.T) {
|
func TestBuiltinType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f8a43023f40 '__int128'`:
|
`0x7f8a43023f40 '__int128'`: testNode{&BuiltinType{
|
||||||
testNode{&BuiltinType{
|
|
||||||
Addr: 0x7f8a43023f40,
|
Addr: 0x7f8a43023f40,
|
||||||
Type: "__int128",
|
Type: "__int128",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8a43023f40,
|
0x7f8a43023f40,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f8a43023ea0 'unsigned long long'`:
|
`0x7f8a43023ea0 'unsigned long long'`: testNode{&BuiltinType{
|
||||||
testNode{&BuiltinType{
|
|
||||||
Addr: 0x7f8a43023ea0,
|
Addr: 0x7f8a43023ea0,
|
||||||
Type: "unsigned long long",
|
Type: "unsigned long long",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8a43023ea0,
|
0x7f8a43023ea0,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ func parseCStyleCastExpr(line string) Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &CStyleCastExpr{
|
return &CStyleCastExpr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Type: groups["type1"],
|
Type: groups["type1"],
|
||||||
//Type2: groups["type2"],
|
//Type2: groups["type2"],
|
||||||
Kind: groups["kind"],
|
Kind: groups["kind"],
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
|
|
|
@ -6,20 +6,18 @@ import (
|
||||||
|
|
||||||
func TestCStyleCastExpr(t *testing.T) {
|
func TestCStyleCastExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fddc18fb2e0 <col:50, col:56> 'char' <IntegralCast>`:
|
`0x7fddc18fb2e0 <col:50, col:56> 'char' <IntegralCast>`: testNode{&CStyleCastExpr{
|
||||||
testNode{&CStyleCastExpr{
|
|
||||||
Addr: 0x7fddc18fb2e0,
|
Addr: 0x7fddc18fb2e0,
|
||||||
Pos: NewPositionFromString("col:50, col:56"),
|
Pos: NewPositionFromString("col:50, col:56"),
|
||||||
Type: "char",
|
Type: "char",
|
||||||
Kind: "IntegralCast",
|
Kind: "IntegralCast",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fddc18fb2e0,
|
0x7fddc18fb2e0,
|
||||||
NewPositionFromString("col:50, col:56"),
|
NewPositionFromString("col:50, col:56"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x2781518 <col:7, col:17> 'T_ENUM':'T_ENUM' <IntegralCast>`:
|
`0x2781518 <col:7, col:17> 'T_ENUM':'T_ENUM' <IntegralCast>`: testNode{&CStyleCastExpr{
|
||||||
testNode{&CStyleCastExpr{
|
|
||||||
Addr: 0x2781518,
|
Addr: 0x2781518,
|
||||||
Pos: NewPositionFromString("col:7, col:17"),
|
Pos: NewPositionFromString("col:7, col:17"),
|
||||||
Type: "T_ENUM",
|
Type: "T_ENUM",
|
||||||
|
@ -27,9 +25,9 @@ func TestCStyleCastExpr(t *testing.T) {
|
||||||
Kind: "IntegralCast",
|
Kind: "IntegralCast",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2781518,
|
0x2781518,
|
||||||
NewPositionFromString("col:7, col:17"),
|
NewPositionFromString("col:7, col:17"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,27 +6,25 @@ import (
|
||||||
|
|
||||||
func TestCallExpr(t *testing.T) {
|
func TestCallExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f9bf3033240 <col:11, col:25> 'int'`:
|
`0x7f9bf3033240 <col:11, col:25> 'int'`: testNode{&CallExpr{
|
||||||
testNode{&CallExpr{
|
|
||||||
Addr: 0x7f9bf3033240,
|
Addr: 0x7f9bf3033240,
|
||||||
Pos: NewPositionFromString("col:11, col:25"),
|
Pos: NewPositionFromString("col:11, col:25"),
|
||||||
Type: "int",
|
Type: "int",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9bf3033240,
|
0x7f9bf3033240,
|
||||||
NewPositionFromString("col:11, col:25"),
|
NewPositionFromString("col:11, col:25"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f9bf3035c20 <line:7:4, col:64> 'int'`:
|
`0x7f9bf3035c20 <line:7:4, col:64> 'int'`: testNode{&CallExpr{
|
||||||
testNode{&CallExpr{
|
|
||||||
Addr: 0x7f9bf3035c20,
|
Addr: 0x7f9bf3035c20,
|
||||||
Pos: NewPositionFromString("line:7:4, col:64"),
|
Pos: NewPositionFromString("line:7:4, col:64"),
|
||||||
Type: "int",
|
Type: "int",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9bf3035c20,
|
0x7f9bf3035c20,
|
||||||
NewPositionFromString("line:7:4, col:64"),
|
NewPositionFromString("line:7:4, col:64"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestCaseStmt(t *testing.T) {
|
func TestCaseStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc8b5094688 <line:11:5, line:12:21>`:
|
`0x7fc8b5094688 <line:11:5, line:12:21>`: testNode{&CaseStmt{
|
||||||
testNode{&CaseStmt{
|
|
||||||
Addr: 0x7fc8b5094688,
|
Addr: 0x7fc8b5094688,
|
||||||
Pos: NewPositionFromString("line:11:5, line:12:21"),
|
Pos: NewPositionFromString("line:11:5, line:12:21"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc8b5094688,
|
0x7fc8b5094688,
|
||||||
NewPositionFromString("line:11:5, line:12:21"),
|
NewPositionFromString("line:11:5, line:12:21"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseCFAuditedTransferAttr(line string) Node {
|
||||||
"<(?P<position>.*)>(?P<content>.*)",
|
"<(?P<position>.*)>(?P<content>.*)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &CFAuditedTransferAttr{
|
return &CFAuditedTransferAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestCFAuditedTransferAttr(t *testing.T) {
|
func TestCFAuditedTransferAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7> content`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7> content`: testNode{&CFAuditedTransferAttr{
|
||||||
testNode{&CFAuditedTransferAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
Content: " content",
|
Content: " content",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseCFConsumedAttr(line string) Node {
|
||||||
"<(?P<position>.*)>(?P<content>.*)",
|
"<(?P<position>.*)>(?P<content>.*)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &CFConsumedAttr{
|
return &CFConsumedAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestCFConsumedAttr(t *testing.T) {
|
func TestCFConsumedAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7> content`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7> content`: testNode{&CFConsumedAttr{
|
||||||
testNode{&CFConsumedAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
Content: " content",
|
Content: " content",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseCFReturnsNotRetainedAttr(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &CFReturnsNotRetainedAttr{
|
return &CFReturnsNotRetainedAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestCFReturnsNotRetainedAttr(t *testing.T) {
|
func TestCFReturnsNotRetainedAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7>`: testNode{&CFReturnsNotRetainedAttr{
|
||||||
testNode{&CFReturnsNotRetainedAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseCFReturnsRetainedAttr(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &CFReturnsRetainedAttr{
|
return &CFReturnsRetainedAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestCFReturnsRetainedAttr(t *testing.T) {
|
func TestCFReturnsRetainedAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7>`: testNode{&CFReturnsRetainedAttr{
|
||||||
testNode{&CFReturnsRetainedAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,16 @@ import (
|
||||||
|
|
||||||
func TestCharacterLiteral(t *testing.T) {
|
func TestCharacterLiteral(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f980b858308 <col:62> 'int' 10`:
|
`0x7f980b858308 <col:62> 'int' 10`: testNode{&CharacterLiteral{
|
||||||
testNode{&CharacterLiteral{
|
|
||||||
Addr: 0x7f980b858308,
|
Addr: 0x7f980b858308,
|
||||||
Pos: NewPositionFromString("col:62"),
|
Pos: NewPositionFromString("col:62"),
|
||||||
Type: "int",
|
Type: "int",
|
||||||
Value: 10,
|
Value: 10,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f980b858308,
|
0x7f980b858308,
|
||||||
NewPositionFromString("col:62"),
|
NewPositionFromString("col:62"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestCompoundAssignOperator(t *testing.T) {
|
func TestCompoundAssignOperator(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x2dc5758 <line:5:2, col:7> 'int' '+=' ComputeLHSTy='int' ComputeResultTy='int'`:
|
`0x2dc5758 <line:5:2, col:7> 'int' '+=' ComputeLHSTy='int' ComputeResultTy='int'`: testNode{&CompoundAssignOperator{
|
||||||
testNode{&CompoundAssignOperator{
|
|
||||||
Addr: 0x2dc5758,
|
Addr: 0x2dc5758,
|
||||||
Pos: NewPositionFromString("line:5:2, col:7"),
|
Pos: NewPositionFromString("line:5:2, col:7"),
|
||||||
Type: "int",
|
Type: "int",
|
||||||
|
@ -16,9 +15,9 @@ func TestCompoundAssignOperator(t *testing.T) {
|
||||||
ComputationResultType: "int",
|
ComputationResultType: "int",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2dc5758,
|
0x2dc5758,
|
||||||
NewPositionFromString("line:5:2, col:7"),
|
NewPositionFromString("line:5:2, col:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,16 @@ import (
|
||||||
|
|
||||||
func TestCompoundLiteralExpr(t *testing.T) {
|
func TestCompoundLiteralExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x5575acce81f0 <col:21, col:40> 'struct node':'struct node' lvalue`:
|
`0x5575acce81f0 <col:21, col:40> 'struct node':'struct node' lvalue`: testNode{&CompoundLiteralExpr{
|
||||||
testNode{&CompoundLiteralExpr{
|
|
||||||
Addr: 0x5575acce81f0,
|
Addr: 0x5575acce81f0,
|
||||||
Pos: NewPositionFromString("col:21, col:40"),
|
Pos: NewPositionFromString("col:21, col:40"),
|
||||||
Type1: "struct node",
|
Type1: "struct node",
|
||||||
Type2: "struct node",
|
Type2: "struct node",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x5575acce81f0,
|
0x5575acce81f0,
|
||||||
NewPositionFromString("col:21, col:40"),
|
NewPositionFromString("col:21, col:40"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,25 +6,23 @@ import (
|
||||||
|
|
||||||
func TestCompoundStmt(t *testing.T) {
|
func TestCompoundStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fbd0f014f18 <col:54, line:358:1>`:
|
`0x7fbd0f014f18 <col:54, line:358:1>`: testNode{&CompoundStmt{
|
||||||
testNode{&CompoundStmt{
|
|
||||||
Addr: 0x7fbd0f014f18,
|
Addr: 0x7fbd0f014f18,
|
||||||
Pos: NewPositionFromString("col:54, line:358:1"),
|
Pos: NewPositionFromString("col:54, line:358:1"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fbd0f014f18,
|
0x7fbd0f014f18,
|
||||||
NewPositionFromString("col:54, line:358:1"),
|
NewPositionFromString("col:54, line:358:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fbd0f8360b8 <line:4:1, line:13:1>`:
|
`0x7fbd0f8360b8 <line:4:1, line:13:1>`: testNode{&CompoundStmt{
|
||||||
testNode{&CompoundStmt{
|
|
||||||
Addr: 0x7fbd0f8360b8,
|
Addr: 0x7fbd0f8360b8,
|
||||||
Pos: NewPositionFromString("line:4:1, line:13:1"),
|
Pos: NewPositionFromString("line:4:1, line:13:1"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fbd0f8360b8,
|
0x7fbd0f8360b8,
|
||||||
NewPositionFromString("line:4:1, line:13:1"),
|
NewPositionFromString("line:4:1, line:13:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestConditionalOperator(t *testing.T) {
|
func TestConditionalOperator(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc6ae0bc678 <col:6, col:89> 'void'`:
|
`0x7fc6ae0bc678 <col:6, col:89> 'void'`: testNode{&ConditionalOperator{
|
||||||
testNode{&ConditionalOperator{
|
|
||||||
Addr: 0x7fc6ae0bc678,
|
Addr: 0x7fc6ae0bc678,
|
||||||
Pos: NewPositionFromString("col:6, col:89"),
|
Pos: NewPositionFromString("col:6, col:89"),
|
||||||
Type: "void",
|
Type: "void",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc6ae0bc678,
|
0x7fc6ae0bc678,
|
||||||
NewPositionFromString("col:6, col:89"),
|
NewPositionFromString("col:6, col:89"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestConstAttr(t *testing.T) {
|
func TestConstAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fa3b88bbb38 <line:4:1, line:13:1>foo`:
|
`0x7fa3b88bbb38 <line:4:1, line:13:1>foo`: testNode{&ConstAttr{
|
||||||
testNode{&ConstAttr{
|
|
||||||
Addr: 0x7fa3b88bbb38,
|
Addr: 0x7fa3b88bbb38,
|
||||||
Pos: NewPositionFromString("line:4:1, line:13:1"),
|
Pos: NewPositionFromString("line:4:1, line:13:1"),
|
||||||
Tags: "foo",
|
Tags: "foo",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fa3b88bbb38,
|
0x7fa3b88bbb38,
|
||||||
NewPositionFromString("line:4:1, line:13:1"),
|
NewPositionFromString("line:4:1, line:13:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,27 +6,25 @@ import (
|
||||||
|
|
||||||
func TestConstantArrayType(t *testing.T) {
|
func TestConstantArrayType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f94ad016a40 'struct __va_list_tag [1]' 1 `:
|
`0x7f94ad016a40 'struct __va_list_tag [1]' 1 `: testNode{&ConstantArrayType{
|
||||||
testNode{&ConstantArrayType{
|
|
||||||
Addr: 0x7f94ad016a40,
|
Addr: 0x7f94ad016a40,
|
||||||
Type: "struct __va_list_tag [1]",
|
Type: "struct __va_list_tag [1]",
|
||||||
Size: 1,
|
Size: 1,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f94ad016a40,
|
0x7f94ad016a40,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f8c5f059d20 'char [37]' 37 `:
|
`0x7f8c5f059d20 'char [37]' 37 `: testNode{&ConstantArrayType{
|
||||||
testNode{&ConstantArrayType{
|
|
||||||
Addr: 0x7f8c5f059d20,
|
Addr: 0x7f8c5f059d20,
|
||||||
Type: "char [37]",
|
Type: "char [37]",
|
||||||
Size: 37,
|
Size: 37,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8c5f059d20,
|
0x7f8c5f059d20,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestContinueStmt(t *testing.T) {
|
func TestContinueStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x1e044e0 <col:20>`:
|
`0x1e044e0 <col:20>`: testNode{&ContinueStmt{
|
||||||
testNode{&ContinueStmt{
|
|
||||||
Addr: 0x1e044e0,
|
Addr: 0x1e044e0,
|
||||||
Pos: NewPositionFromString("col:20"),
|
Pos: NewPositionFromString("col:20"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x1e044e0,
|
0x1e044e0,
|
||||||
NewPositionFromString("col:20"),
|
NewPositionFromString("col:20"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ package ast
|
||||||
|
|
||||||
// ConvertVectorExpr
|
// ConvertVectorExpr
|
||||||
type ConvertVectorExpr struct {
|
type ConvertVectorExpr struct {
|
||||||
Addr Address
|
Addr Address
|
||||||
Pos Position
|
Pos Position
|
||||||
Type string
|
Type string
|
||||||
Type2 string
|
Type2 string
|
||||||
ChildNodes []Node
|
ChildNodes []Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseConvertVectorExpr(line string) Node {
|
func parseConvertVectorExpr(line string) Node {
|
||||||
|
@ -16,16 +16,16 @@ func parseConvertVectorExpr(line string) Node {
|
||||||
(?P<type2>:'.*?')?`,
|
(?P<type2>:'.*?')?`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ConvertVectorExpr{
|
return &ConvertVectorExpr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Type: removeQuotes(groups["type"]),
|
Type: removeQuotes(groups["type"]),
|
||||||
Type2: groups["type2"],
|
Type2: groups["type2"],
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,29 +6,27 @@ import (
|
||||||
|
|
||||||
func TestConvertVectorExpr(t *testing.T) {
|
func TestConvertVectorExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fdef0862430 <line:120:1, col:16>`:
|
`0x7fdef0862430 <line:120:1, col:16>`: testNode{&ConvertVectorExpr{
|
||||||
testNode{&ConvertVectorExpr{
|
Addr: 0x7fdef0862430,
|
||||||
Addr: 0x7fdef0862430,
|
Pos: NewPositionFromString("line:120:1, col:16"),
|
||||||
Pos: NewPositionFromString("line:120:1, col:16"),
|
Type: "",
|
||||||
Type: "",
|
Type2: "",
|
||||||
Type2: "",
|
ChildNodes: []Node{},
|
||||||
ChildNodes: []Node{},
|
|
||||||
},
|
},
|
||||||
0x7fdef0862430,
|
0x7fdef0862430,
|
||||||
NewPositionFromString("line:120:1, col:16"),
|
NewPositionFromString("line:120:1, col:16"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x113368318 <line:1354:20, line:1355:70> '__v2df':'__attribute__((__vector_size__(2 * sizeof(double)))) double'`:
|
`0x113368318 <line:1354:20, line:1355:70> '__v2df':'__attribute__((__vector_size__(2 * sizeof(double)))) double'`: testNode{&ConvertVectorExpr{
|
||||||
testNode{&ConvertVectorExpr{
|
Addr: 0x113368318,
|
||||||
Addr: 0x113368318,
|
Pos: NewPositionFromString("line:1354:20, line:1355:70"),
|
||||||
Pos: NewPositionFromString("line:1354:20, line:1355:70"),
|
Type: `__v2df`,
|
||||||
Type: `__v2df`,
|
Type2: `:'__attribute__((__vector_size__(2 * sizeof(double)))) double'`,
|
||||||
Type2: `:'__attribute__((__vector_size__(2 * sizeof(double)))) double'`,
|
ChildNodes: []Node{},
|
||||||
ChildNodes: []Node{},
|
|
||||||
},
|
},
|
||||||
0x113368318,
|
0x113368318,
|
||||||
NewPositionFromString("line:1354:20, line:1355:70"),
|
NewPositionFromString("line:1354:20, line:1355:70"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestDecayedType(t *testing.T) {
|
func TestDecayedType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f1234567890 'struct __va_list_tag *' sugar`:
|
`0x7f1234567890 'struct __va_list_tag *' sugar`: testNode{&DecayedType{
|
||||||
testNode{&DecayedType{
|
|
||||||
Addr: 0x7f1234567890,
|
Addr: 0x7f1234567890,
|
||||||
Type: "struct __va_list_tag *",
|
Type: "struct __va_list_tag *",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f1234567890,
|
0x7f1234567890,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestDeclRefExpr(t *testing.T) {
|
func TestDeclRefExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`:
|
`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`: testNode{&DeclRefExpr{
|
||||||
testNode{&DeclRefExpr{
|
|
||||||
Addr: 0x7fc972064460,
|
Addr: 0x7fc972064460,
|
||||||
Pos: NewPositionFromString("col:8"),
|
Pos: NewPositionFromString("col:8"),
|
||||||
Type: "FILE *",
|
Type: "FILE *",
|
||||||
|
@ -20,12 +19,11 @@ func TestDeclRefExpr(t *testing.T) {
|
||||||
Type3: "",
|
Type3: "",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc972064460,
|
0x7fc972064460,
|
||||||
NewPositionFromString("col:8"),
|
NewPositionFromString("col:8"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`:
|
`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`: testNode{&DeclRefExpr{
|
||||||
testNode{&DeclRefExpr{
|
|
||||||
Addr: 0x7fc97206a958,
|
Addr: 0x7fc97206a958,
|
||||||
Pos: NewPositionFromString("col:11"),
|
Pos: NewPositionFromString("col:11"),
|
||||||
Type: "int (int, FILE *)",
|
Type: "int (int, FILE *)",
|
||||||
|
@ -38,12 +36,11 @@ func TestDeclRefExpr(t *testing.T) {
|
||||||
Type3: "",
|
Type3: "",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc97206a958,
|
0x7fc97206a958,
|
||||||
NewPositionFromString("col:11"),
|
NewPositionFromString("col:11"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`:
|
`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`: testNode{&DeclRefExpr{
|
||||||
testNode{&DeclRefExpr{
|
|
||||||
Addr: 0x7fa36680f170,
|
Addr: 0x7fa36680f170,
|
||||||
Pos: NewPositionFromString("col:19"),
|
Pos: NewPositionFromString("col:19"),
|
||||||
Type: "struct programming",
|
Type: "struct programming",
|
||||||
|
@ -56,12 +53,11 @@ func TestDeclRefExpr(t *testing.T) {
|
||||||
Type3: "struct programming",
|
Type3: "struct programming",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fa36680f170,
|
0x7fa36680f170,
|
||||||
NewPositionFromString("col:19"),
|
NewPositionFromString("col:19"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`:
|
`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`: testNode{&DeclRefExpr{
|
||||||
testNode{&DeclRefExpr{
|
|
||||||
Addr: 0x35cb438,
|
Addr: 0x35cb438,
|
||||||
Pos: NewPositionFromString("col:13"),
|
Pos: NewPositionFromString("col:13"),
|
||||||
Type: "int",
|
Type: "int",
|
||||||
|
@ -74,12 +70,11 @@ func TestDeclRefExpr(t *testing.T) {
|
||||||
Type3: "",
|
Type3: "",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x35cb438,
|
0x35cb438,
|
||||||
NewPositionFromString("col:13"),
|
NewPositionFromString("col:13"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`:
|
`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`: testNode{&DeclRefExpr{
|
||||||
testNode{&DeclRefExpr{
|
|
||||||
Addr: 0x1ff8770,
|
Addr: 0x1ff8770,
|
||||||
Pos: NewPositionFromString("col:33"),
|
Pos: NewPositionFromString("col:33"),
|
||||||
Type: "T_ENUM",
|
Type: "T_ENUM",
|
||||||
|
@ -92,9 +87,9 @@ func TestDeclRefExpr(t *testing.T) {
|
||||||
Type3: "T_ENUM",
|
Type3: "T_ENUM",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x1ff8770,
|
0x1ff8770,
|
||||||
NewPositionFromString("col:33"),
|
NewPositionFromString("col:33"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestDeclStmt(t *testing.T) {
|
func TestDeclStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fb791846e80 <line:11:4, col:31>`:
|
`0x7fb791846e80 <line:11:4, col:31>`: testNode{&DeclStmt{
|
||||||
testNode{&DeclStmt{
|
|
||||||
Addr: 0x7fb791846e80,
|
Addr: 0x7fb791846e80,
|
||||||
Pos: NewPositionFromString("line:11:4, col:31"),
|
Pos: NewPositionFromString("line:11:4, col:31"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb791846e80,
|
0x7fb791846e80,
|
||||||
NewPositionFromString("line:11:4, col:31"),
|
NewPositionFromString("line:11:4, col:31"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestDefaultStmt(t *testing.T) {
|
func TestDefaultStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f951308bfb0 <line:17:5, line:18:34>`:
|
`0x7f951308bfb0 <line:17:5, line:18:34>`: testNode{&DefaultStmt{
|
||||||
testNode{&DefaultStmt{
|
|
||||||
Addr: 0x7f951308bfb0,
|
Addr: 0x7f951308bfb0,
|
||||||
Pos: NewPositionFromString("line:17:5, line:18:34"),
|
Pos: NewPositionFromString("line:17:5, line:18:34"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f951308bfb0,
|
0x7f951308bfb0,
|
||||||
NewPositionFromString("line:17:5, line:18:34"),
|
NewPositionFromString("line:17:5, line:18:34"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestDeprecatedAttr(t *testing.T) {
|
func TestDeprecatedAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fec4b0ab9c0 <line:180:48, col:63> "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead." ""`:
|
`0x7fec4b0ab9c0 <line:180:48, col:63> "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead." ""`: testNode{&DeprecatedAttr{
|
||||||
testNode{&DeprecatedAttr{
|
|
||||||
Addr: 0x7fec4b0ab9c0,
|
Addr: 0x7fec4b0ab9c0,
|
||||||
Pos: NewPositionFromString("line:180:48, col:63"),
|
Pos: NewPositionFromString("line:180:48, col:63"),
|
||||||
Message1: "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.",
|
Message1: "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.",
|
||||||
|
@ -15,12 +14,11 @@ func TestDeprecatedAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fec4b0ab9c0,
|
0x7fec4b0ab9c0,
|
||||||
NewPositionFromString("line:180:48, col:63"),
|
NewPositionFromString("line:180:48, col:63"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0xb75d00 <line:1107:12> "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`:
|
`0xb75d00 <line:1107:12> "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: testNode{&DeprecatedAttr{
|
||||||
testNode{&DeprecatedAttr{
|
|
||||||
Addr: 0xb75d00,
|
Addr: 0xb75d00,
|
||||||
Pos: NewPositionFromString("line:1107:12"),
|
Pos: NewPositionFromString("line:1107:12"),
|
||||||
Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.",
|
Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.",
|
||||||
|
@ -28,12 +26,11 @@ func TestDeprecatedAttr(t *testing.T) {
|
||||||
IsInherited: false,
|
IsInherited: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0xb75d00,
|
0xb75d00,
|
||||||
NewPositionFromString("line:1107:12"),
|
NewPositionFromString("line:1107:12"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0xb75d00 <line:1107:12> Inherited "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`:
|
`0xb75d00 <line:1107:12> Inherited "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: testNode{&DeprecatedAttr{
|
||||||
testNode{&DeprecatedAttr{
|
|
||||||
Addr: 0xb75d00,
|
Addr: 0xb75d00,
|
||||||
Pos: NewPositionFromString("line:1107:12"),
|
Pos: NewPositionFromString("line:1107:12"),
|
||||||
Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.",
|
Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.",
|
||||||
|
@ -41,9 +38,9 @@ func TestDeprecatedAttr(t *testing.T) {
|
||||||
IsInherited: true,
|
IsInherited: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0xb75d00,
|
0xb75d00,
|
||||||
NewPositionFromString("line:1107:12"),
|
NewPositionFromString("line:1107:12"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestDisableTailCallsAttr(t *testing.T) {
|
func TestDisableTailCallsAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc8fa094558 <col:107> `:
|
`0x7fc8fa094558 <col:107> `: testNode{&DisableTailCallsAttr{
|
||||||
testNode{&DisableTailCallsAttr{
|
|
||||||
Addr: 0x7fc8fa094558,
|
Addr: 0x7fc8fa094558,
|
||||||
Pos: NewPositionFromString("col:107"),
|
Pos: NewPositionFromString("col:107"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc8fa094558,
|
0x7fc8fa094558,
|
||||||
NewPositionFromString("col:107"),
|
NewPositionFromString("col:107"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestDoStmt(t *testing.T) {
|
func TestDoStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7ff36d0a0938 <line:11:5, line:14:23>`:
|
`0x7ff36d0a0938 <line:11:5, line:14:23>`: testNode{&DoStmt{
|
||||||
testNode{&DoStmt{
|
|
||||||
Addr: 0x7ff36d0a0938,
|
Addr: 0x7ff36d0a0938,
|
||||||
Pos: NewPositionFromString("line:11:5, line:14:23"),
|
Pos: NewPositionFromString("line:11:5, line:14:23"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7ff36d0a0938,
|
0x7ff36d0a0938,
|
||||||
NewPositionFromString("line:11:5, line:14:23"),
|
NewPositionFromString("line:11:5, line:14:23"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestElaboratedType(t *testing.T) {
|
func TestElaboratedType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f873686c120 'union __mbstate_t' sugar`:
|
`0x7f873686c120 'union __mbstate_t' sugar`: testNode{&ElaboratedType{
|
||||||
testNode{&ElaboratedType{
|
|
||||||
Addr: 0x7f873686c120,
|
Addr: 0x7f873686c120,
|
||||||
Type: "union __mbstate_t",
|
Type: "union __mbstate_t",
|
||||||
Tags: "sugar",
|
Tags: "sugar",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f873686c120,
|
0x7f873686c120,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestEmptyDecl(t *testing.T) {
|
func TestEmptyDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x480bec8 <col:13> col:13`:
|
`0x480bec8 <col:13> col:13`: testNode{&EmptyDecl{
|
||||||
testNode{&EmptyDecl{
|
|
||||||
Addr: 0x480bec8,
|
Addr: 0x480bec8,
|
||||||
Pos: NewPositionFromString("col:13"),
|
Pos: NewPositionFromString("col:13"),
|
||||||
Position2: NewPositionFromString("col:13"),
|
Position2: NewPositionFromString("col:13"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x480bec8,
|
0x480bec8,
|
||||||
NewPositionFromString("col:13"),
|
NewPositionFromString("col:13"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestEnumConstantDecl(t *testing.T) {
|
func TestEnumConstantDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x1660db0 <line:185:3> __codecvt_noconv 'int'`:
|
`0x1660db0 <line:185:3> __codecvt_noconv 'int'`: testNode{&EnumConstantDecl{
|
||||||
testNode{&EnumConstantDecl{
|
|
||||||
Addr: 0x1660db0,
|
Addr: 0x1660db0,
|
||||||
Pos: NewPositionFromString("line:185:3"),
|
Pos: NewPositionFromString("line:185:3"),
|
||||||
Position2: "",
|
Position2: "",
|
||||||
|
@ -16,12 +15,11 @@ func TestEnumConstantDecl(t *testing.T) {
|
||||||
Type: "int",
|
Type: "int",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x1660db0,
|
0x1660db0,
|
||||||
NewPositionFromString("line:185:3"),
|
NewPositionFromString("line:185:3"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x3c77ba8 <line:59:3, col:65> col:3 referenced _ISalnum 'int'`:
|
`0x3c77ba8 <line:59:3, col:65> col:3 referenced _ISalnum 'int'`: testNode{&EnumConstantDecl{
|
||||||
testNode{&EnumConstantDecl{
|
|
||||||
Addr: 0x3c77ba8,
|
Addr: 0x3c77ba8,
|
||||||
Pos: NewPositionFromString("line:59:3, col:65"),
|
Pos: NewPositionFromString("line:59:3, col:65"),
|
||||||
Position2: "col:3",
|
Position2: "col:3",
|
||||||
|
@ -30,9 +28,9 @@ func TestEnumConstantDecl(t *testing.T) {
|
||||||
Type: "int",
|
Type: "int",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x3c77ba8,
|
0x3c77ba8,
|
||||||
NewPositionFromString("line:59:3, col:65"),
|
NewPositionFromString("line:59:3, col:65"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,11 @@ func parseEnumDecl(line string) Node {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return &EnumDecl{
|
return &EnumDecl{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Position2: groups["position2"],
|
Position2: groups["position2"],
|
||||||
Name: strings.TrimSpace(groups["name"]),
|
Name: strings.TrimSpace(groups["name"]),
|
||||||
Type: removeQuotes(groups["type"]),
|
Type: removeQuotes(groups["type"]),
|
||||||
//Type2: type2,
|
//Type2: type2,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,29 +6,27 @@ import (
|
||||||
|
|
||||||
func TestEnumDecl(t *testing.T) {
|
func TestEnumDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x22a6c80 <line:180:1, line:186:1> __codecvt_result`:
|
`0x22a6c80 <line:180:1, line:186:1> __codecvt_result`: testNode{&EnumDecl{
|
||||||
testNode{&EnumDecl{
|
|
||||||
Addr: 0x22a6c80,
|
Addr: 0x22a6c80,
|
||||||
Pos: NewPositionFromString("line:180:1, line:186:1"),
|
Pos: NewPositionFromString("line:180:1, line:186:1"),
|
||||||
Position2: "",
|
Position2: "",
|
||||||
Name: "__codecvt_result",
|
Name: "__codecvt_result",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x22a6c80,
|
0x22a6c80,
|
||||||
NewPositionFromString("line:180:1, line:186:1"),
|
NewPositionFromString("line:180:1, line:186:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x32fb5a0 <enum.c:3:1, col:45> col:6 week`:
|
`0x32fb5a0 <enum.c:3:1, col:45> col:6 week`: testNode{&EnumDecl{
|
||||||
testNode{&EnumDecl{
|
|
||||||
Addr: 0x32fb5a0,
|
Addr: 0x32fb5a0,
|
||||||
Pos: NewPositionFromString("enum.c:3:1, col:45"),
|
Pos: NewPositionFromString("enum.c:3:1, col:45"),
|
||||||
Position2: " col:6",
|
Position2: " col:6",
|
||||||
Name: "week",
|
Name: "week",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x32fb5a0,
|
0x32fb5a0,
|
||||||
NewPositionFromString("enum.c:3:1, col:45"),
|
NewPositionFromString("enum.c:3:1, col:45"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestEnumExtensibilityAttr(t *testing.T) {
|
func TestEnumExtensibilityAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7> content`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7> content`: testNode{&EnumExtensibilityAttr{
|
||||||
testNode{&EnumExtensibilityAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
Content: " content",
|
Content: " content",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestEnum(t *testing.T) {
|
func TestEnum(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f980b858308 'foo'`:
|
`0x7f980b858308 'foo'`: testNode{&Enum{
|
||||||
testNode{&Enum{
|
|
||||||
Addr: 0x7f980b858308,
|
Addr: 0x7f980b858308,
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f980b858308,
|
0x7f980b858308,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestEnumType(t *testing.T) {
|
func TestEnumType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f980b858309 'foo'`:
|
`0x7f980b858309 'foo'`: testNode{&EnumType{
|
||||||
testNode{&EnumType{
|
|
||||||
Addr: 0x7f980b858309,
|
Addr: 0x7f980b858309,
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f980b858309,
|
0x7f980b858309,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestFieldDecl(t *testing.T) {
|
func TestFieldDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fef510c4848 <line:141:2, col:6> col:6 _ur 'int'`:
|
`0x7fef510c4848 <line:141:2, col:6> col:6 _ur 'int'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fef510c4848,
|
Addr: 0x7fef510c4848,
|
||||||
Pos: NewPositionFromString("line:141:2, col:6"),
|
Pos: NewPositionFromString("line:141:2, col:6"),
|
||||||
Position2: "col:6",
|
Position2: "col:6",
|
||||||
|
@ -18,12 +17,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fef510c4848,
|
0x7fef510c4848,
|
||||||
NewPositionFromString("line:141:2, col:6"),
|
NewPositionFromString("line:141:2, col:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fef510c46f8 <line:139:2, col:16> col:16 _ub 'struct __sbuf':'struct __sbuf'`:
|
`0x7fef510c46f8 <line:139:2, col:16> col:16 _ub 'struct __sbuf':'struct __sbuf'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fef510c46f8,
|
Addr: 0x7fef510c46f8,
|
||||||
Pos: NewPositionFromString("line:139:2, col:16"),
|
Pos: NewPositionFromString("line:139:2, col:16"),
|
||||||
Position2: "col:16",
|
Position2: "col:16",
|
||||||
|
@ -34,12 +32,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fef510c46f8,
|
0x7fef510c46f8,
|
||||||
NewPositionFromString("line:139:2, col:16"),
|
NewPositionFromString("line:139:2, col:16"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fef510c3fe0 <line:134:2, col:19> col:19 _read 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`:
|
`0x7fef510c3fe0 <line:134:2, col:19> col:19 _read 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fef510c3fe0,
|
Addr: 0x7fef510c3fe0,
|
||||||
Pos: NewPositionFromString("line:134:2, col:19"),
|
Pos: NewPositionFromString("line:134:2, col:19"),
|
||||||
Position2: "col:19",
|
Position2: "col:19",
|
||||||
|
@ -50,12 +47,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fef510c3fe0,
|
0x7fef510c3fe0,
|
||||||
NewPositionFromString("line:134:2, col:19"),
|
NewPositionFromString("line:134:2, col:19"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fef51073a60 <line:105:2, col:40> col:40 __cleanup_stack 'struct __darwin_pthread_handler_rec *'`:
|
`0x7fef51073a60 <line:105:2, col:40> col:40 __cleanup_stack 'struct __darwin_pthread_handler_rec *'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fef51073a60,
|
Addr: 0x7fef51073a60,
|
||||||
Pos: NewPositionFromString("line:105:2, col:40"),
|
Pos: NewPositionFromString("line:105:2, col:40"),
|
||||||
Position2: "col:40",
|
Position2: "col:40",
|
||||||
|
@ -66,12 +62,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fef51073a60,
|
0x7fef51073a60,
|
||||||
NewPositionFromString("line:105:2, col:40"),
|
NewPositionFromString("line:105:2, col:40"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fef510738e8 <line:100:2, col:43> col:7 __opaque 'char [16]'`:
|
`0x7fef510738e8 <line:100:2, col:43> col:7 __opaque 'char [16]'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fef510738e8,
|
Addr: 0x7fef510738e8,
|
||||||
Pos: NewPositionFromString("line:100:2, col:43"),
|
Pos: NewPositionFromString("line:100:2, col:43"),
|
||||||
Position2: "col:7",
|
Position2: "col:7",
|
||||||
|
@ -82,12 +77,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fef510738e8,
|
0x7fef510738e8,
|
||||||
NewPositionFromString("line:100:2, col:43"),
|
NewPositionFromString("line:100:2, col:43"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fe9f5072268 <line:129:2, col:6> col:6 referenced _lbfsize 'int'`:
|
`0x7fe9f5072268 <line:129:2, col:6> col:6 referenced _lbfsize 'int'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7fe9f5072268,
|
Addr: 0x7fe9f5072268,
|
||||||
Pos: NewPositionFromString("line:129:2, col:6"),
|
Pos: NewPositionFromString("line:129:2, col:6"),
|
||||||
Position2: "col:6",
|
Position2: "col:6",
|
||||||
|
@ -98,12 +92,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: true,
|
Referenced: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fe9f5072268,
|
0x7fe9f5072268,
|
||||||
NewPositionFromString("line:129:2, col:6"),
|
NewPositionFromString("line:129:2, col:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short'`:
|
`0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x7f9bc9083d00,
|
Addr: 0x7f9bc9083d00,
|
||||||
Pos: NewPositionFromString("line:91:5, line:97:8"),
|
Pos: NewPositionFromString("line:91:5, line:97:8"),
|
||||||
Position2: "line:91:5",
|
Position2: "line:91:5",
|
||||||
|
@ -114,12 +107,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9bc9083d00,
|
0x7f9bc9083d00,
|
||||||
NewPositionFromString("line:91:5, line:97:8"),
|
NewPositionFromString("line:91:5, line:97:8"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x30363a0 <col:18, col:29> __val 'int [2]'`:
|
`0x30363a0 <col:18, col:29> __val 'int [2]'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x30363a0,
|
Addr: 0x30363a0,
|
||||||
Pos: NewPositionFromString("col:18, col:29"),
|
Pos: NewPositionFromString("col:18, col:29"),
|
||||||
Position2: "",
|
Position2: "",
|
||||||
|
@ -130,12 +122,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x30363a0,
|
0x30363a0,
|
||||||
NewPositionFromString("col:18, col:29"),
|
NewPositionFromString("col:18, col:29"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x17aeac0 <line:3:9> col:9 implicit referenced 'struct vec3d_t::(anonymous at main.c:3:9)'`:
|
`0x17aeac0 <line:3:9> col:9 implicit referenced 'struct vec3d_t::(anonymous at main.c:3:9)'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x17aeac0,
|
Addr: 0x17aeac0,
|
||||||
Pos: NewPositionFromString("line:3:9"),
|
Pos: NewPositionFromString("line:3:9"),
|
||||||
Position2: "col:9",
|
Position2: "col:9",
|
||||||
|
@ -146,12 +137,11 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: true,
|
Referenced: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x17aeac0,
|
0x17aeac0,
|
||||||
NewPositionFromString("line:3:9"),
|
NewPositionFromString("line:3:9"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x56498bf52160 <line:269:5, col:21> col:21 type 'enum __pid_type':'enum __pid_type'`:
|
`0x56498bf52160 <line:269:5, col:21> col:21 type 'enum __pid_type':'enum __pid_type'`: testNode{&FieldDecl{
|
||||||
testNode{&FieldDecl{
|
|
||||||
Addr: 0x56498bf52160,
|
Addr: 0x56498bf52160,
|
||||||
Pos: NewPositionFromString("line:269:5, col:21"),
|
Pos: NewPositionFromString("line:269:5, col:21"),
|
||||||
Position2: "col:21",
|
Position2: "col:21",
|
||||||
|
@ -162,9 +152,9 @@ func TestFieldDecl(t *testing.T) {
|
||||||
Referenced: false,
|
Referenced: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x56498bf52160,
|
0x56498bf52160,
|
||||||
NewPositionFromString("line:269:5, col:21"),
|
NewPositionFromString("line:269:5, col:21"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestField(t *testing.T) {
|
func TestField(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x44159a0 '' 'union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)'`:
|
`0x44159a0 '' 'union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)'`: testNode{&Field{
|
||||||
testNode{&Field{
|
|
||||||
Addr: 0x44159a0,
|
Addr: 0x44159a0,
|
||||||
String1: "",
|
String1: "",
|
||||||
String2: "union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)",
|
String2: "union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x44159a0,
|
0x44159a0,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,48 +2,48 @@ package ast
|
||||||
|
|
||||||
// FlagEnumAttr
|
// FlagEnumAttr
|
||||||
type FlagEnumAttr struct {
|
type FlagEnumAttr struct {
|
||||||
Addr Address
|
Addr Address
|
||||||
Pos Position
|
Pos Position
|
||||||
Content string
|
Content string
|
||||||
ChildNodes []Node
|
ChildNodes []Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseFlagEnumAttr(line string) Node {
|
func parseFlagEnumAttr(line string) Node {
|
||||||
groups := groupsFromRegex(
|
groups := groupsFromRegex(
|
||||||
"<(?P<position>.*)>(?P<content>.*)",
|
"<(?P<position>.*)>(?P<content>.*)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &FlagEnumAttr{
|
return &FlagEnumAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
Pos: NewPositionFromString(groups["position"]),
|
Pos: NewPositionFromString(groups["position"]),
|
||||||
Content: groups["content"],
|
Content: groups["content"],
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddChild adds a new child node. Child nodes can then be accessed with the
|
// AddChild adds a new child node. Child nodes can then be accessed with the
|
||||||
// Children attribute.
|
// Children attribute.
|
||||||
func (n *FlagEnumAttr) AddChild(node Node) {
|
func (n *FlagEnumAttr) AddChild(node Node) {
|
||||||
n.ChildNodes = append(n.ChildNodes, node)
|
n.ChildNodes = append(n.ChildNodes, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address returns the numeric address of the node. See the documentation for
|
// Address returns the numeric address of the node. See the documentation for
|
||||||
// the Address type for more information.
|
// the Address type for more information.
|
||||||
func (n *FlagEnumAttr) Address() Address {
|
func (n *FlagEnumAttr) Address() Address {
|
||||||
return n.Addr
|
return n.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Children returns the child nodes. If this node does not have any children or
|
// Children returns the child nodes. If this node does not have any children or
|
||||||
// this node does not support children it will always return an empty slice.
|
// this node does not support children it will always return an empty slice.
|
||||||
func (n *FlagEnumAttr) Children() []Node {
|
func (n *FlagEnumAttr) Children() []Node {
|
||||||
return n.ChildNodes
|
return n.ChildNodes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position returns the position in the original source code.
|
// Position returns the position in the original source code.
|
||||||
func (n *FlagEnumAttr) Position() Position {
|
func (n *FlagEnumAttr) Position() Position {
|
||||||
return n.Pos
|
return n.Pos
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestFlagEnumAttr(t *testing.T) {
|
func TestFlagEnumAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7> content`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7> content`: testNode{&FlagEnumAttr{
|
||||||
testNode{&FlagEnumAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
Content: " content",
|
Content: " content",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ast
|
package ast
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"errors"
|
//"errors"
|
||||||
//"fmt"
|
//"fmt"
|
||||||
//"reflect"
|
//"reflect"
|
||||||
|
|
||||||
//"github.com/elliotchance/c2go/cc"
|
//"github.com/elliotchance/c2go/cc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FloatingLiteral is type of float literal
|
// FloatingLiteral is type of float literal
|
||||||
|
|
|
@ -6,29 +6,27 @@ import (
|
||||||
|
|
||||||
func TestFloatingLiteral(t *testing.T) {
|
func TestFloatingLiteral(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`:
|
`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: testNode{&FloatingLiteral{
|
||||||
testNode{&FloatingLiteral{
|
|
||||||
Addr: 0x7febe106f5e8,
|
Addr: 0x7febe106f5e8,
|
||||||
Pos: NewPositionFromString("col:24"),
|
Pos: NewPositionFromString("col:24"),
|
||||||
Type: "double",
|
Type: "double",
|
||||||
Value: 1.23,
|
Value: 1.23,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7febe106f5e8,
|
0x7febe106f5e8,
|
||||||
NewPositionFromString("col:24"),
|
NewPositionFromString("col:24"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x21c65b8 <col:41> 'double' 2.718282e+00`:
|
`0x21c65b8 <col:41> 'double' 2.718282e+00`: testNode{&FloatingLiteral{
|
||||||
testNode{&FloatingLiteral{
|
|
||||||
Addr: 0x21c65b8,
|
Addr: 0x21c65b8,
|
||||||
Pos: NewPositionFromString("col:41"),
|
Pos: NewPositionFromString("col:41"),
|
||||||
Type: "double",
|
Type: "double",
|
||||||
Value: 2.718282e+00,
|
Value: 2.718282e+00,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x21c65b8,
|
0x21c65b8,
|
||||||
NewPositionFromString("col:41"),
|
NewPositionFromString("col:41"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestForStmt(t *testing.T) {
|
func TestForStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f961e018848 <line:9:4, line:10:70>`:
|
`0x7f961e018848 <line:9:4, line:10:70>`: testNode{&ForStmt{
|
||||||
testNode{&ForStmt{
|
|
||||||
Addr: 0x7f961e018848,
|
Addr: 0x7f961e018848,
|
||||||
Pos: NewPositionFromString("line:9:4, line:10:70"),
|
Pos: NewPositionFromString("line:9:4, line:10:70"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f961e018848,
|
0x7f961e018848,
|
||||||
NewPositionFromString("line:9:4, line:10:70"),
|
NewPositionFromString("line:9:4, line:10:70"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestFormatArgAttr(t *testing.T) {
|
func TestFormatArgAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f1234567890 <col:47, col:57> 1`:
|
`0x7f1234567890 <col:47, col:57> 1`: testNode{&FormatArgAttr{
|
||||||
testNode{&FormatArgAttr{
|
|
||||||
Addr: 0x7f1234567890,
|
Addr: 0x7f1234567890,
|
||||||
Pos: NewPositionFromString("col:47, col:57"),
|
Pos: NewPositionFromString("col:47, col:57"),
|
||||||
Arg: "1",
|
Arg: "1",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f1234567890,
|
0x7f1234567890,
|
||||||
NewPositionFromString("col:47, col:57"),
|
NewPositionFromString("col:47, col:57"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestFormatAttr(t *testing.T) {
|
func TestFormatAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fcc8d8ecee8 <col:6> Implicit printf 2 3`:
|
`0x7fcc8d8ecee8 <col:6> Implicit printf 2 3`: testNode{&FormatAttr{
|
||||||
testNode{&FormatAttr{
|
|
||||||
Addr: 0x7fcc8d8ecee8,
|
Addr: 0x7fcc8d8ecee8,
|
||||||
Pos: NewPositionFromString("col:6"),
|
Pos: NewPositionFromString("col:6"),
|
||||||
Implicit: true,
|
Implicit: true,
|
||||||
|
@ -17,12 +16,11 @@ func TestFormatAttr(t *testing.T) {
|
||||||
Unknown2: 3,
|
Unknown2: 3,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fcc8d8ecee8,
|
0x7fcc8d8ecee8,
|
||||||
NewPositionFromString("col:6"),
|
NewPositionFromString("col:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fcc8d8ecff8 </usr/include/sys/cdefs.h:351:18, col:61> printf 2 3`:
|
`0x7fcc8d8ecff8 </usr/include/sys/cdefs.h:351:18, col:61> printf 2 3`: testNode{&FormatAttr{
|
||||||
testNode{&FormatAttr{
|
|
||||||
Addr: 0x7fcc8d8ecff8,
|
Addr: 0x7fcc8d8ecff8,
|
||||||
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
Pos: NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
||||||
Implicit: false,
|
Implicit: false,
|
||||||
|
@ -32,12 +30,11 @@ func TestFormatAttr(t *testing.T) {
|
||||||
Unknown2: 3,
|
Unknown2: 3,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fcc8d8ecff8,
|
0x7fcc8d8ecff8,
|
||||||
NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x273b4d0 <line:357:12> Inherited printf 2 3`:
|
`0x273b4d0 <line:357:12> Inherited printf 2 3`: testNode{&FormatAttr{
|
||||||
testNode{&FormatAttr{
|
|
||||||
Addr: 0x273b4d0,
|
Addr: 0x273b4d0,
|
||||||
Pos: NewPositionFromString("line:357:12"),
|
Pos: NewPositionFromString("line:357:12"),
|
||||||
Implicit: false,
|
Implicit: false,
|
||||||
|
@ -47,9 +44,9 @@ func TestFormatAttr(t *testing.T) {
|
||||||
Unknown2: 3,
|
Unknown2: 3,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x273b4d0,
|
0x273b4d0,
|
||||||
NewPositionFromString("line:357:12"),
|
NewPositionFromString("line:357:12"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseFullComment(line string) Node {
|
||||||
`<(?P<position>.*)>`,
|
`<(?P<position>.*)>`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &FullComment{
|
return &FullComment{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestFullComment(t *testing.T) {
|
func TestFullComment(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x3860920 <line:10176:4, line:10180:45>`:
|
`0x3860920 <line:10176:4, line:10180:45>`: testNode{&FullComment{
|
||||||
testNode{&FullComment{
|
|
||||||
Addr: 0x3860920,
|
Addr: 0x3860920,
|
||||||
Pos: NewPositionFromString("line:10176:4, line:10180:45"),
|
Pos: NewPositionFromString("line:10176:4, line:10180:45"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x3860920,
|
0x3860920,
|
||||||
NewPositionFromString("line:10176:4, line:10180:45"),
|
NewPositionFromString("line:10176:4, line:10180:45"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ func parseFunctionDecl(line string) Node {
|
||||||
`,
|
`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &FunctionDecl{
|
return &FunctionDecl{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestFunctionDecl(t *testing.T) {
|
func TestFunctionDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fb5a90e60d0 <line:231:1, col:22> col:7 clearerr 'void (FILE *)'`:
|
`0x7fb5a90e60d0 <line:231:1, col:22> col:7 clearerr 'void (FILE *)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fb5a90e60d0,
|
Addr: 0x7fb5a90e60d0,
|
||||||
Pos: NewPositionFromString("line:231:1, col:22"),
|
Pos: NewPositionFromString("line:231:1, col:22"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -23,12 +22,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb5a90e60d0,
|
0x7fb5a90e60d0,
|
||||||
NewPositionFromString("line:231:1, col:22"),
|
NewPositionFromString("line:231:1, col:22"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fb5a90e2a50 </usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126> /usr/include/sys/stdio.h:39:5 renameat 'int (int, const char *, int, const char *)'`:
|
`0x7fb5a90e2a50 </usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126> /usr/include/sys/stdio.h:39:5 renameat 'int (int, const char *, int, const char *)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fb5a90e2a50,
|
Addr: 0x7fb5a90e2a50,
|
||||||
Pos: NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"),
|
Pos: NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -44,12 +42,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb5a90e2a50,
|
0x7fb5a90e2a50,
|
||||||
NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"),
|
NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fb5a90e9b70 </usr/include/stdio.h:244:6> col:6 implicit fprintf 'int (FILE *, const char *, ...)' extern`:
|
`0x7fb5a90e9b70 </usr/include/stdio.h:244:6> col:6 implicit fprintf 'int (FILE *, const char *, ...)' extern`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fb5a90e9b70,
|
Addr: 0x7fb5a90e9b70,
|
||||||
Pos: NewPositionFromString("/usr/include/stdio.h:244:6"),
|
Pos: NewPositionFromString("/usr/include/stdio.h:244:6"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -65,12 +62,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb5a90e9b70,
|
0x7fb5a90e9b70,
|
||||||
NewPositionFromString("/usr/include/stdio.h:244:6"),
|
NewPositionFromString("/usr/include/stdio.h:244:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fb5a90e9d40 prev 0x7fb5a90e9b70 <col:1, /usr/include/sys/cdefs.h:351:63> /usr/include/stdio.h:244:6 fprintf 'int (FILE *, const char *, ...)'`:
|
`0x7fb5a90e9d40 prev 0x7fb5a90e9b70 <col:1, /usr/include/sys/cdefs.h:351:63> /usr/include/stdio.h:244:6 fprintf 'int (FILE *, const char *, ...)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fb5a90e9d40,
|
Addr: 0x7fb5a90e9d40,
|
||||||
Pos: NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"),
|
Pos: NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"),
|
||||||
Prev: "0x7fb5a90e9b70",
|
Prev: "0x7fb5a90e9b70",
|
||||||
|
@ -86,12 +82,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb5a90e9d40,
|
0x7fb5a90e9d40,
|
||||||
NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"),
|
NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fb5a90ec210 <line:259:6> col:6 implicit used printf 'int (const char *, ...)' extern`:
|
`0x7fb5a90ec210 <line:259:6> col:6 implicit used printf 'int (const char *, ...)' extern`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fb5a90ec210,
|
Addr: 0x7fb5a90ec210,
|
||||||
Pos: NewPositionFromString("line:259:6"),
|
Pos: NewPositionFromString("line:259:6"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -107,12 +102,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb5a90ec210,
|
0x7fb5a90ec210,
|
||||||
NewPositionFromString("line:259:6"),
|
NewPositionFromString("line:259:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x2ae30d8 </usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54> <scratch space>:17:1 __acos 'double (double)' extern`:
|
`0x2ae30d8 </usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54> <scratch space>:17:1 __acos 'double (double)' extern`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x2ae30d8,
|
Addr: 0x2ae30d8,
|
||||||
Pos: NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"),
|
Pos: NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -128,12 +122,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2ae30d8,
|
0x2ae30d8,
|
||||||
NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"),
|
NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7fc595071500 <line:26:1, line:69:1> line:26:5 referenced main 'int (int, char **)'`:
|
`0x7fc595071500 <line:26:1, line:69:1> line:26:5 referenced main 'int (int, char **)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x7fc595071500,
|
Addr: 0x7fc595071500,
|
||||||
Pos: NewPositionFromString("line:26:1, line:69:1"),
|
Pos: NewPositionFromString("line:26:1, line:69:1"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -149,12 +142,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc595071500,
|
0x7fc595071500,
|
||||||
NewPositionFromString("line:26:1, line:69:1"),
|
NewPositionFromString("line:26:1, line:69:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x55973a008cb0 <line:93619:1, line:93630:1> line:93619:12 used exprIsConst 'int (Expr *, int, int)' static`:
|
`0x55973a008cb0 <line:93619:1, line:93630:1> line:93619:12 used exprIsConst 'int (Expr *, int, int)' static`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x55973a008cb0,
|
Addr: 0x55973a008cb0,
|
||||||
Pos: NewPositionFromString("line:93619:1, line:93630:1"),
|
Pos: NewPositionFromString("line:93619:1, line:93630:1"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -170,12 +162,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x55973a008cb0,
|
0x55973a008cb0,
|
||||||
NewPositionFromString("line:93619:1, line:93630:1"),
|
NewPositionFromString("line:93619:1, line:93630:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x563ade547cb8 <safe_math.h:13:1, line:25:1> line:14:2 safe_unary_minus_func_int8_t_s 'int8_t (int8_t)':'int8_t (int8_t)' static`:
|
`0x563ade547cb8 <safe_math.h:13:1, line:25:1> line:14:2 safe_unary_minus_func_int8_t_s 'int8_t (int8_t)':'int8_t (int8_t)' static`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x563ade547cb8,
|
Addr: 0x563ade547cb8,
|
||||||
Pos: NewPositionFromString("safe_math.h:13:1, line:25:1"),
|
Pos: NewPositionFromString("safe_math.h:13:1, line:25:1"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -191,12 +182,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x563ade547cb8,
|
0x563ade547cb8,
|
||||||
NewPositionFromString("safe_math.h:13:1, line:25:1"),
|
NewPositionFromString("safe_math.h:13:1, line:25:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x556cac571be0 <tests/asm.c:9:1, line:13:1> line:9:26 sqlite3Hwtime1 'unsigned long (void)' inline`:
|
`0x556cac571be0 <tests/asm.c:9:1, line:13:1> line:9:26 sqlite3Hwtime1 'unsigned long (void)' inline`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x556cac571be0,
|
Addr: 0x556cac571be0,
|
||||||
Pos: NewPositionFromString("tests/asm.c:9:1, line:13:1"),
|
Pos: NewPositionFromString("tests/asm.c:9:1, line:13:1"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -212,12 +202,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: true,
|
IsInline: true,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x556cac571be0,
|
0x556cac571be0,
|
||||||
NewPositionFromString("tests/asm.c:9:1, line:13:1"),
|
NewPositionFromString("tests/asm.c:9:1, line:13:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x21c3da0 <line:8201:1, line:8786:1> line:8201:25 used insertvertex 'enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)'`:
|
`0x21c3da0 <line:8201:1, line:8786:1> line:8201:25 used insertvertex 'enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x21c3da0,
|
Addr: 0x21c3da0,
|
||||||
Pos: NewPositionFromString("line:8201:1, line:8786:1"),
|
Pos: NewPositionFromString("line:8201:1, line:8786:1"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -233,12 +222,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x21c3da0,
|
0x21c3da0,
|
||||||
NewPositionFromString("line:8201:1, line:8786:1"),
|
NewPositionFromString("line:8201:1, line:8786:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x30bdba8 parent 0x304fbb0 <col:3, col:38> col:30 used getinfo 'enum countries ()'`:
|
`0x30bdba8 parent 0x304fbb0 <col:3, col:38> col:30 used getinfo 'enum countries ()'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x30bdba8,
|
Addr: 0x30bdba8,
|
||||||
Pos: NewPositionFromString("col:3, col:38"),
|
Pos: NewPositionFromString("col:3, col:38"),
|
||||||
Prev: "",
|
Prev: "",
|
||||||
|
@ -255,12 +243,11 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x30bdba8,
|
0x30bdba8,
|
||||||
NewPositionFromString("col:3, col:38"),
|
NewPositionFromString("col:3, col:38"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x353d3b8 parent 0x31e9ba0 prev 0x33b0810 <col:2, col:30> col:22 used dmatrix 'double **(long, long, long, long)'`:
|
`0x353d3b8 parent 0x31e9ba0 prev 0x33b0810 <col:2, col:30> col:22 used dmatrix 'double **(long, long, long, long)'`: testNode{&FunctionDecl{
|
||||||
testNode{&FunctionDecl{
|
|
||||||
Addr: 0x353d3b8,
|
Addr: 0x353d3b8,
|
||||||
Pos: NewPositionFromString("col:2, col:30"),
|
Pos: NewPositionFromString("col:2, col:30"),
|
||||||
Prev: "0x33b0810",
|
Prev: "0x33b0810",
|
||||||
|
@ -277,9 +264,9 @@ func TestFunctionDecl(t *testing.T) {
|
||||||
IsInline: false,
|
IsInline: false,
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x353d3b8,
|
0x353d3b8,
|
||||||
NewPositionFromString("col:2, col:30"),
|
NewPositionFromString("col:2, col:30"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseFunctionProtoType(line string) Node {
|
||||||
"'(?P<type>.*?)' (?P<kind>.*)",
|
"'(?P<type>.*?)' (?P<kind>.*)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &FunctionProtoType{
|
return &FunctionProtoType{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestFunctionProtoType(t *testing.T) {
|
func TestFunctionProtoType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fa3b88bbb30 'struct _opaque_pthread_t *' foo`:
|
`0x7fa3b88bbb30 'struct _opaque_pthread_t *' foo`: testNode{&FunctionProtoType{
|
||||||
testNode{&FunctionProtoType{
|
|
||||||
Addr: 0x7fa3b88bbb30,
|
Addr: 0x7fa3b88bbb30,
|
||||||
Type: "struct _opaque_pthread_t *",
|
Type: "struct _opaque_pthread_t *",
|
||||||
Kind: "foo",
|
Kind: "foo",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fa3b88bbb30,
|
0x7fa3b88bbb30,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseGCCAsmStmt(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &GCCAsmStmt{
|
return &GCCAsmStmt{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestGCCAsmStmtStmt(t *testing.T) {
|
func TestGCCAsmStmtStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fad830c9e38 <line:13:5, col:57>`:
|
`0x7fad830c9e38 <line:13:5, col:57>`: testNode{&GCCAsmStmt{
|
||||||
testNode{&GCCAsmStmt{
|
|
||||||
Addr: 0x7fad830c9e38,
|
Addr: 0x7fad830c9e38,
|
||||||
Pos: NewPositionFromString("line:13:5, col:57"),
|
Pos: NewPositionFromString("line:13:5, col:57"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fad830c9e38,
|
0x7fad830c9e38,
|
||||||
NewPositionFromString("line:13:5, col:57"),
|
NewPositionFromString("line:13:5, col:57"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ func parseGotoStmt(line string) Node {
|
||||||
"<(?P<position>.*)> '(?P<name>.*)' (?P<position2>.*)",
|
"<(?P<position>.*)> '(?P<name>.*)' (?P<position2>.*)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &GotoStmt{
|
return &GotoStmt{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,17 +6,16 @@ import (
|
||||||
|
|
||||||
func TestGotoStmt(t *testing.T) {
|
func TestGotoStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fb9cc1994d8 <line:18893:9, col:14> 'end_getDigits' 0x7fb9cc199490`:
|
`0x7fb9cc1994d8 <line:18893:9, col:14> 'end_getDigits' 0x7fb9cc199490`: testNode{&GotoStmt{
|
||||||
testNode{&GotoStmt{
|
|
||||||
Addr: 0x7fb9cc1994d8,
|
Addr: 0x7fb9cc1994d8,
|
||||||
Pos: NewPositionFromString("line:18893:9, col:14"),
|
Pos: NewPositionFromString("line:18893:9, col:14"),
|
||||||
Name: "end_getDigits",
|
Name: "end_getDigits",
|
||||||
Position2: "0x7fb9cc199490",
|
Position2: "0x7fb9cc199490",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fb9cc1994d8,
|
0x7fb9cc1994d8,
|
||||||
NewPositionFromString("line:18893:9, col:14"),
|
NewPositionFromString("line:18893:9, col:14"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseHTMLEndTagComment(line string) Node {
|
||||||
`<(?P<position>.*)> Name="(?P<name>.*)"`,
|
`<(?P<position>.*)> Name="(?P<name>.*)"`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &HTMLEndTagComment{
|
return &HTMLEndTagComment{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestHTMLEndTagComment(t *testing.T) {
|
func TestHTMLEndTagComment(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x4259670 <col:27, col:30> Name="i"`:
|
`0x4259670 <col:27, col:30> Name="i"`: testNode{&HTMLEndTagComment{
|
||||||
testNode{&HTMLEndTagComment{
|
|
||||||
Addr: 0x4259670,
|
Addr: 0x4259670,
|
||||||
Pos: NewPositionFromString("col:27, col:30"),
|
Pos: NewPositionFromString("col:27, col:30"),
|
||||||
Name: "i",
|
Name: "i",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x4259670,
|
0x4259670,
|
||||||
NewPositionFromString("col:27, col:30"),
|
NewPositionFromString("col:27, col:30"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseHTMLStartTagComment(line string) Node {
|
||||||
`<(?P<position>.*)> Name="(?P<name>.*)"`,
|
`<(?P<position>.*)> Name="(?P<name>.*)"`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &HTMLStartTagComment{
|
return &HTMLStartTagComment{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestHTMLStartTagComment(t *testing.T) {
|
func TestHTMLStartTagComment(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x4259670 <col:27, col:30> Name="i"`:
|
`0x4259670 <col:27, col:30> Name="i"`: testNode{&HTMLStartTagComment{
|
||||||
testNode{&HTMLStartTagComment{
|
|
||||||
Addr: 0x4259670,
|
Addr: 0x4259670,
|
||||||
Pos: NewPositionFromString("col:27, col:30"),
|
Pos: NewPositionFromString("col:27, col:30"),
|
||||||
Name: "i",
|
Name: "i",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x4259670,
|
0x4259670,
|
||||||
NewPositionFromString("col:27, col:30"),
|
NewPositionFromString("col:27, col:30"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseIBActionAttr(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IBActionAttr{
|
return &IBActionAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestIBActionAttr(t *testing.T) {
|
func TestIBActionAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7>`: testNode{&IBActionAttr{
|
||||||
testNode{&IBActionAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseIBOutletAttr(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IBOutletAttr{
|
return &IBOutletAttr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestIBOutletAttr(t *testing.T) {
|
func TestIBOutletAttr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d1 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d1 <line:11:7, line:18:7>`: testNode{&IBOutletAttr{
|
||||||
testNode{&IBOutletAttr{
|
|
||||||
Addr: 0x7fc0a69091d1,
|
Addr: 0x7fc0a69091d1,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d1,
|
0x7fc0a69091d1,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseIfStmt(line string) Node {
|
||||||
"<(?P<position>.*)>",
|
"<(?P<position>.*)>",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IfStmt{
|
return &IfStmt{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestIfStmt(t *testing.T) {
|
func TestIfStmt(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fc0a69091d0 <line:11:7, line:18:7>`:
|
`0x7fc0a69091d0 <line:11:7, line:18:7>`: testNode{&IfStmt{
|
||||||
testNode{&IfStmt{
|
|
||||||
Addr: 0x7fc0a69091d0,
|
Addr: 0x7fc0a69091d0,
|
||||||
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
Pos: NewPositionFromString("line:11:7, line:18:7"),
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fc0a69091d0,
|
0x7fc0a69091d0,
|
||||||
NewPositionFromString("line:11:7, line:18:7"),
|
NewPositionFromString("line:11:7, line:18:7"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,32 +6,29 @@ import (
|
||||||
|
|
||||||
func TestImplicitCastExpr(t *testing.T) {
|
func TestImplicitCastExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f9f5b0a1288 <col:8> 'FILE *' <LValueToRValue>`:
|
`0x7f9f5b0a1288 <col:8> 'FILE *' <LValueToRValue>`: testNode{&ImplicitCastExpr{
|
||||||
testNode{&ImplicitCastExpr{
|
|
||||||
Addr: 0x7f9f5b0a1288,
|
Addr: 0x7f9f5b0a1288,
|
||||||
Pos: NewPositionFromString("col:8"),
|
Pos: NewPositionFromString("col:8"),
|
||||||
Type: "FILE *",
|
Type: "FILE *",
|
||||||
Kind: "LValueToRValue",
|
Kind: "LValueToRValue",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9f5b0a1288,
|
0x7f9f5b0a1288,
|
||||||
NewPositionFromString("col:8"),
|
NewPositionFromString("col:8"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7f9f5b0a7828 <col:11> 'int (*)(int, FILE *)' <FunctionToPointerDecay>`:
|
`0x7f9f5b0a7828 <col:11> 'int (*)(int, FILE *)' <FunctionToPointerDecay>`: testNode{&ImplicitCastExpr{
|
||||||
testNode{&ImplicitCastExpr{
|
|
||||||
Addr: 0x7f9f5b0a7828,
|
Addr: 0x7f9f5b0a7828,
|
||||||
Pos: NewPositionFromString("col:11"),
|
Pos: NewPositionFromString("col:11"),
|
||||||
Type: "int (*)(int, FILE *)",
|
Type: "int (*)(int, FILE *)",
|
||||||
Kind: "FunctionToPointerDecay",
|
Kind: "FunctionToPointerDecay",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f9f5b0a7828,
|
0x7f9f5b0a7828,
|
||||||
NewPositionFromString("col:11"),
|
NewPositionFromString("col:11"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x21267c8 <col:8> 'enum week1':'enum week2' <IntegralCast>`:
|
`0x21267c8 <col:8> 'enum week1':'enum week2' <IntegralCast>`: testNode{&ImplicitCastExpr{
|
||||||
testNode{&ImplicitCastExpr{
|
|
||||||
Addr: 0x21267c8,
|
Addr: 0x21267c8,
|
||||||
Pos: NewPositionFromString("col:8"),
|
Pos: NewPositionFromString("col:8"),
|
||||||
Type: "enum week1",
|
Type: "enum week1",
|
||||||
|
@ -39,12 +36,11 @@ func TestImplicitCastExpr(t *testing.T) {
|
||||||
Kind: "IntegralCast",
|
Kind: "IntegralCast",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x21267c8,
|
0x21267c8,
|
||||||
NewPositionFromString("col:8"),
|
NewPositionFromString("col:8"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x26fd2d8 <col:20, col:32> 'extCoord':'extCoord' <LValueToRValue>`:
|
`0x26fd2d8 <col:20, col:32> 'extCoord':'extCoord' <LValueToRValue>`: testNode{&ImplicitCastExpr{
|
||||||
testNode{&ImplicitCastExpr{
|
|
||||||
Addr: 0x26fd2d8,
|
Addr: 0x26fd2d8,
|
||||||
Pos: NewPositionFromString("col:20, col:32"),
|
Pos: NewPositionFromString("col:20, col:32"),
|
||||||
Type: "extCoord",
|
Type: "extCoord",
|
||||||
|
@ -52,9 +48,9 @@ func TestImplicitCastExpr(t *testing.T) {
|
||||||
Kind: "LValueToRValue",
|
Kind: "LValueToRValue",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x26fd2d8,
|
0x26fd2d8,
|
||||||
NewPositionFromString("col:20, col:32"),
|
NewPositionFromString("col:20, col:32"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ func parseImplicitValueInitExpr(line string) Node {
|
||||||
"<(?P<position>.*)> '(?P<type1>.*?)'(:'(?P<type2>.*)')?",
|
"<(?P<position>.*)> '(?P<type1>.*?)'(:'(?P<type2>.*)')?",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ImplicitValueInitExpr{
|
return &ImplicitValueInitExpr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,29 +6,27 @@ import (
|
||||||
|
|
||||||
func TestImplicitValueInitExpr(t *testing.T) {
|
func TestImplicitValueInitExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7f8c3396fbd8 <<invalid sloc>> 'sqlite3StatValueType':'long long'`:
|
`0x7f8c3396fbd8 <<invalid sloc>> 'sqlite3StatValueType':'long long'`: testNode{&ImplicitValueInitExpr{
|
||||||
testNode{&ImplicitValueInitExpr{
|
|
||||||
Addr: 0x7f8c3396fbd8,
|
Addr: 0x7f8c3396fbd8,
|
||||||
Pos: NewPositionFromString("<invalid sloc>"),
|
Pos: NewPositionFromString("<invalid sloc>"),
|
||||||
Type1: "sqlite3StatValueType",
|
Type1: "sqlite3StatValueType",
|
||||||
Type2: "long long",
|
Type2: "long long",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7f8c3396fbd8,
|
0x7f8c3396fbd8,
|
||||||
NewPositionFromString("<invalid sloc>"),
|
NewPositionFromString("<invalid sloc>"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x7feecb0d6af0 <<invalid sloc>> 'char'`:
|
`0x7feecb0d6af0 <<invalid sloc>> 'char'`: testNode{&ImplicitValueInitExpr{
|
||||||
testNode{&ImplicitValueInitExpr{
|
|
||||||
Addr: 0x7feecb0d6af0,
|
Addr: 0x7feecb0d6af0,
|
||||||
Pos: NewPositionFromString("<invalid sloc>"),
|
Pos: NewPositionFromString("<invalid sloc>"),
|
||||||
Type1: "char",
|
Type1: "char",
|
||||||
Type2: "",
|
Type2: "",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7feecb0d6af0,
|
0x7feecb0d6af0,
|
||||||
NewPositionFromString("<invalid sloc>"),
|
NewPositionFromString("<invalid sloc>"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ func parseIncompleteArrayType(line string) Node {
|
||||||
"'(?P<type>.*)' ",
|
"'(?P<type>.*)' ",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IncompleteArrayType{
|
return &IncompleteArrayType{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
func TestIncompleteArrayType(t *testing.T) {
|
func TestIncompleteArrayType(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fcb7d005c20 'int []' `:
|
`0x7fcb7d005c20 'int []' `: testNode{&IncompleteArrayType{
|
||||||
testNode{&IncompleteArrayType{
|
|
||||||
Addr: 0x7fcb7d005c20,
|
Addr: 0x7fcb7d005c20,
|
||||||
Type: "int []",
|
Type: "int []",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fcb7d005c20,
|
0x7fcb7d005c20,
|
||||||
NewPositionFromString(""),
|
NewPositionFromString(""),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ func parseIndirectFieldDecl(line string) Node {
|
||||||
'(?P<type>.+?)'`,
|
'(?P<type>.+?)'`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IndirectFieldDecl{
|
return &IndirectFieldDecl{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
func TestIndirectFieldDecl(t *testing.T) {
|
func TestIndirectFieldDecl(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x2be19a8 <line:167:25> col:25 implicit fpstate 'struct _fpstate *'`:
|
`0x2be19a8 <line:167:25> col:25 implicit fpstate 'struct _fpstate *'`: testNode{&IndirectFieldDecl{
|
||||||
testNode{&IndirectFieldDecl{
|
|
||||||
Addr: 0x2be19a8,
|
Addr: 0x2be19a8,
|
||||||
Pos: NewPositionFromString("line:167:25"),
|
Pos: NewPositionFromString("line:167:25"),
|
||||||
Position2: "col:25",
|
Position2: "col:25",
|
||||||
|
@ -16,9 +15,9 @@ func TestIndirectFieldDecl(t *testing.T) {
|
||||||
Type: "struct _fpstate *",
|
Type: "struct _fpstate *",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x2be19a8,
|
0x2be19a8,
|
||||||
NewPositionFromString("line:167:25"),
|
NewPositionFromString("line:167:25"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ func parseInitListExpr(line string) Node {
|
||||||
"<(?P<position>.*)> '(?P<type1>.*?)'(:'(?P<type2>.*)')?",
|
"<(?P<position>.*)> '(?P<type1>.*?)'(:'(?P<type2>.*)')?",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &InitListExpr{
|
return &InitListExpr{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,39 +6,36 @@ import (
|
||||||
|
|
||||||
func TestInitListExpr(t *testing.T) {
|
func TestInitListExpr(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x7fbdd1906c20 <col:52, line:17160:1> 'const unsigned char [256]'`:
|
`0x7fbdd1906c20 <col:52, line:17160:1> 'const unsigned char [256]'`: testNode{&InitListExpr{
|
||||||
testNode{&InitListExpr{
|
|
||||||
Addr: 0x7fbdd1906c20,
|
Addr: 0x7fbdd1906c20,
|
||||||
Pos: NewPositionFromString("col:52, line:17160:1"),
|
Pos: NewPositionFromString("col:52, line:17160:1"),
|
||||||
Type1: "const unsigned char [256]",
|
Type1: "const unsigned char [256]",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x7fbdd1906c20,
|
0x7fbdd1906c20,
|
||||||
NewPositionFromString("col:52, line:17160:1"),
|
NewPositionFromString("col:52, line:17160:1"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x32017f0 <col:24, col:41> 'struct node [2]'`:
|
`0x32017f0 <col:24, col:41> 'struct node [2]'`: testNode{&InitListExpr{
|
||||||
testNode{&InitListExpr{
|
|
||||||
Addr: 0x32017f0,
|
Addr: 0x32017f0,
|
||||||
Pos: NewPositionFromString("col:24, col:41"),
|
Pos: NewPositionFromString("col:24, col:41"),
|
||||||
Type1: "struct node [2]",
|
Type1: "struct node [2]",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x32017f0,
|
0x32017f0,
|
||||||
NewPositionFromString("col:24, col:41"),
|
NewPositionFromString("col:24, col:41"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
`0x3201840 <col:25, col:31> 'struct node':'struct node'`:
|
`0x3201840 <col:25, col:31> 'struct node':'struct node'`: testNode{&InitListExpr{
|
||||||
testNode{&InitListExpr{
|
|
||||||
Addr: 0x3201840,
|
Addr: 0x3201840,
|
||||||
Pos: NewPositionFromString("col:25, col:31"),
|
Pos: NewPositionFromString("col:25, col:31"),
|
||||||
Type1: "struct node",
|
Type1: "struct node",
|
||||||
Type2: "struct node",
|
Type2: "struct node",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x3201840,
|
0x3201840,
|
||||||
NewPositionFromString("col:25, col:31"),
|
NewPositionFromString("col:25, col:31"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ func parseInlineCommandComment(line string) Node {
|
||||||
`<(?P<position>.*)> (?P<other>.*)`,
|
`<(?P<position>.*)> (?P<other>.*)`,
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &InlineCommandComment{
|
return &InlineCommandComment{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
|
@ -6,16 +6,15 @@ import (
|
||||||
|
|
||||||
func TestInlineCommandComment(t *testing.T) {
|
func TestInlineCommandComment(t *testing.T) {
|
||||||
nodes := map[string]testNode{
|
nodes := map[string]testNode{
|
||||||
`0x22e3510 <col:2, col:6> Name="NOTE" RenderNormal`:
|
`0x22e3510 <col:2, col:6> Name="NOTE" RenderNormal`: testNode{&InlineCommandComment{
|
||||||
testNode{&InlineCommandComment{
|
|
||||||
Addr: 0x22e3510,
|
Addr: 0x22e3510,
|
||||||
Pos: NewPositionFromString("col:2, col:6"),
|
Pos: NewPositionFromString("col:2, col:6"),
|
||||||
Other: "Name=\"NOTE\" RenderNormal",
|
Other: "Name=\"NOTE\" RenderNormal",
|
||||||
ChildNodes: []Node{},
|
ChildNodes: []Node{},
|
||||||
},
|
},
|
||||||
0x22e3510,
|
0x22e3510,
|
||||||
NewPositionFromString("col:2, col:6"),
|
NewPositionFromString("col:2, col:6"),
|
||||||
[]Node{},
|
[]Node{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ func parseIntegerLiteral(line string) Node {
|
||||||
"<(?P<position>.*)> '(?P<type>.*?)' (?P<value>\\d+)",
|
"<(?P<position>.*)> '(?P<type>.*?)' (?P<value>\\d+)",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if groups == nil {
|
if groups == nil {
|
||||||
return &Unknown{}
|
return &Unknown{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IntegerLiteral{
|
return &IntegerLiteral{
|
||||||
Addr: ParseAddress(groups["address"]),
|
Addr: ParseAddress(groups["address"]),
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user