Merge "Update MCLinker to build against klp llvm"
diff --git a/include/mcld/Support/ToolOutputFile.h b/include/mcld/Support/ToolOutputFile.h
index d292368..4dfc4e6 100644
--- a/include/mcld/Support/ToolOutputFile.h
+++ b/include/mcld/Support/ToolOutputFile.h
@@ -36,7 +36,7 @@
class ToolOutputFile
{
public:
- ToolOutputFile(const sys::fs::Path& pPath,
+ ToolOutputFile(const std::string& pPath,
FileHandle::OpenMode pMode,
FileHandle::Permission pPermission);
@@ -59,7 +59,7 @@
class CleanupInstaller
{
public:
- explicit CleanupInstaller(const sys::fs::Path& pPath);
+ explicit CleanupInstaller(const std::string& pPath);
~CleanupInstaller();
@@ -67,7 +67,7 @@
bool Keep;
private:
- sys::fs::Path m_Path;
+ std::string m_Path;
};
private:
diff --git a/include/mcld/Support/raw_ostream.h b/include/mcld/Support/raw_ostream.h
index 9b52578..0e2cc40 100644
--- a/include/mcld/Support/raw_ostream.h
+++ b/include/mcld/Support/raw_ostream.h
@@ -31,7 +31,7 @@
/// output errors).
raw_fd_ostream(const char *pFilename,
std::string &pErrorInfo,
- unsigned int pFlags = 0);
+ llvm::sys::fs::OpenFlags pFlags = llvm::sys::fs::F_None);
/// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If
/// ShouldClose is true, this closes the file when the stream is destroyed.
diff --git a/lib/CodeGen/MCLDTargetMachine.cpp b/lib/CodeGen/MCLDTargetMachine.cpp
index 143ac02..a695f29 100644
--- a/lib/CodeGen/MCLDTargetMachine.cpp
+++ b/lib/CodeGen/MCLDTargetMachine.cpp
@@ -120,15 +120,15 @@
// removed from the parent invoke(s). This could happen when a landing
// pad is shared by multiple invokes and is also a target of a normal
// edge from elsewhere.
- PM.add(createSjLjEHPreparePass(TM->getTargetLowering()));
+ PM.add(createSjLjEHPreparePass(TM));
// FALLTHROUGH
case llvm::ExceptionHandling::DwarfCFI:
case llvm::ExceptionHandling::ARM:
case llvm::ExceptionHandling::Win64:
- PM.add(createDwarfEHPass(TM->getTargetLowering()));
+ PM.add(createDwarfEHPass(TM));
break;
case llvm::ExceptionHandling::None:
- PM.add(createLowerInvokePass(TM->getTargetLowering()));
+ PM.add(createLowerInvokePass(TM));
// The lower invoke pass may create unreachable code. Remove it.
PM.add(createUnreachableBlockEliminationPass());
@@ -283,7 +283,7 @@
MCInstPrinter *InstPrinter =
getTarget().get()->createMCInstPrinter(MAI.getAssemblerDialect(), MAI,
MII,
- Context->getRegisterInfo(), STI);
+ *Context->getRegisterInfo(), STI);
MCCodeEmitter* MCE = 0;
MCAsmBackend *MAB = 0;
diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp
index 0d6fac2..0554398 100644
--- a/lib/Support/ToolOutputFile.cpp
+++ b/lib/Support/ToolOutputFile.cpp
@@ -17,7 +17,6 @@
#include <mcld/Support/MsgHandling.h>
#include <llvm/Support/Signals.h>
-#include <llvm/Support/Path.h>
#include <llvm/Support/FormattedStream.h>
using namespace mcld;
@@ -25,31 +24,31 @@
//===----------------------------------------------------------------------===//
// CleanupInstaller
//===----------------------------------------------------------------------===//
-ToolOutputFile::CleanupInstaller::CleanupInstaller(const sys::fs::Path& pPath)
+ToolOutputFile::CleanupInstaller::CleanupInstaller(const std::string& pPath)
: Keep(false), m_Path(pPath) {
// Arrange for the file to be deleted if the process is killed.
- if ("-" != m_Path.native())
- llvm::sys::RemoveFileOnSignal(llvm::sys::Path(m_Path.native()));
+ if ("-" != m_Path)
+ llvm::sys::RemoveFileOnSignal(m_Path);
}
ToolOutputFile::CleanupInstaller::~CleanupInstaller()
{
// Delete the file if the client hasn't told us not to.
// FIXME: In Windows, some path in CJK characters can not be removed by LLVM
- // llvm::sys::Path
- if (!Keep && "_" != m_Path.native())
- llvm::sys::Path(m_Path.native()).eraseFromDisk();
+ // sys::fs::remove
+ if (!Keep && "_" != m_Path)
+ llvm::sys::fs::remove(m_Path);
// Ok, the file is successfully written and closed, or deleted. There's no
// further need to clean it up on signals.
- if ("_" != m_Path.native())
- llvm::sys::DontRemoveFileOnSignal(llvm::sys::Path(m_Path.native()));
+ if ("_" != m_Path)
+ llvm::sys::DontRemoveFileOnSignal(m_Path);
}
//===----------------------------------------------------------------------===//
// ToolOutputFile
//===----------------------------------------------------------------------===//
-ToolOutputFile::ToolOutputFile(const sys::fs::Path& pPath,
+ToolOutputFile::ToolOutputFile(const std::string& pPath,
FileHandle::OpenMode pMode,
FileHandle::Permission pPermission)
: m_Installer(pPath),
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 57ba2f3..32e362a 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -37,7 +37,7 @@
//===----------------------------------------------------------------------===//
mcld::raw_fd_ostream::raw_fd_ostream(const char *pFilename,
std::string &pErrorInfo,
- unsigned int pFlags)
+ llvm::sys::fs::OpenFlags pFlags)
: llvm::raw_fd_ostream(pFilename, pErrorInfo, pFlags),
m_bConfigColor(false),
m_bSetColor(false) {