summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-04-24 14:41:24 -0700
committerStephen Hines <srhines@google.com>2014-04-24 15:22:31 -0700
commit551ae4ebd3e9d137ea668fb83ae4a55b8cfba451 (patch)
treec4ea60679a6fe2630e21bf6d46177b2c4fcab33b /lib/Support
parent334c6f83c1265eabd58ac7c8b860898038831eab (diff)
downloadmclinker-551ae4ebd3e9d137ea668fb83ae4a55b8cfba451.tar.gz
Update MCLinker for LLVM 3.5.
Change-Id: Ib07513d0eb2f8b7d3516a7dd8823f98820943cc9
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/FileSystem.cpp10
-rw-r--r--lib/Support/MemoryArea.cpp11
-rw-r--r--lib/Support/SystemUtils.cpp2
-rw-r--r--lib/Support/ToolOutputFile.cpp2
4 files changed, 15 insertions, 10 deletions
diff --git a/lib/Support/FileSystem.cpp b/lib/Support/FileSystem.cpp
index 331297f..aaed86b 100644
--- a/lib/Support/FileSystem.cpp
+++ b/lib/Support/FileSystem.cpp
@@ -28,12 +28,12 @@ bool mcld::sys::fs::is_directory(const Path &pPath)
return (file_status.type() == mcld::sys::fs::DirectoryFile);
}
-// Include the truly platform-specific parts.
+// Include the truly platform-specific parts.
#if defined(MCLD_ON_UNIX)
#include "Unix/FileSystem.inc"
-#include "Unix/PathV3.inc"
-#endif
+#include "Unix/PathV3.inc"
+#endif
#if defined(MCLD_ON_WIN32)
#include "Windows/FileSystem.inc"
-#include "Windows/PathV3.inc"
-#endif
+#include "Windows/PathV3.inc"
+#endif
diff --git a/lib/Support/MemoryArea.cpp b/lib/Support/MemoryArea.cpp
index 862e6f1..0c7f3c1 100644
--- a/lib/Support/MemoryArea.cpp
+++ b/lib/Support/MemoryArea.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include <mcld/Support/MemoryArea.h>
+#include <mcld/Support/MsgHandling.h>
#include <llvm/Support/system_error.h>
#include <cassert>
@@ -18,10 +19,12 @@ using namespace mcld;
//===--------------------------------------------------------------------===//
MemoryArea::MemoryArea(llvm::StringRef pFilename)
{
- llvm::MemoryBuffer::getFile(pFilename,
- m_pMemoryBuffer,
- /*FileSize*/ -1,
- /*RequiresNullTerminator*/ false);
+ llvm::error_code ec =
+ llvm::MemoryBuffer::getFile(pFilename, m_pMemoryBuffer, /*FileSize*/ -1,
+ /*RequiresNullTerminator*/ false);
+ if (ec != llvm::errc::success) {
+ fatal(diag::fatal_cannot_read_input) << pFilename.str();
+ }
}
MemoryArea::MemoryArea(const char* pMemBuffer, size_t pSize)
diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp
index 19c5e90..b261db8 100644
--- a/lib/Support/SystemUtils.cpp
+++ b/lib/Support/SystemUtils.cpp
@@ -18,4 +18,4 @@ using namespace mcld::sys;
#endif
#if defined(MCLD_ON_WIN32)
#include "Windows/System.inc"
-#endif
+#endif
diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp
index 1223d93..a1c94f4 100644
--- a/lib/Support/ToolOutputFile.cpp
+++ b/lib/Support/ToolOutputFile.cpp
@@ -69,6 +69,8 @@ ToolOutputFile::ToolOutputFile(const sys::fs::Path& pPath,
ToolOutputFile::~ToolOutputFile()
{
+ if (m_pFormattedOstream != NULL)
+ delete m_pFormattedOstream;
if (m_pFdOstream != NULL)
delete m_pFdOstream;
}