FFI::ClangSourceFFIClangSourceLocation

class SourceLocation

Represents a location in source code. This base class provides common functionality for source locations, with specific subclasses for different types of location information.

Definitions

def self.null_location

Get a null source location.

Signature

returns ExpansionLocation

A null location that can be used for comparisons.

Implementation

def self.null_location
	ExpansionLocation.new Lib.get_null_location
end

attr_reader :location

Signature

attribute r

location

returns FFI::Pointer

The underlying location pointer.

def initialize(location)

Create a new source location.

Signature

parameter location FFI::Pointer

The low-level location handle.

Implementation

def initialize(location)
	@location = location
end

def in_system_header?

Check if this location is in a system header.

Signature

returns Boolean

True if the location is in a system header file.

Implementation

def in_system_header?
	Lib.location_in_system_header(@location) != 0
end

def from_main_file?

Check if this location is from the main file.

Signature

returns Boolean

True if the location is from the main translation unit file.

Implementation

def from_main_file?
	Lib.location_is_from_main_file(@location) != 0
end

def null?

Check if this location is null.

Signature

returns Boolean

True if this is a null location.

Implementation

def null?
	Lib.equal_locations(@location, Lib.get_null_location) != 0
end

def ==(other)

Compare this location with another for equality.

Signature

parameter other SourceLocation

The other location to compare.

returns Boolean

True if the locations are equal.

Implementation

def ==(other)
	Lib.equal_locations(@location, other.location) != 0
end