diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-09 17:36:48 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-09 17:36:48 +0000 |
commit | 333fb04506233255f10d8095c9e2de5e5f0fdc6f (patch) | |
tree | 29b15348801de3482b07a438b1fb1f2ba094d3d2 /lib/Support/SourceMgr.cpp | |
parent | 908b6ddad6dac40c4c0453d690f0db9422b48b10 (diff) |
Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/SourceMgr.cpp')
-rw-r--r-- | lib/Support/SourceMgr.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp index 0dc1331d26..f53169a8cf 100644 --- a/lib/Support/SourceMgr.cpp +++ b/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; |