summaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-06-12 18:01:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-06-12 18:01:31 +0000
commitbd5abe19687421cb3ad4dca066732ed0b437531b (patch)
treea9b264321873e7d25e69b8671c9f705ebc6d30ee /contrib/llvm/lib/Support/MemoryBuffer.cpp
parent74d92904a6e0f2d301cdeec3f8af4fbe4a968146 (diff)
parent56fe8f14099930935e3870e3e823c322a85c1c89 (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r--contrib/llvm/lib/Support/MemoryBuffer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/llvm/lib/Support/MemoryBuffer.cpp b/contrib/llvm/lib/Support/MemoryBuffer.cpp
index e2b5b7a58523..d264be9aced1 100644
--- a/contrib/llvm/lib/Support/MemoryBuffer.cpp
+++ b/contrib/llvm/lib/Support/MemoryBuffer.cpp
@@ -67,7 +67,7 @@ static void CopyStringRef(char *Memory, StringRef Data) {
/// GetNamedBuffer - Allocates a new MemoryBuffer with Name copied after it.
template <typename T>
-static T* GetNamedBuffer(StringRef Buffer, StringRef Name,
+static T *GetNamedBuffer(StringRef Buffer, StringRef Name,
bool RequiresNullTerminator) {
char *Mem = static_cast<char*>(operator new(sizeof(T) + Name.size() + 1));
CopyStringRef(Mem + sizeof(T), Name);
@@ -94,7 +94,7 @@ public:
}
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
-/// that EndPtr[0] must be a null byte and be accessible!
+/// that InputData must be a null terminated if RequiresNullTerminator is true!
MemoryBuffer *MemoryBuffer::getMemBuffer(StringRef InputData,
StringRef BufferName,
bool RequiresNullTerminator) {
@@ -221,9 +221,9 @@ error_code MemoryBuffer::getFile(const char *Filename,
OpenFlags |= O_BINARY; // Open input file in binary mode on win32.
#endif
int FD = ::open(Filename, OpenFlags);
- if (FD == -1) {
+ if (FD == -1)
return error_code(errno, posix_category());
- }
+
error_code ret = getOpenFile(FD, Filename, result, FileSize, FileSize,
0, RequiresNullTerminator);
close(FD);