[cfe-commits] r138381 - in /cfe/trunk: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Aug 23 14:02:45 PDT 2011
Author: akirtzidis
Date: Tue Aug 23 16:02:45 2011
New Revision: 138381
URL: http://llvm.org/viewvc/llvm-project?rev=138381&view=rev
Log:
Remove one SourceManager::isInFileID overload and use isOffsetInFileID for the other.
Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/lib/Basic/SourceManager.cpp
Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=138381&r1=138380&r2=138381&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Tue Aug 23 16:02:45 2011
@@ -1017,15 +1017,15 @@
/// of FileID) to \arg relativeOffset.
bool isInFileID(SourceLocation Loc, FileID FID,
unsigned *RelativeOffset = 0) const {
- return isInFileID(Loc, FID, 0, getFileIDSize(FID), RelativeOffset);
- }
+ unsigned Offs = Loc.getOffset();
+ if (isOffsetInFileID(FID, Offs)) {
+ if (RelativeOffset)
+ *RelativeOffset = Offs - getSLocEntry(FID).getOffset();
+ return true;
+ }
- /// \brief Given a specific chunk of a FileID (FileID with offset+length),
- /// returns true if \arg Loc is inside that chunk and sets relative offset
- /// (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;
+ return false;
+ }
//===--------------------------------------------------------------------===//
// Line Table Manipulation Routines
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=138381&r1=138380&r2=138381&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Tue Aug 23 16:02:45 2011
@@ -1300,30 +1300,6 @@
return NextOffset - Entry.getOffset() - 1;
}
-bool SourceManager::isInFileID(SourceLocation Loc,
- FileID FID, unsigned offset, unsigned length,
- unsigned *relativeOffset) 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;
-}
-
//===----------------------------------------------------------------------===//
// Other miscellaneous methods.
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list