Merge pull request #854 from luoliwoshang/c/clang/loc2cursor
c/clang:location to cursor
This commit is contained in:
@@ -33,6 +33,10 @@ void wrap_clang_getOverriddenCursors(CXCursor *cursor, CXCursor **overridden, un
|
||||
clang_getOverriddenCursors(*cursor, overridden, num_overridden);
|
||||
}
|
||||
|
||||
void wrap_clang_getCursor(CXTranslationUnit uint, CXSourceLocation *loc, CXCursor *cur) {
|
||||
*cur = clang_getCursor(uint, *loc);
|
||||
}
|
||||
|
||||
void wrap_clang_getCursorLocation(CXCursor *cur, CXSourceLocation *loc) { *loc = clang_getCursorLocation(*cur); }
|
||||
|
||||
void wrap_clang_getCursorExtent(CXCursor *cur, CXSourceRange *range) { *range = clang_getCursorExtent(*cur); }
|
||||
|
||||
@@ -1710,6 +1710,30 @@ func (c Cursor) OverriddenCursors(overridden **Cursor, numOverridden *c.Uint) {
|
||||
// llgo:link (*Cursor).DisposeOverriddenCursors C.clang_disposeOverriddenCursors
|
||||
func (c *Cursor) DisposeOverriddenCursors() {}
|
||||
|
||||
/**
|
||||
* Map a source location to the cursor that describes the entity at that
|
||||
* location in the source code.
|
||||
*
|
||||
* clang_getCursor() maps an arbitrary source location within a translation
|
||||
* unit down to the most specific cursor that describes the entity at that
|
||||
* location. For example, given an expression \c x + y, invoking
|
||||
* clang_getCursor() with a source location pointing to "x" will return the
|
||||
* cursor for "x"; similarly for "y". If the cursor points anywhere between
|
||||
* "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
|
||||
* will return a cursor referring to the "+" expression.
|
||||
*
|
||||
* \returns a cursor representing the entity at the given source location, or
|
||||
* a NULL cursor if no such entity can be found.
|
||||
*/
|
||||
|
||||
// llgo:link (*TranslationUnit).wrapGetCursor C.wrap_clang_getCursor
|
||||
func (l *TranslationUnit) wrapGetCursor(loc *SourceLocation, cur *Cursor) {}
|
||||
|
||||
func (l *TranslationUnit) GetCursor(loc *SourceLocation) (cur Cursor) {
|
||||
l.wrapGetCursor(loc, &cur)
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the physical location of the source constructor referenced
|
||||
* by the given cursor.
|
||||
|
||||
Reference in New Issue
Block a user