Merge pull request #867 from luoliwoshang/c/clang/file2loc
c/clang:file to loc
This commit is contained in:
@@ -15,6 +15,14 @@ CXChildVisitResult wrap_visitor(CXCursor cursor, CXCursor parent, CXClientData d
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
void wrap_clang_getLocation(CXTranslationUnit tu, CXFile file, unsigned line, unsigned column, CXSourceLocation *loc) {
|
||||||
|
*loc = clang_getLocation(tu, file, line, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wrap_clang_getLocationForOffset(CXTranslationUnit tu, CXFile file, unsigned offset, CXSourceLocation *loc) {
|
||||||
|
*loc = clang_getLocationForOffset(tu, file, offset);
|
||||||
|
}
|
||||||
|
|
||||||
void wrap_clang_getTranslationUnitCursor(CXTranslationUnit uint, CXCursor *cur) {
|
void wrap_clang_getTranslationUnitCursor(CXTranslationUnit uint, CXCursor *cur) {
|
||||||
*cur = clang_getTranslationUnitCursor(uint);
|
*cur = clang_getTranslationUnitCursor(uint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1157,6 +1157,30 @@ type UnsavedFile struct {
|
|||||||
Length c.Ulong
|
Length c.Ulong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the source location associated with a given file/line/column
|
||||||
|
* in a particular translation unit.
|
||||||
|
*/
|
||||||
|
// llgo:link (*TranslationUnit).wrapGetLocation C.wrap_clang_getLocation
|
||||||
|
func (t *TranslationUnit) wrapGetLocation(file File, line, column c.Uint, loc *SourceLocation) {}
|
||||||
|
|
||||||
|
func (t *TranslationUnit) GetLocation(file File, line, column c.Uint) (ret SourceLocation) {
|
||||||
|
t.wrapGetLocation(file, line, column, &ret)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the source location associated with a given character offset
|
||||||
|
* in a particular translation unit.
|
||||||
|
*/
|
||||||
|
// llgo:link (*TranslationUnit).wrapGetLocationForOffset C.wrap_clang_getLocationForOffset
|
||||||
|
func (t *TranslationUnit) wrapGetLocationForOffset(file File, offset c.Uint, loc *SourceLocation) {}
|
||||||
|
|
||||||
|
func (t *TranslationUnit) GetLocationForOffset(file File, offset c.Uint) (ret SourceLocation) {
|
||||||
|
t.wrapGetLocationForOffset(file, offset, &ret)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An "index" that consists of a set of translation units that would
|
* An "index" that consists of a set of translation units that would
|
||||||
* typically be linked together into an executable or library.
|
* typically be linked together into an executable or library.
|
||||||
|
|||||||
Reference in New Issue
Block a user