libabigail
Public Member Functions | Friends | List of all members
location Class Reference

The source location of a token. More...

#include <abg-ir.h>

Public Member Functions

 location ()
 Default constructor for the location type. More...
 
 location (const location &l)
 Copy constructor of the location. More...
 
void expand (std::string &path, unsigned &line, unsigned &column) const
 Expand the current location into a tripplet file path, line and column number. More...
 
string expand (void) const
 Expand the location into a string. More...
 
bool get_is_artificial () const
 Test if the location is artificial. More...
 
unsigned get_value () const
 Get the value of the location. More...
 
 operator bool () const
 Convert the location into a boolean. More...
 
bool operator< (const location &other) const
 "Less than" operator of the location type. More...
 
locationoperator= (const location &l)
 Assignment operator of the location. More...
 
bool operator== (const location &other) const
 Equality operator of the location type. More...
 
void set_is_artificial (bool f)
 Set the artificial-ness of the location. More...
 

Friends

class location_manager
 

Detailed Description

The source location of a token.

This represents the location of a token coming from a given translation unit. This location is actually an abstraction of cursor in the table of all the locations of all the tokens of the translation unit. That table is managed by the location_manager type. To get the file path, line and column numbers associated to a given instance of location, you need to use the location_manager::expand_location method.

Definition at line 298 of file abg-ir.h.

Constructor & Destructor Documentation

◆ location() [1/2]

location ( const location l)
inline

Copy constructor of the location.

Parameters
lthe location to copy from.

Definition at line 362 of file abg-ir.h.

◆ location() [2/2]

location ( )
inline

Default constructor for the location type.

Definition at line 381 of file abg-ir.h.

Member Function Documentation

◆ expand() [1/2]

void expand ( std::string &  path,
unsigned &  line,
unsigned &  column 
) const

Expand the current location into a tripplet file path, line and column number.

Expand the location into a tripplet path, line and column number.

Parameters
paththe output parameter this function sets the expanded path to.
linethe output parameter this function sets the expanded line number to.
columnthe output parameter this function sets the expanded column number to.
paththe output parameter where this function sets the expanded path.
linethe output parameter where this function sets the expanded line.
columnthe ouptut parameter where this function sets the expanded column.

Definition at line 463 of file abg-ir.cc.

◆ expand() [2/2]

string expand ( void  ) const

Expand the location into a string.

Returns
the string representing the location.

Definition at line 483 of file abg-ir.cc.

◆ get_is_artificial()

bool get_is_artificial ( ) const
inline

Test if the location is artificial.

Being artificial means that the location wasn't generated by the original emitter of the metadata (i.e, the compiler if the metadata is debug info). For instance, the implicit location derived from the position of a given XML element in the abixml file is represented as artificial locations. The same XML element might carry a non-artificial (natural?) location that was originally emitted by the compiler that generated the original debug info the abixml file is derived from.

Returns
true iff the location is artificial.

Definition at line 340 of file abg-ir.h.

◆ get_value()

unsigned get_value ( ) const
inline

Get the value of the location.

Definition at line 387 of file abg-ir.h.

◆ operator bool()

operator bool ( ) const
inline

Convert the location into a boolean.

Returns
true iff the value of the location is different from zero.

Definition at line 394 of file abg-ir.h.

◆ operator<()

bool operator< ( const location other) const
inline

"Less than" operator of the location type.

@parm other the other location type to compare against.

Returns
true iff the current instance is less than the other one.

Definition at line 412 of file abg-ir.h.

◆ operator=()

location& operator= ( const location l)
inline

Assignment operator of the location.

Parameters
lthe location to assign to the current one.

Definition at line 372 of file abg-ir.h.

◆ operator==()

bool operator== ( const location other) const
inline

Equality operator of the location type.

Parameters
otherthe other location to compare against.
Returns
true iff both locations are equal.

Definition at line 403 of file abg-ir.h.

◆ set_is_artificial()

void set_is_artificial ( bool  f)
inline

Set the artificial-ness of the location.

Being artificial means that the location wasn't generated by the original emitter of the metadata (i.e, the compiler if the metadata is debug info). For instance, the implicit location derived from the position of a given XML element in the abixml file is represented as artificial locations. The same XML element might carry a non-artificial (natural?) location that was originally emitted by the compiler that generated the original debug info the abixml file is derived from.

Parameters
fthe new artificial-ness state.

Definition at line 356 of file abg-ir.h.


The documentation for this class was generated from the following files: