diff options
| author | David Blaikie <dblaikie@gmail.com> | 2012-02-09 19:24:12 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2012-02-09 19:24:12 +0000 |
| commit | 18544b96148ffe0232bd5db84eea52ac01ca21c8 (patch) | |
| tree | cf3e09c037d042f8391a623b79da5dede2e3f3bf /llvm/lib/Support/MemoryBuffer.cpp | |
| parent | b6f7443c3c3ccf39e3936d060d4a197f6d0bd6ef (diff) | |
| download | bcm5719-llvm-18544b96148ffe0232bd5db84eea52ac01ca21c8.tar.gz bcm5719-llvm-18544b96148ffe0232bd5db84eea52ac01ca21c8.zip | |
Change default error_code ctor to a 'named ctor' so it's more self-documenting.
Unify default construction of error_code uses on this idiom so that users don't
feel compelled to make static globals for naming convenience. (unfortunately I
couldn't make the original ctor private as some APIs don't return their result,
instead using an out parameter (that makes sense to default construct) - which
is a bit of a pity. I did, however, find/fix some cases of unnecessary default
construction of error_code before I hit the unfixable cases)
llvm-svn: 150197
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
| -rw-r--r-- | llvm/lib/Support/MemoryBuffer.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index 1a409720c02..4b15587db7a 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -36,8 +36,6 @@ #include <fcntl.h> using namespace llvm; -namespace { const llvm::error_code success; } - //===----------------------------------------------------------------------===// // MemoryBuffer implementation itself. //===----------------------------------------------------------------------===// @@ -306,7 +304,7 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename, RealMapOffset)) { result.reset(GetNamedBuffer<MemoryBufferMMapFile>( StringRef(Pages + Delta, MapSize), Filename, RequiresNullTerminator)); - return success; + return error_code::success(); } } @@ -344,7 +342,7 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename, } result.swap(SB); - return success; + return error_code::success(); } //===----------------------------------------------------------------------===// @@ -373,5 +371,5 @@ error_code MemoryBuffer::getSTDIN(OwningPtr<MemoryBuffer> &result) { } while (ReadBytes != 0); result.reset(getMemBufferCopy(Buffer, "<stdin>")); - return success; + return error_code::success(); } |

