clang: clang::syntax::FileRange Struct Reference (original) (raw)

A half-open character range inside a particular file, the start offset is included and the end offset is excluded from the range. More...

#include "[clang/Tooling/Syntax/Tokens.h](Tokens%5F8h%5Fsource.html)"

Public Member Functions
FileRange (FileID File, unsigned BeginOffset, unsigned EndOffset)
EXPECTS: File.isValid() && Begin <= End.
FileRange (const SourceManager &SM, SourceLocation BeginLoc, unsigned Length)
EXPECTS: BeginLoc.isValid() && BeginLoc.isFileID().
FileRange (const SourceManager &SM, SourceLocation BeginLoc, SourceLocation EndLoc)
EXPECTS: BeginLoc.isValid() && BeginLoc.isFileID(), Begin <= End and files are the same.
FileID file () const
unsigned beginOffset () const
Start is a start offset (inclusive) in the corresponding file.
unsigned endOffset () const
End offset (exclusive) in the corresponding file.
unsigned length () const
bool contains (unsigned Offset) const
Check if Offset is inside the range.
bool touches (unsigned Offset) const
Check Offset is inside the range or equal to its endpoint.
llvm::StringRef text (const SourceManager &SM) const
Gets the substring that this FileRange refers to.
CharSourceRange toCharRange (const SourceManager &SM) const
Convert to the clang range.

A half-open character range inside a particular file, the start offset is included and the end offset is excluded from the range.

Definition at line 50 of file Tokens.h.

FileRange() [2/3]

FileRange() [3/3]

beginOffset()

unsigned clang::syntax::FileRange::beginOffset ( ) const inline

contains()

bool clang::syntax::FileRange::contains ( unsigned Offset) const inline

Check if Offset is inside the range.

Definition at line 69 of file Tokens.h.

endOffset()

unsigned clang::syntax::FileRange::endOffset ( ) const inline

file()

FileID clang::syntax::FileRange::file ( ) const inline

length()

unsigned clang::syntax::FileRange::length ( ) const inline

text()

llvm::StringRef FileRange::text ( const SourceManager & SM ) const

toCharRange()

Convert to the clang range.

The returned range is always a char range, never a token range.

Definition at line 262 of file Tokens.cpp.

References SM.

touches()

bool clang::syntax::FileRange::touches ( unsigned Offset) const inline

Check Offset is inside the range or equal to its endpoint.

Definition at line 73 of file Tokens.h.

operator!=

operator==


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