Make the size() method const
llvm-svn: 18852
diff --git a/llvm/include/llvm/System/MappedFile.h b/llvm/include/llvm/System/MappedFile.h
index 526d11b..f73618a 100644
--- a/llvm/include/llvm/System/MappedFile.h
+++ b/llvm/include/llvm/System/MappedFile.h
@@ -94,7 +94,7 @@
/// This function returns the number of bytes in the file.
/// @throws std::string if an error occurs
- size_t size();
+ size_t size() const;
/// @}
/// @name Mutators
@@ -137,7 +137,7 @@
sys::Path path_; ///< Path to the file.
int options_; ///< Options used to create the mapping
void* base_; ///< Pointer to the base memory address
- MappedFileInfo* info_; ///< Platform specific info for the mapping
+ mutable MappedFileInfo* info_; ///< Platform specific info for the mapping
/// @}
/// @name Disabled
diff --git a/llvm/lib/System/Unix/MappedFile.cpp b/llvm/lib/System/Unix/MappedFile.cpp
index 1c9622d..36a17e0 100644
--- a/llvm/lib/System/Unix/MappedFile.cpp
+++ b/llvm/lib/System/Unix/MappedFile.cpp
@@ -108,7 +108,7 @@
return base_;
}
-size_t MappedFile::size() {
+size_t MappedFile::size() const {
assert(info_ && "MappedFile not initialized");
return info_->sbuf_.st_size;
}