class SourceLocation
Declaration
class SourceLocation { /* full declaration omitted */ };
Description
Encodes a location in the source. The SourceManager can decode this to get at the full include stack, line and column information. Technically, a source location is simply an offset into the manager's view of the input source, which is all input buffers (including macro expansions) concatenated in an effectively arbitrary order. The manager actually maintains two blocks of input buffers. One, starting at offset 0 and growing upwards, contains all buffers from this module. The other, starting at the highest possible offset and growing downwards, contains buffers of loaded modules. In addition, one bit of SourceLocation is used for quick access to the information whether the location is in a file or a macro expansion. It is important that this type remains small. It is currently 32 bits wide.
Declared at: clang/include/clang/Basic/SourceLocation.h:86
Member Variables
- private clang::SourceLocation::UIntTy ID = 0
Method Overview
- public void dump(const clang::SourceManager & SM) const
- private static clang::SourceLocation getFileLoc(clang::SourceLocation::UIntTy ID)
- public static clang::SourceLocation getFromPtrEncoding(const void * Encoding)
- public static clang::SourceLocation getFromRawEncoding(clang::SourceLocation::UIntTy Encoding)
- public unsigned int getHashValue() const
- public clang::SourceLocation getLocWithOffset(clang::SourceLocation::IntTy Offset) const
- private static clang::SourceLocation getMacroLoc(clang::SourceLocation::UIntTy ID)
- private clang::SourceLocation::UIntTy getOffset() const
- public void * getPtrEncoding() const
- public clang::SourceLocation::UIntTy getRawEncoding() const
- public bool isFileID() const
- public bool isInvalid() const
- public bool isMacroID() const
- public static bool isPairOfFileLocations(clang::SourceLocation Start, clang::SourceLocation End)
- public bool isValid() const
- public void print(llvm::raw_ostream & OS, const clang::SourceManager & SM) const
- public std::string printToString(const clang::SourceManager & SM) const
Methods
¶void dump(const clang::SourceManager& SM) const
void dump(const clang::SourceManager& SM) const
Declared at: clang/include/clang/Basic/SourceLocation.h:183
Parameters
- const clang::SourceManager& SM
¶static clang::SourceLocation getFileLoc(
clang::SourceLocation::UIntTy ID)
static clang::SourceLocation getFileLoc(
clang::SourceLocation::UIntTy ID)
Declared at: clang/include/clang/Basic/SourceLocation.h:117
Parameters
- clang::SourceLocation::UIntTy ID
¶static clang::SourceLocation getFromPtrEncoding(
const void* Encoding)
static clang::SourceLocation getFromPtrEncoding(
const void* Encoding)
Description
Turn a pointer encoding of a SourceLocation object back into a real SourceLocation.
Declared at: clang/include/clang/Basic/SourceLocation.h:171
Parameters
- const void* Encoding
¶static clang::SourceLocation getFromRawEncoding(
clang::SourceLocation::UIntTy Encoding)
static clang::SourceLocation getFromRawEncoding(
clang::SourceLocation::UIntTy Encoding)
Description
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Declared at: clang/include/clang/Basic/SourceLocation.h:152
Parameters
- clang::SourceLocation::UIntTy Encoding
¶unsigned int getHashValue() const
unsigned int getHashValue() const
Declared at: clang/include/clang/Basic/SourceLocation.h:180
¶clang::SourceLocation getLocWithOffset(
clang::SourceLocation::IntTy Offset) const
clang::SourceLocation getLocWithOffset(
clang::SourceLocation::IntTy Offset) const
Description
Return a source location with the specified offset from this SourceLocation.
Declared at: clang/include/clang/Basic/SourceLocation.h:134
Parameters
- clang::SourceLocation::IntTy Offset
¶static clang::SourceLocation getMacroLoc(
clang::SourceLocation::UIntTy ID)
static clang::SourceLocation getMacroLoc(
clang::SourceLocation::UIntTy ID)
Declared at: clang/include/clang/Basic/SourceLocation.h:124
Parameters
- clang::SourceLocation::UIntTy ID
¶clang::SourceLocation::UIntTy getOffset() const
clang::SourceLocation::UIntTy getOffset() const
Description
Return the offset into the manager's global input view.
Declared at: clang/include/clang/Basic/SourceLocation.h:115
¶void* getPtrEncoding() const
void* getPtrEncoding() const
Description
When a SourceLocation itself cannot be used, this returns an (opaque) pointer encoding for it. This should only be passed to SourceLocation::getFromPtrEncoding, it should not be inspected directly.
Declared at: clang/include/clang/Basic/SourceLocation.h:163
¶clang::SourceLocation::UIntTy getRawEncoding()
const
clang::SourceLocation::UIntTy getRawEncoding()
const
Description
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it. This should only be passed to SourceLocation::getFromRawEncoding, it should not be inspected directly.
Declared at: clang/include/clang/Basic/SourceLocation.h:146
¶bool isFileID() const
bool isFileID() const
Declared at: clang/include/clang/Basic/SourceLocation.h:102
¶bool isInvalid() const
bool isInvalid() const
Declared at: clang/include/clang/Basic/SourceLocation.h:111
¶bool isMacroID() const
bool isMacroID() const
Declared at: clang/include/clang/Basic/SourceLocation.h:103
¶static bool isPairOfFileLocations(
clang::SourceLocation Start,
clang::SourceLocation End)
static bool isPairOfFileLocations(
clang::SourceLocation Start,
clang::SourceLocation End)
Declared at: clang/include/clang/Basic/SourceLocation.h:175
Parameters
¶bool isValid() const
bool isValid() const
Description
Return true if this is a valid SourceLocation object. Invalid SourceLocations are often used when events have no corresponding location in the source (e.g. a diagnostic is required for a command line option).
Declared at: clang/include/clang/Basic/SourceLocation.h:110
¶void print(llvm::raw_ostream& OS,
const clang::SourceManager& SM) const
void print(llvm::raw_ostream& OS,
const clang::SourceManager& SM) const
Declared at: clang/include/clang/Basic/SourceLocation.h:181
Parameters
- llvm::raw_ostream& OS
- const clang::SourceManager& SM
¶std::string printToString(
const clang::SourceManager& SM) const
std::string printToString(
const clang::SourceManager& SM) const
Declared at: clang/include/clang/Basic/SourceLocation.h:182
Parameters
- const clang::SourceManager& SM