aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/TableGen.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 03:29:14 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-16 03:29:14 +0000
commit3ff9563c3e391954b2e224afcf8b2b0fcc3888aa (patch)
treecccde9111a73ba5895f6cefbfb280290fa6c469d /utils/TableGen/TableGen.cpp
parentb29b20e7deb7297f6a10b2d6922feeca8c6df055 (diff)
MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/TableGen.cpp')
-rw-r--r--utils/TableGen/TableGen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index f206d2b03e..61a81416e4 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -37,6 +37,7 @@
#include "ARMDecoderEmitter.h"
#include "SubtargetEmitter.h"
#include "TGParser.h"
+#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
@@ -190,13 +191,13 @@ static bool ParseFile(const std::string &Filename,
const std::vector<std::string> &IncludeDirs,
SourceMgr &SrcMgr,
RecordKeeper &Records) {
- error_code ec;
- MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), ec);
- if (F == 0) {
+ OwningPtr<MemoryBuffer> File;
+ if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), File)) {
errs() << "Could not open input file '" << Filename << "': "
<< ec.message() <<"\n";
return true;
}
+ MemoryBuffer *F = File.take();
// Tell SrcMgr about this buffer, which is what TGParser will pick up.
SrcMgr.AddNewSourceBuffer(F, SMLoc());