diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-07-29 22:26:10 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-07-29 22:26:10 +0000 |
commit | 6d8cf83a4da6fcfff5ee88d8a9dbf4b141e18c30 (patch) | |
tree | f876788fa91e7b1ddbe1dd6adf9829e96e33fbf5 /clang/lib/Basic/SourceManager.cpp | |
parent | f8542ec305586a1df10b6aa66445eda4bbb824ab (diff) | |
download | bcm5719-llvm-6d8cf83a4da6fcfff5ee88d8a9dbf4b141e18c30.tar.gz bcm5719-llvm-6d8cf83a4da6fcfff5ee88d8a9dbf4b141e18c30.zip |
Simplified SourceManager::translateLineCol a bit.
Reviewers: rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1183
llvm-svn: 187386
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 755675ff1d2..fca0dba9906 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -1734,7 +1734,7 @@ SourceLocation SourceManager::translateLineCol(FileID FID, const SLocEntry &Entry = getSLocEntry(FID, &Invalid); if (Invalid) return SourceLocation(); - + if (!Entry.isFile()) return SourceLocation(); @@ -1747,7 +1747,7 @@ SourceLocation SourceManager::translateLineCol(FileID FID, = const_cast<ContentCache *>(Entry.getFile().getContentCache()); if (!Content) return SourceLocation(); - + // If this is the first use of line information for this buffer, compute the // SourceLineCache for it on demand. if (Content->SourceLineCache == 0) { @@ -1776,10 +1776,7 @@ SourceLocation SourceManager::translateLineCol(FileID FID, // Check that the given column is valid. while (i < BufLength-1 && i < Col-1 && Buf[i] != '\n' && Buf[i] != '\r') ++i; - if (i < Col-1) - return FileLoc.getLocWithOffset(FilePos + i); - - return FileLoc.getLocWithOffset(FilePos + Col - 1); + return FileLoc.getLocWithOffset(FilePos + i); } /// \brief Compute a map of macro argument chunks to their expanded source |