Beispiel #1
0
/*
	Retrieve the file, line, column, and offset represented by
	the given source location.

	If the location refers into a macro instantiation, return where the
	location was originally spelled in the source file.

	Parameter location the location within a source file that will be decomposed
	into its parts.

	Parameter file [out] if non-NULL, will be set to the file to which the given
	source location points.

	Parameter line [out] if non-NULL, will be set to the line to which the given
	source location points.

	Parameter column [out] if non-NULL, will be set to the column to which the given
	source location points.

	Parameter offset [out] if non-NULL, will be set to the offset into the
	buffer to which the given source location points.
*/
func (sl SourceLocation) SpellingLocation() (File, uint32, uint32, uint32) {
	var file File
	var line C.uint
	var column C.uint
	var offset C.uint

	C.clang_getSpellingLocation(sl.c, &file.c, &line, &column, &offset)

	return file, uint32(line), uint32(column), uint32(offset)
}
Beispiel #2
0
/**
 * \brief Retrieve the file, line, column, and offset represented by
 * the given source location.
 *
 * If the location refers into a macro instantiation, return where the
 * location was originally spelled in the source file.
 *
 * \param location the location within a source file that will be decomposed
 * into its parts.
 *
 * \param file [out] if non-NULL, will be set to the file to which the given
 * source location points.
 *
 * \param line [out] if non-NULL, will be set to the line to which the given
 * source location points.
 *
 * \param column [out] if non-NULL, will be set to the column to which the given
 * source location points.
 *
 * \param offset [out] if non-NULL, will be set to the offset into the
 * buffer to which the given source location points.
 */
func (l SourceLocation) SpellingLocation() (file File, line, column, offset uint) {

	cline := C.uint(0)
	ccol := C.uint(0)
	coff := C.uint(0)
	C.clang_getSpellingLocation(l.c,
		&file.c,
		&cline,
		&ccol,
		&coff)
	line = uint(cline)
	column = uint(ccol)
	offset = uint(coff)
	return
}