aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/SourceManager.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-23 21:02:28 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-23 21:02:28 +0000
commit984e42ca1ff7775ce39372c314f1cb7d6862c4c7 (patch)
tree676a3befb4770f39288e598a8c4d96166a2223e6 /include/clang/Basic/SourceManager.h
parentec9ef856fb43630949f64f8dbc5059ad47a750d3 (diff)
Move a couple of SourceManager functions out-of-line; no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r--include/clang/Basic/SourceManager.h40
1 files changed, 2 insertions, 38 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 11bde998a1..8e4f9ed1c5 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -967,23 +967,7 @@ public:
}
/// \brief The size of the SLocEnty that \arg FID represents.
- unsigned getFileIDSize(FileID FID) const {
- bool Invalid = false;
- const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &Invalid);
- if (Invalid)
- return 0;
-
- int ID = FID.ID;
- unsigned NextOffset;
- if ((ID > 0 && unsigned(ID+1) == local_sloc_entry_size()))
- NextOffset = getNextLocalOffset();
- else if (ID+1 == -1)
- NextOffset = MaxLoadedOffset;
- else
- NextOffset = getSLocEntry(FileID::get(ID+1)).getOffset();
-
- return NextOffset - Entry.getOffset() - 1;
- }
+ unsigned getFileIDSize(FileID FID) const;
/// \brief Given a specific FileID, returns true if \arg Loc is inside that
/// FileID chunk and sets relative offset (offset of \arg Loc from beginning
@@ -998,27 +982,7 @@ public:
/// (offset of \arg Loc from beginning of chunk) to \arg relativeOffset.
bool isInFileID(SourceLocation Loc,
FileID FID, unsigned offset, unsigned length,
- unsigned *relativeOffset = 0) const {
- assert(!FID.isInvalid());
- if (Loc.isInvalid())
- return false;
-
- unsigned FIDOffs = getSLocEntry(FID).getOffset();
- unsigned start = FIDOffs + offset;
- unsigned end = start + length;
-
- // Make sure offset/length describe a chunk inside the given FileID.
- assert(start < FIDOffs + getFileIDSize(FID));
- assert(end <= FIDOffs + getFileIDSize(FID));
-
- if (Loc.getOffset() >= start && Loc.getOffset() < end) {
- if (relativeOffset)
- *relativeOffset = Loc.getOffset() - start;
- return true;
- }
-
- return false;
- }
+ unsigned *relativeOffset = 0) const;
//===--------------------------------------------------------------------===//
// Line Table Manipulation Routines