Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Show diagnostics for the dump example
Browse files Browse the repository at this point in the history
Maybe this helps for usage problems like in go-clang/gen#115
  • Loading branch information
zimmski committed Dec 2, 2016
1 parent e3d80a2 commit 2fe5d5e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/go-clang-dump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func main() {
defer tu.Dispose()

fmt.Printf("tu: %s\n", tu.Spelling())

diagnostics := tu.Diagnostics()
for _, d := range diagnostics {
fmt.Println("PROBLEM:", d.Spelling())
}

cursor := tu.TranslationUnitCursor()
fmt.Printf("cursor-isnull: %v\n", cursor.IsNull())
fmt.Printf("cursor: %s\n", cursor.Spelling())
Expand All @@ -65,5 +71,9 @@ func main() {
return clang.ChildVisit_Continue
})

if len(diagnostics) > 0 {
fmt.Println("NOTE: There were problems while analyzing the given file")
}

fmt.Printf(":: bye.\n")
}

0 comments on commit 2fe5d5e

Please sign in to comment.