llcppsigfetch:qualified name refer
This commit is contained in:
@@ -507,6 +507,20 @@ func (ct *Converter) ProcessElaboratedType(t clang.Type) ast.Expr {
|
||||
}
|
||||
}
|
||||
|
||||
// qualified name
|
||||
// todo(zzy): qualified name with tag,like struct A::B
|
||||
if strings.Contains(typeName, "::") {
|
||||
scopeParts := strings.Split(typeName, "::")
|
||||
var expr ast.Expr = &ast.Ident{Name: scopeParts[0]}
|
||||
for _, part := range scopeParts[1:] {
|
||||
expr = &ast.ScopingExpr{
|
||||
Parent: expr,
|
||||
X: &ast.Ident{Name: part},
|
||||
}
|
||||
}
|
||||
return expr
|
||||
}
|
||||
|
||||
return &ast.Ident{
|
||||
Name: typeName,
|
||||
}
|
||||
|
||||
@@ -207,6 +207,101 @@ TestScope Case 5:
|
||||
}
|
||||
}
|
||||
|
||||
TestScope Case 6:
|
||||
{
|
||||
"temp.h": {
|
||||
"decls": [{
|
||||
"Loc": {
|
||||
"File": "temp.h"
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Parent": {
|
||||
"X": {
|
||||
"Name": "c"
|
||||
},
|
||||
"Parent": {
|
||||
"X": {
|
||||
"Name": "b"
|
||||
},
|
||||
"Parent": {
|
||||
"Name": "a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Name": {
|
||||
"Name": "c"
|
||||
},
|
||||
"Type": {
|
||||
"Tag": 3,
|
||||
"Fields": {
|
||||
"List": []
|
||||
},
|
||||
"Methods": [{
|
||||
"Loc": {
|
||||
"File": "temp.h"
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Parent": {
|
||||
"X": {
|
||||
"Name": "c"
|
||||
},
|
||||
"Parent": {
|
||||
"X": {
|
||||
"Name": "b"
|
||||
},
|
||||
"Parent": {
|
||||
"Name": "a"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Name": {
|
||||
"Name": "foo"
|
||||
},
|
||||
"Type": {
|
||||
"Params": {
|
||||
"List": []
|
||||
},
|
||||
"Ret": {
|
||||
"Kind": 0,
|
||||
"Flags": 0
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"Loc": {
|
||||
"File": "temp.h"
|
||||
},
|
||||
"Doc": {
|
||||
"List": []
|
||||
},
|
||||
"Parent": null,
|
||||
"Name": {
|
||||
"Name": "C"
|
||||
},
|
||||
"Type": {
|
||||
"X": {
|
||||
"Name": "c"
|
||||
},
|
||||
"Parent": {
|
||||
"X": {
|
||||
"Name": "b"
|
||||
},
|
||||
"Parent": {
|
||||
"Name": "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
"includes": [],
|
||||
"macros": []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#stderr
|
||||
|
||||
|
||||
@@ -25,6 +25,15 @@ func TestScope() {
|
||||
void foo();
|
||||
};
|
||||
}`,
|
||||
|
||||
`namespace a {
|
||||
namespace b {
|
||||
class c {
|
||||
void foo();
|
||||
};
|
||||
}
|
||||
}
|
||||
typedef a::b::c C;`,
|
||||
}
|
||||
test.RunTest("TestScope", testCases)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user