From 58604cd944eec4a75046076cb53eb708aaf2ee09 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 9 Feb 2012 19:24:12 +0000 Subject: 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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150197 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/MemoryBuffer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/Support/MemoryBuffer.cpp') diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 1a409720c0..4b15587db7 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -36,8 +36,6 @@ #include 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( 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 &result) { } while (ReadBytes != 0); result.reset(getMemBufferCopy(Buffer, "")); - return success; + return error_code::success(); } -- cgit v1.2.3-70-g09d2