CodeQL library for C/C++
codeql/cpp-all 2.0.2-dev (changelog, source)
Search

Class Location

A location of a C/C++ artifact.

Import path

import cpp

Direct supertypes

Known direct subtypes

Predicates

charLoc

Holds if this location corresponds to file f and character “offsets” start..end. Note that these are not real character offsets, because we use maxCols to find the length of the longest line and then pretend that all the lines are the same length. However, these offsets are convenient for comparing or sorting locations in a file. For an example, see subsumes.

fullLocationInfo

Holds if this element is in the specified container. The location spans column startcolumn of line startline to column endcolumn of line endline.

getContainer

Gets the container corresponding to this location.

getEndColumn

Gets the 1-based column number (inclusive) where this location ends.

getEndLine

Gets the 1-based line number (inclusive) where this location ends.

getFile

Gets the file corresponding to this location, if any.

getStartColumn

Gets the 1-based column number (inclusive) where this location starts.

getStartLine

Gets the 1-based line number (inclusive) where this location starts.

hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

isBefore

Holds if this comes on a line strictly before l.

isBefore

Holds if this comes strictly before l. The boolean sameLine is true if l is on the same line as this, but starts at a later column. Otherwise, sameLine is false.

subsumes

Holds if location l is completely contained within this one.

toString

Gets a textual representation of this element.