-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing InitListExpr #115
Comments
Hi, i will look into it, as soon as I can! |
Ok, the thing is, atm we can't/don't handle function pointers. Further, I can't promise you when we will be able to add that feature (although it is certainly on my will be eventually added list). I will close this here, will be fixed by #81. Still, thanks for reporting and taking an interest in go-clang! -Markus |
The problem is not go-clang. Clang presents the AST even if there are errors. You can check all problems using the TranslationUnit method package main
import (
"fmt"
"github.com/go-clang/v3.7/clang"
)
func main() {
idx := clang.NewIndex(0, 1)
defer idx.Dispose()
tu := idx.ParseTranslationUnit("tt.c", []string{"-I", "/usr/lib/clang/3.7/include"}, nil, 0)
defer tu.Dispose()
for _, d := range tu.Diagnostics() {
fmt.Println("Problem:", d.Spelling())
}
cursor := tu.TranslationUnitCursor()
cursor.Visit(func(cursor, parent clang.Cursor) clang.ChildVisitResult {
if cursor.IsNull() {
return clang.ChildVisit_Continue
}
fmt.Printf("%s: %s (%s)\n", cursor.Kind().Spelling(), cursor.Spelling(), cursor.USR())
return clang.ChildVisit_Recurse
})
} which outputs for your adapted C code the following
Of course you have to do the same with your program which is using go-clang and your correct include path. |
Maybe this helps for usage problems like in go-clang/gen#115
Maybe this helps for usage problems like in go-clang/gen#115
Maybe this helps for usage problems like in go-clang/gen#115
Maybe this helps for usage problems like in go-clang/gen#115
Maybe this helps for usage problems like in go-clang/gen#115
Maybe this helps for usage problems like in go-clang/gen#115
When parsing the following piece of code (taken from uemacs):
I don't get the InitListExpression for array
a
. However, when parsing the code:int b[] = {1, 2};
I get the list for
b
just fine.The text was updated successfully, but these errors were encountered: