SourceLocation

A SourceLocation represents a particular location within a source file.

Members

Functions

presumed
auto presumed()

Retrieve the file, line, column, and offset represented by the given source location, as specified in a # line directive.

Properties

column
uint column [@property getter]

Get the column represented by this source location.

expansion
Location expansion [@property getter]

Retrieve the file, line, column, and offset represented by the given source location.

file
File file [@property getter]

Get the file represented by this source location. TODO implement with a cache, this is inefficient.

isFromMainFile
bool isFromMainFile [@property getter]

Returns if the given source location is in the main file of the corresponding translation unit.

line
uint line [@property getter]

Get the line represented by this source location.

offset
uint offset [@property getter]

Get the file offset represented by this source location.

path
string path [@property getter]

The path the SourceLocation point to.

spelling
Location spelling [@property getter]

Retrieve the file, line, column, and offset represented by the given source location.

Static functions

empty
SourceLocation empty()

Retrieve a NULL (invalid) source location.

fromOffset
SourceLocation fromOffset(ref TranslationUnit tu, ref File file, uint offset)

Retrieves the source location associated with a given character offset in a particular translation unit. TODO consider moving to TranslationUnit instead

fromPosition
Nullable!SourceLocation fromPosition(ref TranslationUnit tu, ref File file, uint line, uint offset)

Retrieves the source location associated with a given file/line/column in a particular translation unit. TODO consider moving to TranslationUnit instead

Meta