[cfe-commits] r62491 - /cfe/trunk/include/clang/Basic/SourceLocation.h
Chris Lattner
sabre at nondot.org
Sun Jan 18 22:55:08 PST 2009
Author: lattner
Date: Mon Jan 19 00:55:08 2009
New Revision: 62491
URL: http://llvm.org/viewvc/llvm-project?rev=62491&view=rev
Log:
make a bunch of more SourceLocation methods private.
Modified:
cfe/trunk/include/clang/Basic/SourceLocation.h
Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=62491&r1=62490&r2=62491&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Mon Jan 19 00:55:08 2009
@@ -101,6 +101,19 @@
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 @@
L.ID = (ChunkID << FilePosBits) | FilePos;
return L;
}
-public:
static bool isValidMacroSpellingOffs(int Val) {
if (Val >= 0)
@@ -139,16 +151,7 @@
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 @@
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 @@
unsigned ShAmt = sizeof(int)*8 - MacroSpellingOffsBits;
return (Val << ShAmt) >> ShAmt;
}
+public:
/// getFileLocWithOffset - Return a source location with the specified offset
/// from this file SourceLocation.
More information about the cfe-commits
mailing list