aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-01 03:40:53 +0000
committerChris Lattner <sabre@nondot.org>2008-04-01 03:40:53 +0000
commit37db5d67f92504226c17cfbf98c07c7bbe3afc3b (patch)
tree28d1260d19e98f93952115670ce81bbd61bf3390 /lib
parenta7750c1142baa5ad812d5209526a0b6568201e0e (diff)
downloadexternal_llvm-37db5d67f92504226c17cfbf98c07c7bbe3afc3b.zip
external_llvm-37db5d67f92504226c17cfbf98c07c7bbe3afc3b.tar.gz
external_llvm-37db5d67f92504226c17cfbf98c07c7bbe3afc3b.tar.bz2
Remove the MappedFile::charBase member, rename base -> getBase() and
make getBase() return a const-correct pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Debugger/SourceFile.cpp8
-rw-r--r--lib/Support/MemoryBuffer.cpp7
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Debugger/SourceFile.cpp b/lib/Debugger/SourceFile.cpp
index 820fc67..75248cd 100644
--- a/lib/Debugger/SourceFile.cpp
+++ b/lib/Debugger/SourceFile.cpp
@@ -28,7 +28,7 @@ void SourceFile::readFile() {
///
void SourceFile::calculateLineOffsets() const {
assert(LineOffset.empty() && "Line offsets already computed!");
- const char *BufPtr = File.charBase();
+ const char *BufPtr = (const char *)File.getBase();
const char *FileStart = BufPtr;
const char *FileEnd = FileStart + File.size();
do {
@@ -61,12 +61,12 @@ void SourceFile::getSourceLine(unsigned LineNo, const char *&LineStart,
if (LineNo >= LineOffset.size()) return;
// Otherwise, they are asking for a valid line, which we can fulfill.
- LineStart = File.charBase()+LineOffset[LineNo];
+ LineStart = (const char *)File.getBase()+LineOffset[LineNo];
if (LineNo+1 < LineOffset.size())
- LineEnd = File.charBase()+LineOffset[LineNo+1];
+ LineEnd = (const char *)File.getBase()+LineOffset[LineNo+1];
else
- LineEnd = File.charBase() + File.size();
+ LineEnd = (const char *)File.getBase() + File.size();
// If the line ended with a newline, strip it off.
while (LineEnd != LineStart && (LineEnd[-1] == '\n' || LineEnd[-1] == '\r'))
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 8cea07f..1850084 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -173,11 +173,12 @@ bool MemoryBufferMMapFile::open(const sys::Path &Filename,
// If this file is not an exact multiple of the system page size (common
// case), then the OS has zero terminated the buffer for us.
- if ((Size & (PageSize-1))) {
- init(File.charBase(), File.charBase()+Size);
+ const char *FileBase = static_cast<const char*>(File.getBase());
+ if ((Size & (PageSize-1)) != 0) {
+ init(FileBase, FileBase+Size);
} else {
// Otherwise, we allocate a new memory buffer and copy the data over
- initCopyOf(File.charBase(), File.charBase()+Size);
+ initCopyOf(FileBase, FileBase+Size);
// No need to keep the file mapped any longer.
File.unmap();