summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/SourceMgr.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-09 17:36:48 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-09 17:36:48 +0000
commit7b6fef82d43a4e121a284ebabf5de94c3485b29a (patch)
tree09a49a4bb8f4c8c8b5a13d4d328b82f442a26969 /llvm/lib/Support/SourceMgr.cpp
parentf25faaaffbd9c6d3ffeccb333d0338e5bcb796b1 (diff)
downloadbcm5719-llvm-7b6fef82d43a4e121a284ebabf5de94c3485b29a.tar.gz
bcm5719-llvm-7b6fef82d43a4e121a284ebabf5de94c3485b29a.zip
Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
llvm-svn: 121379
Diffstat (limited to 'llvm/lib/Support/SourceMgr.cpp')
-rw-r--r--llvm/lib/Support/SourceMgr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp
index 0dc1331d260..f53169a8cfc 100644
--- a/llvm/lib/Support/SourceMgr.cpp
+++ b/llvm/lib/Support/SourceMgr.cpp
@@ -17,6 +17,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/system_error.h"
using namespace llvm;
namespace {
@@ -48,13 +49,13 @@ SourceMgr::~SourceMgr() {
/// ~0, otherwise it returns the buffer ID of the stacked file.
unsigned SourceMgr::AddIncludeFile(const std::string &Filename,
SMLoc IncludeLoc) {
-
- MemoryBuffer *NewBuf = MemoryBuffer::getFile(Filename.c_str());
+ error_code ec;
+ MemoryBuffer *NewBuf = MemoryBuffer::getFile(Filename.c_str(), ec);
// If the file didn't exist directly, see if it's in an include path.
for (unsigned i = 0, e = IncludeDirectories.size(); i != e && !NewBuf; ++i) {
std::string IncFile = IncludeDirectories[i] + "/" + Filename;
- NewBuf = MemoryBuffer::getFile(IncFile.c_str());
+ NewBuf = MemoryBuffer::getFile(IncFile.c_str(), ec);
}
if (NewBuf == 0) return ~0U;
OpenPOWER on IntegriCloud