llcppsigfetch:qualified name refer

This commit is contained in:
luoliwoshang
2024-08-22 18:07:01 +08:00
parent eb4d721175
commit 319e746a55
3 changed files with 118 additions and 0 deletions

View File

@@ -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,
}