aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-05-22 00:50:53 +0000
committerChris Lattner <sabre@nondot.org>2011-05-22 00:50:53 +0000
commit9bb4a2ae8a0ce6404b9752f93ceebb2d00401997 (patch)
tree08eb9726ea04780adb0496177a807a71c1a8fbde
parentefce071fd67bd9a92f722210a9795330d30206d0 (diff)
downloadexternal_llvm-9bb4a2ae8a0ce6404b9752f93ceebb2d00401997.zip
external_llvm-9bb4a2ae8a0ce6404b9752f93ceebb2d00401997.tar.gz
external_llvm-9bb4a2ae8a0ce6404b9752f93ceebb2d00401997.tar.bz2
random comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131829 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/MemoryBuffer.h2
-rw-r--r--lib/Support/MemoryBuffer.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index d912e86..5e55bd9 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -81,7 +81,7 @@ public:
bool RequiresNullTerminator = true);
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
- /// that InputData must be null terminated.
+ /// that InputData must be null terminated if RequiresNullTerminator is true.
static MemoryBuffer *getMemBuffer(StringRef InputData,
StringRef BufferName = "",
bool RequiresNullTerminator = true);
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index e2b5b7a..d264be9 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/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);