Lines Matching defs:SourceLocation

1 //===--- SourceLocation.h - Compact identifier for Source Files -*- C++ -*-===//
11 /// \brief Defines the clang::SourceLocation class and associated facilities.
83 /// In addition, one bit of SourceLocation is used for quick access to the
87 class SourceLocation {
97 SourceLocation() : ID(0) {}
102 /// \brief Return true if this is a valid SourceLocation object.
116 static SourceLocation getFileLoc(unsigned ID) {
118 SourceLocation L;
123 static SourceLocation getMacroLoc(unsigned ID) {
125 SourceLocation L;
132 /// SourceLocation.
133 SourceLocation getLocWithOffset(int Offset) const {
135 SourceLocation L;
140 /// \brief When a SourceLocation itself cannot be used, this returns
143 /// This should only be passed to SourceLocation::getFromRawEncoding, it
147 /// \brief Turn a raw encoding of a SourceLocation object into
148 /// a real SourceLocation.
151 static SourceLocation getFromRawEncoding(unsigned Encoding) {
152 SourceLocation X;
157 /// \brief When a SourceLocation itself cannot be used, this returns
160 /// This should only be passed to SourceLocation::getFromPtrEncoding, it
168 /// \brief Turn a pointer encoding of a SourceLocation object back
169 /// into a real SourceLocation.
170 static SourceLocation getFromPtrEncoding(const void *Encoding) {
179 inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) {
183 inline bool operator!=(const SourceLocation &LHS, const SourceLocation &RHS) {
187 inline bool operator<(const SourceLocation &LHS, const SourceLocation &RHS) {
193 SourceLocation B;
194 SourceLocation E;
196 SourceRange(): B(SourceLocation()), E(SourceLocation()) {}
197 SourceRange(SourceLocation loc) : B(loc), E(loc) {}
198 SourceRange(SourceLocation begin, SourceLocation end) : B(begin), E(end) {}
200 SourceLocation getBegin() const { return B; }
201 SourceLocation getEnd() const { return E; }
203 void setBegin(SourceLocation b) { B = b; }
204 void setEnd(SourceLocation e) { E = e; }
240 static CharSourceRange getTokenRange(SourceLocation B, SourceLocation E) {
243 static CharSourceRange getCharRange(SourceLocation B, SourceLocation E) {
253 SourceLocation getBegin() const { return Range.getBegin(); }
254 SourceLocation getEnd() const { return Range.getEnd(); }
257 void setBegin(SourceLocation b) { Range.setBegin(b); }
258 void setEnd(SourceLocation e) { Range.setEnd(e); }
264 /// \brief A SourceLocation and its associated SourceManager.
267 class FullSourceLoc : public SourceLocation {
273 explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM)
274 : SourceLocation(Loc), SrcMgr(&SM) {}
312 bool isBeforeInTranslationUnitThan(SourceLocation Loc) const;
320 return isBeforeInTranslationUnitThan((SourceLocation)Loc);
355 /// You can get a PresumedLoc from a SourceLocation with SourceManager.
359 SourceLocation IncludeLoc;
362 PresumedLoc(const char *FN, unsigned Ln, unsigned Co, SourceLocation IL)
391 SourceLocation getIncludeLoc() const { return IncludeLoc; }
419 struct isPodLike<clang::SourceLocation> { static const bool value = true; };
423 // Teach SmallPtrSet how to handle SourceLocation.
425 class PointerLikeTypeTraits<clang::SourceLocation> {
427 static inline void *getAsVoidPointer(clang::SourceLocation L) {
430 static inline clang::SourceLocation getFromVoidPointer(void *P) {
431 return clang::SourceLocation::getFromRawEncoding((unsigned)(uintptr_t)P);