[cfe-commits] r73826 - /cfe/trunk/lib/Basic/SourceManager.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Sat Jun 20 01:40:18 PDT 2009
Author: akirtzidis
Date: Sat Jun 20 03:40:15 2009
New Revision: 73826
URL: http://llvm.org/viewvc/llvm-project?rev=73826&view=rev
Log:
Slight modification to column checking inside SourceManager::getLocation().
Modified:
cfe/trunk/lib/Basic/SourceManager.cpp
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=73826&r1=73825&r2=73826&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Sat Jun 20 03:40:15 2009
@@ -940,14 +940,14 @@
return SourceLocation();
unsigned FilePos = Content->SourceLineCache[Line - 1];
- const char *BufStart = Content->getBuffer()->getBufferStart();
- const char *BufEnd = Content->getBuffer()->getBufferEnd();
- const char *p = BufStart;
+ const char *Buf = Content->getBuffer()->getBufferStart();
+ unsigned BufLength = Content->getBuffer()->getBufferEnd() - Buf;
+ unsigned i = 0;
// Check that the given column is valid.
- while (p < BufEnd && *p != '\n' && *p != '\r')
- ++p;
- if (Col > p-BufStart)
+ while (i < BufLength-1 && i < Col-1 && Buf[i] != '\n' && Buf[i] != '\r')
+ ++i;
+ if (i < Col-1)
return SourceLocation();
return getLocForStartOfFile(Content->FirstFID).
More information about the cfe-commits
mailing list