clang 20.0.0git
|
A SourceLocation and its associated SourceManager. More...
#include "clang/Basic/SourceLocation.h"
Classes | |
struct | BeforeThanCompare |
Comparison function class, useful for sorting FullSourceLocs. More... | |
Public Member Functions | |
FullSourceLoc ()=default | |
Creates a FullSourceLoc where isValid() returns false . | |
FullSourceLoc (SourceLocation Loc, const SourceManager &SM) | |
bool | hasManager () const |
Checks whether the SourceManager is present. | |
const SourceManager & | getManager () const |
FileID | getFileID () const |
FullSourceLoc | getExpansionLoc () const |
FullSourceLoc | getSpellingLoc () const |
FullSourceLoc | getFileLoc () const |
PresumedLoc | getPresumedLoc (bool UseLineDirectives=true) const |
bool | isMacroArgExpansion (FullSourceLoc *StartLoc=nullptr) const |
FullSourceLoc | getImmediateMacroCallerLoc () const |
std::pair< FullSourceLoc, StringRef > | getModuleImportLoc () const |
unsigned | getFileOffset () const |
unsigned | getExpansionLineNumber (bool *Invalid=nullptr) const |
unsigned | getExpansionColumnNumber (bool *Invalid=nullptr) const |
std::pair< FileID, unsigned > | getDecomposedExpansionLoc () const |
Decompose the underlying SourceLocation into a raw (FileID + Offset) pair, after walking through all expansion records. | |
unsigned | getSpellingLineNumber (bool *Invalid=nullptr) const |
unsigned | getSpellingColumnNumber (bool *Invalid=nullptr) const |
const char * | getCharacterData (bool *Invalid=nullptr) const |
unsigned | getLineNumber (bool *Invalid=nullptr) const |
unsigned | getColumnNumber (bool *Invalid=nullptr) const |
const FileEntry * | getFileEntry () const |
OptionalFileEntryRef | getFileEntryRef () const |
StringRef | getBufferData (bool *Invalid=nullptr) const |
Return a StringRef to the source buffer data for the specified FileID. | |
std::pair< FileID, unsigned > | getDecomposedLoc () const |
Decompose the specified location into a raw FileID + Offset pair. | |
bool | isInSystemHeader () const |
bool | isBeforeInTranslationUnitThan (SourceLocation Loc) const |
Determines the order of 2 source locations in the translation unit. | |
bool | isBeforeInTranslationUnitThan (FullSourceLoc Loc) const |
Determines the order of 2 source locations in the translation unit. | |
void | dump () const |
Prints information about this FullSourceLoc to stderr. | |
Public Member Functions inherited from clang::SourceLocation | |
bool | isFileID () const |
bool | isMacroID () const |
bool | isValid () const |
Return true if this is a valid SourceLocation object. | |
bool | isInvalid () const |
SourceLocation | getLocWithOffset (IntTy Offset) const |
Return a source location with the specified offset from this SourceLocation. | |
UIntTy | getRawEncoding () const |
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it. | |
void * | getPtrEncoding () const |
When a SourceLocation itself cannot be used, this returns an (opaque) pointer encoding for it. | |
unsigned | getHashValue () const |
void | print (raw_ostream &OS, const SourceManager &SM) const |
std::string | printToString (const SourceManager &SM) const |
void | dump (const SourceManager &SM) const |
Friends | |
bool | operator== (const FullSourceLoc &LHS, const FullSourceLoc &RHS) |
bool | operator!= (const FullSourceLoc &LHS, const FullSourceLoc &RHS) |
Additional Inherited Members | |
Public Types inherited from clang::SourceLocation | |
using | UIntTy = uint32_t |
using | IntTy = int32_t |
Static Public Member Functions inherited from clang::SourceLocation | |
static SourceLocation | getFromRawEncoding (UIntTy Encoding) |
Turn a raw encoding of a SourceLocation object into a real SourceLocation. | |
static SourceLocation | getFromPtrEncoding (const void *Encoding) |
Turn a pointer encoding of a SourceLocation object back into a real SourceLocation. | |
static bool | isPairOfFileLocations (SourceLocation Start, SourceLocation End) |
A SourceLocation and its associated SourceManager.
This is useful for argument passing to functions that expect both objects.
This class does not guarantee the presence of either the SourceManager or a valid SourceLocation. Clients should use isValid()
and hasManager()
before calling the member functions.
Definition at line 369 of file SourceLocation.h.
|
default |
Creates a FullSourceLoc where isValid() returns false
.
Referenced by getExpansionLoc(), getFileLoc(), getImmediateMacroCallerLoc(), getModuleImportLoc(), and getSpellingLoc().
|
inlineexplicit |
Definition at line 376 of file SourceLocation.h.
LLVM_DUMP_METHOD void FullSourceLoc::dump | ( | ) | const |
Prints information about this FullSourceLoc to stderr.
This is useful for debugging.
Definition at line 265 of file SourceLocation.cpp.
References clang::SourceLocation::dump().
StringRef FullSourceLoc::getBufferData | ( | bool * | Invalid = nullptr | ) | const |
Return a StringRef to the source buffer data for the specified FileID.
Definition at line 274 of file SourceLocation.cpp.
References clang::SourceManager::getBufferData(), clang::SourceManager::getFileID(), clang::Invalid, and clang::SourceLocation::isValid().
Referenced by EmitAlphaCounter().
const char * FullSourceLoc::getCharacterData | ( | bool * | Invalid = nullptr | ) | const |
Definition at line 269 of file SourceLocation.cpp.
References clang::SourceManager::getCharacterData(), clang::Invalid, and clang::SourceLocation::isValid().
Definition at line 220 of file SourceLocation.cpp.
References clang::SourceManager::getColumnNumber(), getFileID(), getFileOffset(), clang::Invalid, and clang::SourceLocation::isValid().
Referenced by clang::TextDiagnostic::emitDiagnosticLoc().
Decompose the underlying SourceLocation
into a raw (FileID + Offset) pair, after walking through all expansion records.
Definition at line 169 of file SourceLocation.cpp.
References clang::SourceManager::getDecomposedExpansionLoc().
Decompose the specified location into a raw FileID + Offset pair.
The first element is the FileID, the second is the offset from the start of the buffer of the location.
Definition at line 279 of file SourceLocation.cpp.
References clang::SourceManager::getDecomposedLoc().
Referenced by clang::tooling::AtomicChange::AtomicChange(), compareCrossTUSourceLocs(), and EmitAlphaCounter().
Definition at line 240 of file SourceLocation.cpp.
References clang::SourceManager::getExpansionColumnNumber(), clang::Invalid, and clang::SourceLocation::isValid().
Definition at line 235 of file SourceLocation.cpp.
References clang::SourceManager::getExpansionLineNumber(), clang::Invalid, and clang::SourceLocation::isValid().
Referenced by NormalizeLine().
FullSourceLoc FullSourceLoc::getExpansionLoc | ( | ) | const |
Definition at line 164 of file SourceLocation.cpp.
References FullSourceLoc(), clang::SourceManager::getExpansionLoc(), and clang::SourceLocation::isValid().
Referenced by EmitAlphaCounter(), and clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic().
const FileEntry * FullSourceLoc::getFileEntry | ( | ) | const |
Definition at line 225 of file SourceLocation.cpp.
References clang::SourceManager::getFileEntryForID(), getFileID(), and clang::SourceLocation::isValid().
OptionalFileEntryRef FullSourceLoc::getFileEntryRef | ( | ) | const |
Definition at line 230 of file SourceLocation.cpp.
References clang::SourceManager::getFileEntryRefForID(), getFileID(), and clang::SourceLocation::isValid().
FileID FullSourceLoc::getFileID | ( | ) | const |
Definition at line 159 of file SourceLocation.cpp.
References clang::SourceManager::getFileID(), and clang::SourceLocation::isValid().
Referenced by compareCrossTUSourceLocs(), getColumnNumber(), getFileEntry(), getFileEntryRef(), getLineNumber(), mapDiagnosticRanges(), and NormalizeLine().
FullSourceLoc FullSourceLoc::getFileLoc | ( | ) | const |
Definition at line 178 of file SourceLocation.cpp.
References FullSourceLoc(), clang::SourceManager::getFileLoc(), and clang::SourceLocation::isValid().
unsigned FullSourceLoc::getFileOffset | ( | ) | const |
Definition at line 210 of file SourceLocation.cpp.
References clang::SourceManager::getFileOffset(), and clang::SourceLocation::isValid().
Referenced by getColumnNumber(), and getLineNumber().
FullSourceLoc FullSourceLoc::getImmediateMacroCallerLoc | ( | ) | const |
Definition at line 195 of file SourceLocation.cpp.
References FullSourceLoc(), clang::SourceManager::getImmediateMacroCallerLoc(), and clang::SourceLocation::isValid().
Definition at line 215 of file SourceLocation.cpp.
References getFileID(), getFileOffset(), clang::SourceManager::getLineNumber(), clang::Invalid, and clang::SourceLocation::isValid().
Referenced by clang::TextDiagnostic::emitDiagnosticLoc().
|
inline |
Definition at line 383 of file SourceLocation.h.
Referenced by compare(), compareCrossTUSourceLocs(), comparePiece(), clang::ento::PathDiagnosticLocation::createSingleLocation(), Diag(), MakeCharSourceRange(), makeStandaloneDiagnostic(), mapDiagnosticRanges(), and clang::operator<<().
std::pair< FullSourceLoc, StringRef > FullSourceLoc::getModuleImportLoc | ( | ) | const |
Definition at line 200 of file SourceLocation.cpp.
References FullSourceLoc(), clang::SourceManager::getModuleImportLoc(), and clang::SourceLocation::isValid().
PresumedLoc FullSourceLoc::getPresumedLoc | ( | bool | UseLineDirectives = true | ) | const |
Definition at line 183 of file SourceLocation.cpp.
References clang::SourceManager::getPresumedLoc(), and clang::SourceLocation::isValid().
Definition at line 250 of file SourceLocation.cpp.
References clang::SourceManager::getSpellingColumnNumber(), clang::Invalid, and clang::SourceLocation::isValid().
Definition at line 245 of file SourceLocation.cpp.
References clang::SourceManager::getSpellingLineNumber(), clang::Invalid, and clang::SourceLocation::isValid().
FullSourceLoc FullSourceLoc::getSpellingLoc | ( | ) | const |
Definition at line 173 of file SourceLocation.cpp.
References FullSourceLoc(), clang::SourceManager::getSpellingLoc(), and clang::SourceLocation::isValid().
Referenced by clang::tooling::AtomicChange::AtomicChange(), and compareCrossTUSourceLocs().
|
inline |
Checks whether the SourceManager is present.
Definition at line 380 of file SourceLocation.h.
Referenced by clang::operator<<().
|
inline |
Determines the order of 2 source locations in the translation unit.
Definition at line 439 of file SourceLocation.h.
References isBeforeInTranslationUnitThan(), and Loc.
bool FullSourceLoc::isBeforeInTranslationUnitThan | ( | SourceLocation | Loc | ) | const |
Determines the order of 2 source locations in the translation unit.
Definition at line 260 of file SourceLocation.cpp.
References clang::SourceManager::isBeforeInTranslationUnit(), clang::SourceLocation::isValid(), and Loc.
Referenced by clang::arcmt::CapturedDiagList::clearDiagnostic(), compareCall(), compareControlFlow(), compareCrossTUSourceLocs(), comparePiece(), clang::arcmt::CapturedDiagList::hasDiagnostic(), isBeforeInTranslationUnitThan(), and clang::FullSourceLoc::BeforeThanCompare::operator()().
bool FullSourceLoc::isInSystemHeader | ( | ) | const |
Definition at line 255 of file SourceLocation.cpp.
References clang::SourceManager::isInSystemHeader(), and clang::SourceLocation::isValid().
bool FullSourceLoc::isMacroArgExpansion | ( | FullSourceLoc * | StartLoc = nullptr | ) | const |
Definition at line 190 of file SourceLocation.cpp.
References clang::SourceManager::isMacroArgExpansion(), and clang::SourceLocation::isValid().
|
friend |
Definition at line 464 of file SourceLocation.h.
|
friend |
Definition at line 458 of file SourceLocation.h.