Sebastien Binet  committed d773036

more go-like api

  • Participants
  • Parent commits eb0d7ba

Comments (0)

Files changed (2)

File pkg/clang/clang.go

  * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
  * (which gives the indexer the same performance benefit as the compiler).
-func CreateIndex(excludeDeclarationsFromPCH, displayDiagnostics int) Index {
+func NewIndex(excludeDeclarationsFromPCH, displayDiagnostics int) Index {
 	idx := C.clang_createIndex(,
 	return Index{idx}
 	c C.CXTranslationUnit
-func (tu TranslationUnit) GetFile(file_name string) File {
+func (tu TranslationUnit) File(file_name string) File {
 	cfname := C.CString(file_name)
 	f := C.clang_getFile(tu.c, cfname)
  * The translation unit cursor can be used to start traversing the
  * various declarations within the given translation unit.
-func (tu TranslationUnit) GetCursor() Cursor {
+func (tu TranslationUnit) ToCursor() Cursor {
 	o := C.clang_getTranslationUnitCursor(tu.c)
 	return Cursor{o}
  * \brief Retrieve a NULL (invalid) source location.
-func GetNullLocation() SourceLocation {
+func NewNullLocation() SourceLocation {
 	return SourceLocation{C.clang_getNullLocation()}
  * \brief Retrieves the source location associated with a given file/line/column
  * in a particular translation unit.
-func (tu TranslationUnit) GetLocation(f File, line, column uint) SourceLocation {
+func (tu TranslationUnit) Location(f File, line, column uint) SourceLocation {
 	loc := C.clang_getLocation(tu.c, f.c, C.uint(line), C.uint(column))
 	return SourceLocation{loc}
  * \brief Retrieves the source location associated with a given character offset
  * in a particular translation unit.
-func (tu TranslationUnit) GetLocationForOffset(f File, offset uint) SourceLocation {
+func (tu TranslationUnit) LocationForOffset(f File, offset uint) SourceLocation {
 	loc := C.clang_getLocationForOffset(tu.c, f.c, C.uint(offset))
 	return SourceLocation{loc}
  * \brief Retrieve a NULL (invalid) source range.
-func GetNullRange() SourceRange {
+func NewNullRange() SourceRange {
 	return SourceRange{C.clang_getNullRange()}
  * \brief Retrieve a source range given the beginning and ending source
  * locations.
-func GetRange(beg, end SourceLocation) SourceRange {
+func NewRange(beg, end SourceLocation) SourceRange {
 	o := C.clang_getRange(beg.c, end.c)
 	return SourceRange{o}

File pkg/clang/cursor.go

 // Retrieve the NULL cursor, which represents no entity.
-func GetNullCursor() Cursor {
+func NewNullCursor() Cursor {
 	return Cursor{C.clang_getNullCursor()}