Skip to content

Commit

Permalink
genbindings/clang2il: detect pure virtual, detect overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
mappu committed Nov 15, 2024
1 parent b998232 commit de81283
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/genbindings/clang2il.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ func parseMethod(node map[string]interface{}, mm *CppMethod) error {
mm.IsVirtual = true
}

if pure, ok := node["pure"].(bool); ok && pure {
mm.IsPureVirtual = true
}

if methodInner, ok := node["inner"].([]interface{}); ok {
paramCounter := 0
for _, methodObj := range methodInner {
Expand Down Expand Up @@ -720,6 +724,12 @@ func parseMethod(node map[string]interface{}, mm *CppMethod) error {
// Next
paramCounter++

case "OverrideAttr":
// void keyPressEvent(QKeyEvent *e) override;
// This is a virtual method being overridden and is a replacement
// for actually using the 'virtual' keyword
mm.IsVirtual = true

default:
// Something else inside a declaration??
log.Printf("==> NOT IMPLEMENTED CXXMethodDecl->%q\n", methodObj["kind"])
Expand Down
1 change: 1 addition & 0 deletions cmd/genbindings/intermediate.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ type CppMethod struct {
IsSignal bool
IsConst bool
IsVirtual bool
IsPureVirtual bool // Virtual method was declared with = 0 i.e. there is no base method here to call
IsProtected bool // If true, we can't call this method but we may still be able to overload it
HiddenParams []CppParameter // Populated if there is an overload with more parameters

Expand Down

0 comments on commit de81283

Please sign in to comment.