Merge pull request #763 from luoliwoshang/c/clang/usr

c/clang:usr & range
This commit is contained in:
xushiwei
2024-09-05 08:31:37 +08:00
committed by GitHub
2 changed files with 48 additions and 0 deletions

View File

@@ -109,6 +109,8 @@ enum CX_StorageClass wrap_clang_Cursor_getStorageClass(CXCursor *cursor) {
return clang_Cursor_getStorageClass(*cursor); return clang_Cursor_getStorageClass(*cursor);
} }
CXString wrap_clang_getCursorUSR(CXCursor *cur) { return clang_getCursorUSR(*cur); }
CXString wrap_clang_getCursorSpelling(CXCursor *cur) { return clang_getCursorSpelling(*cur); } CXString wrap_clang_getCursorSpelling(CXCursor *cur) { return clang_getCursorSpelling(*cur); }
unsigned wrap_clang_Cursor_isVariadic(CXCursor *cur) { return clang_Cursor_isVariadic(*cur); } unsigned wrap_clang_Cursor_isVariadic(CXCursor *cur) { return clang_Cursor_isVariadic(*cur); }
@@ -181,4 +183,8 @@ void wrap_clang_getSpellingLocation(CXSourceLocation *loc, CXFile *file, unsigne
clang_getSpellingLocation(*loc, file, line, column, offset); clang_getSpellingLocation(*loc, file, line, column, offset);
} }
void wrap_clang_getRangeStart(CXSourceRange *range, CXSourceLocation *loc) { *loc = clang_getRangeStart(*range); }
void wrap_clang_getRangeEnd(CXSourceRange *range, CXSourceLocation *loc) { *loc = clang_getRangeEnd(*range); }
} // extern "C" } // extern "C"

View File

@@ -2166,6 +2166,24 @@ func (c Cursor) StorageClass() (ret StorageClass) {
return c.wrapStorageClass() return c.wrapStorageClass()
} }
/**
* Retrieve a Unified Symbol Resolution (USR) for the entity referenced
* by the given cursor.
*
* A Unified Symbol Resolution (USR) is a string that identifies a particular
* entity (function, class, variable, etc.) within a program. USRs can be
* compared across translation units to determine, e.g., when references in
* one translation refer to an entity defined in another translation unit.
*/
// llgo:link (*Cursor).wrapUSR C.wrap_clang_getCursorUSR
func (*Cursor) wrapUSR() (ret String) {
return
}
func (c Cursor) USR() (ret String) {
return c.wrapUSR()
}
/** /**
* Retrieve a name for the entity referenced by this cursor. * Retrieve a name for the entity referenced by this cursor.
*/ */
@@ -2637,5 +2655,29 @@ func (l SourceLocation) SpellingLocation(file *File, line, column, offset *c.Uin
l.wrapSpellingLocation(file, line, column, offset) l.wrapSpellingLocation(file, line, column, offset)
} }
/**
* Retrieve a source location representing the first character within a
* source range.
*/
// llgo:link (*SourceRange).wrapRangeStart C.wrap_clang_getRangeStart
func (r *SourceRange) wrapRangeStart(loc *SourceLocation) { return }
func (r SourceRange) RangeStart() (loc SourceLocation) {
r.wrapRangeStart(&loc)
return
}
/**
* Retrieve a source location representing the last character within a
* source range.
*/
// llgo:link (*SourceRange).wrapRangeEnd C.wrap_clang_getRangeEnd
func (r *SourceRange) wrapRangeEnd(loc *SourceLocation) { return }
func (r SourceRange) RangeEnd() (loc SourceLocation) {
r.wrapRangeEnd(&loc)
return
}
//llgo:link File.FileName C.clang_getFileName //llgo:link File.FileName C.clang_getFileName
func (File) FileName() (ret String) { return } func (File) FileName() (ret String) { return }