From 7b6fef82d43a4e121a284ebabf5de94c3485b29a Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Thu, 9 Dec 2010 17:36:48 +0000 Subject: Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients. llvm-svn: 121379 --- llvm/utils/FileCheck/FileCheck.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'llvm/utils/FileCheck/FileCheck.cpp') diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index 9343617..b8c14f0 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/system_error.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" #include @@ -488,12 +489,11 @@ static MemoryBuffer *CanonicalizeInputFile(MemoryBuffer *MB) { static bool ReadCheckFile(SourceMgr &SM, std::vector &CheckStrings) { // Open the check file, and tell SourceMgr about it. - std::string ErrorStr; - MemoryBuffer *F = - MemoryBuffer::getFileOrSTDIN(CheckFilename.c_str(), &ErrorStr); + error_code ec; + MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(CheckFilename.c_str(), ec); if (F == 0) { errs() << "Could not open check file '" << CheckFilename << "': " - << ErrorStr << '\n'; + << ec.message() << '\n'; return true; } @@ -648,12 +648,11 @@ int main(int argc, char **argv) { return 2; // Open the file to check and add it to SourceMgr. - std::string ErrorStr; - MemoryBuffer *F = - MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), &ErrorStr); + error_code ec; + MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), ec); if (F == 0) { errs() << "Could not open input file '" << InputFilename << "': " - << ErrorStr << '\n'; + << ec.message() << '\n'; return true; } -- cgit v1.1