diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-19 07:00:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-19 07:00:35 +0000 |
commit | 6fda54c19321673965536b0a8f7236f635cf9730 (patch) | |
tree | 157027d4f240711ddc1e8d49fdacd2264fc7ec4c /include/clang/Basic/SourceLocation.h | |
parent | 9ebac5e0dab6f99717e3ff169c45048966146b2e (diff) |
privatize getChunkID/getMacroID, and move operator< out of the class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceLocation.h')
-rw-r--r-- | include/clang/Basic/SourceLocation.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 5c52906723..e56ce98026 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -101,6 +101,7 @@ public: bool isValid() const { return ID != 0; } bool isInvalid() const { return ID == 0; } +private: /// getChunkID - Return the chunk identifier for this SourceLocation. This /// ChunkID can be used with the SourceManager object to obtain an entire /// include stack for a file position reference. @@ -108,13 +109,12 @@ public: assert(isFileID() && "can't get the file id of a non-file sloc!"); return ID >> FilePosBits; } - + unsigned getMacroID() const { assert(isMacroID() && "Is not a macro id!"); return (ID >> MacroSpellingOffsBits) & ((1 << MacroIDBits)-1); } -private: static SourceLocation getFileLoc(unsigned ChunkID, unsigned FilePos) { SourceLocation L; // If a FilePos is larger than (1<<FilePosBits), the SourceManager makes @@ -191,10 +191,6 @@ public: unsigned getRawEncoding() const { return ID; } - bool operator<(const SourceLocation &RHS) const { - return ID < RHS.ID; - } - /// getFromRawEncoding - Turn a raw encoding of a SourceLocation object into /// a real SourceLocation. static SourceLocation getFromRawEncoding(unsigned Encoding) { @@ -217,6 +213,10 @@ inline bool operator==(const SourceLocation &LHS, const SourceLocation &RHS) { inline bool operator!=(const SourceLocation &LHS, const SourceLocation &RHS) { return !(LHS == RHS); } + +inline bool operator<(const SourceLocation &LHS, const SourceLocation &RHS) { + return LHS.getRawEncoding() < RHS.getRawEncoding(); +} /// SourceRange - a trival tuple used to represent a source range. class SourceRange { |