diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-23 21:02:45 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-23 21:02:45 +0000 |
commit | 18c88a96eb243fd4d2ccbf75ab21c2e79702af7d (patch) | |
tree | 80f94aed7382b3ffadf7aeb17fa076b1ca905062 | |
parent | 2797df6a24e9065b37022f922da813a133cfaac2 (diff) | |
download | bcm5719-llvm-18c88a96eb243fd4d2ccbf75ab21c2e79702af7d.tar.gz bcm5719-llvm-18c88a96eb243fd4d2ccbf75ab21c2e79702af7d.zip |
Remove one SourceManager::isInFileID overload and use isOffsetInFileID for the other.
llvm-svn: 138381
-rw-r--r-- | clang/include/clang/Basic/SourceManager.h | 16 | ||||
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 24 |
2 files changed, 8 insertions, 32 deletions
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index 79eba4f3537..0299d2237fd 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -1017,15 +1017,15 @@ public: /// 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 diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 66ae4861a6a..64481476d7f 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -1300,30 +1300,6 @@ unsigned SourceManager::getFileIDSize(FileID FID) const { 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. //===----------------------------------------------------------------------===// |