clang 20.0.0git
|
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"
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. | |
Friends | |
bool | operator== (const FileRange &L, const FileRange &R) |
bool | operator!= (const FileRange &L, const FileRange &R) |
A half-open character range inside a particular file, the start offset is included and the end offset is excluded from the range.
EXPECTS: File.isValid() && Begin <= End.
Definition at line 184 of file Tokens.cpp.
References clang::File.
FileRange::FileRange | ( | const SourceManager & | SM, |
SourceLocation | BeginLoc, | ||
unsigned | Length | ||
) |
EXPECTS: BeginLoc.isValid() && BeginLoc.isFileID().
Definition at line 190 of file Tokens.cpp.
References Begin, clang::SourceLocation::isFileID(), clang::SourceLocation::isValid(), and SM.
FileRange::FileRange | ( | const SourceManager & | SM, |
SourceLocation | BeginLoc, | ||
SourceLocation | EndLoc | ||
) |
EXPECTS: BeginLoc.isValid() && BeginLoc.isFileID(), Begin <= End and files are the same.
Definition at line 198 of file Tokens.cpp.
References Begin, clang::SourceLocation::isFileID(), clang::SourceLocation::isValid(), and SM.
|
inline |
Start is a start offset (inclusive) in the corresponding file.
Definition at line 62 of file Tokens.h.
Referenced by clang::syntax::operator<<(), and clang::syntax::tokenize().
|
inline |
End offset (exclusive) in the corresponding file.
Definition at line 64 of file Tokens.h.
Referenced by clang::syntax::operator<<(), and clang::syntax::tokenize().
|
inline |
Definition at line 60 of file Tokens.h.
References clang::File.
Referenced by clang::syntax::operator<<(), and clang::syntax::tokenize().
|
inline |
llvm::StringRef FileRange::text | ( | const SourceManager & | SM | ) | const |
Gets the substring that this FileRange refers to.
Definition at line 218 of file Tokens.cpp.
References Begin, clang::Invalid, length(), SM, and Text.
Referenced by clang::syntax::computeReplacements().
CharSourceRange FileRange::toCharRange | ( | const SourceManager & | SM | ) | const |
Convert to the clang range.
The returned range is always a char range, never a token range.
Definition at line 264 of file Tokens.cpp.