llcppsigfetch:lvalue & rvalue refer
This commit is contained in:
@@ -237,6 +237,8 @@ func (ct *Converter) ProcessType(t clang.Type) ast.Expr {
|
||||
switch t.Kind {
|
||||
case clang.TypePointer:
|
||||
expr = &ast.PointerType{X: ct.ProcessType(t.PointeeType())}
|
||||
case clang.TypeLValueReference, clang.TypeRValueReference:
|
||||
expr = &ast.LvalueRefType{X: ct.ProcessType(t.NonReferenceType())}
|
||||
case clang.TypeFunctionProto:
|
||||
// function type will only collect return type, params will be collected in ProcessFunc
|
||||
ret := ct.ProcessType(t.ResultType())
|
||||
|
||||
@@ -18,6 +18,9 @@ func TestFuncDecl() {
|
||||
|
||||
`void foo(char str[]);`,
|
||||
`void foo(int arr[3][4]);`,
|
||||
|
||||
`void foo(int& a);`,
|
||||
`void foo(int&& a);`,
|
||||
}
|
||||
test.RunTest("TestFuncDecl", testCases)
|
||||
}
|
||||
|
||||
@@ -384,6 +384,96 @@ TestFuncDecl Case 8:
|
||||
}
|
||||
}
|
||||
|
||||
TestFuncDecl Case 9:
|
||||
{
|
||||
"temp.h": {
|
||||
"decls": [{
|
||||
"Loc": {
|
||||
"File": "temp.h"
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"X": {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Comment": {
|
||||
"List": []
|
||||
},
|
||||
"Names": [{
|
||||
"Name": "a"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
TestFuncDecl Case 10:
|
||||
{
|
||||
"temp.h": {
|
||||
"decls": [{
|
||||
"Loc": {
|
||||
"File": "temp.h"
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": [{
|
||||
"Type": {
|
||||
"X": {
|
||||
"Kind": 6,
|
||||
"Flags": 0
|
||||
}
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Comment": {
|
||||
"List": []
|
||||
},
|
||||
"Names": [{
|
||||
"Name": "a"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#stderr
|
||||
|
||||
|
||||
@@ -146,6 +146,10 @@ func MarshalASTExpr(t ast.Expr) *cjson.JSON {
|
||||
case *ast.BasicLit:
|
||||
root.SetItem(c.Str("Kind"), cjson.Number(float64(d.Kind)))
|
||||
root.SetItem(c.Str("Value"), cjson.String(c.AllocaCStr(d.Value)))
|
||||
case *ast.LvalueRefType:
|
||||
root.SetItem(c.Str("X"), MarshalASTExpr(d.X))
|
||||
case *ast.RvalueRefType:
|
||||
root.SetItem(c.Str("X"), MarshalASTExpr(d.X))
|
||||
case *ast.PointerType:
|
||||
root.SetItem(c.Str("X"), MarshalASTExpr(d.X))
|
||||
case *ast.ArrayType:
|
||||
|
||||
Reference in New Issue
Block a user