aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceLocation.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-19 06:55:08 +0000
committerChris Lattner <sabre@nondot.org>2009-01-19 06:55:08 +0000
commit4d10ef18c32eae35be07e0d8d18b5ff485b4c5f9 (patch)
tree89d5aa11ac989d3cc87f890a90afccc55f11cd89 /include/clang/Basic/SourceLocation.h
parentbcc2a67e5180612417727cbdd8afd0f79fdf726d (diff)
make a bunch of more SourceLocation methods private.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceLocation.h')
-rw-r--r--include/clang/Basic/SourceLocation.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index 858b763666..2e0fb4d670 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -101,6 +101,19 @@ public:
bool isValid() const { return ID != 0; }
bool isInvalid() const { return ID == 0; }
+ /// 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.
+ unsigned getChunkID() const {
+ 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;
@@ -118,7 +131,6 @@ private:
L.ID = (ChunkID << FilePosBits) | FilePos;
return L;
}
-public:
static bool isValidMacroSpellingOffs(int Val) {
if (Val >= 0)
@@ -139,16 +151,7 @@ public:
SpellingOffs;
return L;
}
-
-
- /// 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.
- unsigned getChunkID() const {
- assert(isFileID() && "can't get the file id of a non-file sloc!");
- return ID >> FilePosBits;
- }
-
+
/// getRawFilePos - Return the byte offset from the start of the file-chunk
/// referred to by ChunkID. This method should not be used to get the offset
/// from the start of the file, instead you should use
@@ -159,11 +162,6 @@ public:
return ID & (ChunkSize-1);
}
- unsigned getMacroID() const {
- assert(isMacroID() && "Is not a macro id!");
- return (ID >> MacroSpellingOffsBits) & ((1 << MacroIDBits)-1);
- }
-
int getMacroSpellingOffs() const {
assert(isMacroID() && "Is not a macro id!");
int Val = ID & ((1 << MacroSpellingOffsBits)-1);
@@ -171,6 +169,7 @@ public:
unsigned ShAmt = sizeof(int)*8 - MacroSpellingOffsBits;
return (Val << ShAmt) >> ShAmt;
}
+public:
/// getFileLocWithOffset - Return a source location with the specified offset
/// from this file SourceLocation.