struct FileRange

Declaration

struct FileRange { /* full declaration omitted */ };

Description

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

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:51

Member Variables

private clang::FileID File
private unsigned int Begin
private unsigned int End

Method Overview

  • public FileRange(clang::FileID File, unsigned int BeginOffset, unsigned int EndOffset)
  • public FileRange(const clang::SourceManager & SM, clang::SourceLocation BeginLoc, unsigned int Length)
  • public FileRange(const clang::SourceManager & SM, clang::SourceLocation BeginLoc, clang::SourceLocation EndLoc)
  • public unsigned int beginOffset() const
  • public bool contains(unsigned int Offset) const
  • public unsigned int endOffset() const
  • public clang::FileID file() const
  • public unsigned int length() const
  • public llvm::StringRef text(const clang::SourceManager & SM) const
  • public clang::CharSourceRange toCharRange(const clang::SourceManager & SM) const
  • public bool touches(unsigned int Offset) const

Methods

FileRange(clang::FileID File,
          unsigned int BeginOffset,
          unsigned int EndOffset)

Description

EXPECTS: File.isValid() & & Begin < = End.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:53

Parameters

clang::FileID File
unsigned int BeginOffset
unsigned int EndOffset

FileRange(const clang::SourceManager& SM,
          clang::SourceLocation BeginLoc,
          unsigned int Length)

Description

EXPECTS: BeginLoc.isValid() & & BeginLoc.isFileID().

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:55

Parameters

const clang::SourceManager& SM
clang::SourceLocation BeginLoc
unsigned int Length

FileRange(const clang::SourceManager& SM,
          clang::SourceLocation BeginLoc,
          clang::SourceLocation EndLoc)

Description

EXPECTS: BeginLoc.isValid() & & BeginLoc.isFileID(), Begin < = End and files are the same.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:58

Parameters

const clang::SourceManager& SM
clang::SourceLocation BeginLoc
clang::SourceLocation EndLoc

unsigned int beginOffset() const

Description

Start is a start offset (inclusive) in the corresponding file.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:63

bool contains(unsigned int Offset) const

Description

Check if \p Offset is inside the range.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:70

Parameters

unsigned int Offset

unsigned int endOffset() const

Description

End offset (exclusive) in the corresponding file.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:65

clang::FileID file() const

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:61

unsigned int length() const

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:67

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

Description

Gets the substring that this FileRange refers to.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:79

Parameters

const clang::SourceManager& SM

clang::CharSourceRange toCharRange(
    const clang::SourceManager& SM) const

Description

Convert to the clang range. The returned range is always a char range, never a token range.

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:83

Parameters

const clang::SourceManager& SM

bool touches(unsigned int Offset) const

Description

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

Declared at: clang/include/clang/Tooling/Syntax/Tokens.h:74

Parameters

unsigned int Offset