elliotchance / c2go

⚖️ A tool for transpiling C to Go.
MIT License
2.06k stars 151 forks source link

panic: unknown node type: 'BuiltinAttr 0x7fb08f04f838 <<invalid sloc>> Inherited Implicit 720' #884

Open tmc opened 3 years ago

tmc commented 3 years ago
~/go/src/github.com/algorand/go-algorand/crypto $ c2go transpile -V -p crypto -clang-flag="-I./include/sodium" -clang-flag="-I./libsodium-fork/src/libsodium/include/sodium" libsodium-fork/src/libsodium/crypto_vrf/crypto_vrf.c libsodium-fork/src/libsodium/crypto_vrf/ietfdraft03/keypair.c

results in

panic: unknown node type: 'BuiltinAttr 0x7fb08f04f838 <<invalid sloc>> Inherited Implicit 720'

goroutine 98 [running]:
github.com/elliotchance/c2go/ast.Parse(0xc000925dfd, 0x42, 0x12a5c0e, 0x5)
    /Users/tmc/go/src/github.com/elliotchance/c2go/ast/ast.go:294 +0x354b
main.convertLinesToNodes(0xc00016c9d0, 0x29e, 0x2740, 0x0, 0x0, 0x0)
    /Users/tmc/go/src/github.com/elliotchance/c2go/main.go:91 +0x1b4
main.convertLinesToNodesParallel.func1.2(0xc00059a060, 0xc00012e028, 0xc00016c9d0, 0x29e, 0x2740, 0x0)
    /Users/tmc/go/src/github.com/elliotchance/c2go/main.go:123 +0x53
created by main.convertLinesToNodesParallel.func1
    /Users/tmc/go/src/github.com/elliotchance/c2go/main.go:121 +0x1be
tmc commented 3 years ago

This was apparently added here: https://reviews.llvm.org/D77491

elliotchance commented 3 years ago

Since the parser works on understanding the non-machine output of the clang AST changes and edge cases constantly need to be added. Here is an example of adding a new node: https://github.com/elliotchance/c2go/pull/832