diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 20:26:58 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 20:26:58 +0000 |
commit | 76858a7abd4faeb462e04f177666b87b23b65287 (patch) | |
tree | cb6b21d86d87da6f8f3daf8633f12d367720ef2f /lib | |
parent | 89dbe9744255864445b1c9f9a613ae333d3f79c8 (diff) | |
download | external_llvm-76858a7abd4faeb462e04f177666b87b23b65287.zip external_llvm-76858a7abd4faeb462e04f177666b87b23b65287.tar.gz external_llvm-76858a7abd4faeb462e04f177666b87b23b65287.tar.bz2 |
Replace use of PathV1.h in MCContext.cpp.
GetCurrentDirectory is now unused. Remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCContext.cpp | 6 | ||||
-rw-r--r-- | lib/Support/Unix/Path.inc | 11 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 10 |
3 files changed, 4 insertions, 23 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index b56017d..b997786 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -21,8 +21,8 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/Support/ELF.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/PathV1.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" using namespace llvm; @@ -38,11 +38,13 @@ MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri, SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Allocator(), Symbols(Allocator), UsedNames(Allocator), NextUniqueID(0), - CompilationDir(llvm::sys::Path::GetCurrentDirectory().str()), CurrentDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0), DwarfLocSeen(false), GenDwarfForAssembly(false), GenDwarfFileNumber(0), AllowTemporaryLabels(true), DwarfCompileUnitID(0), AutoReset(DoAutoReset) { + error_code EC = llvm::sys::fs::current_path(CompilationDir); + assert(!EC && "Could not determine the current directory"); + MachOUniquingMap = 0; ELFUniquingMap = 0; COFFUniquingMap = 0; diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index 57f02be..06b18be 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -185,17 +185,6 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) { #endif } -Path -Path::GetCurrentDirectory() { - char pathname[MAXPATHLEN]; - if (!getcwd(pathname, MAXPATHLEN)) { - assert(false && "Could not query current working directory."); - return Path(); - } - - return Path(pathname); -} - #if defined(__FreeBSD__) || defined (__NetBSD__) || defined(__Bitrig__) || \ defined(__OpenBSD__) || defined(__minix) || defined(__FreeBSD_kernel__) || \ defined(__linux__) || defined(__CYGWIN__) diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 4a6e563..bb1f77a 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -20,9 +20,6 @@ #include <cstdio> #include <malloc.h> -// We need to undo a macro defined in Windows.h, otherwise we won't compile: -#undef GetCurrentDirectory - // Windows happily accepts either forward or backward slashes, though any path // returned by a Win32 API will have backward slashes. As LLVM code basically // assumes forward slashes are used, backward slashs are converted where they @@ -199,13 +196,6 @@ Path::GetTemporaryDirectory(std::string* ErrMsg) { return *TempDirectory; } -Path -Path::GetCurrentDirectory() { - char pathname[MAX_PATH]; - ::GetCurrentDirectoryA(MAX_PATH,pathname); - return Path(pathname); -} - /// GetMainExecutable - Return the path to the main executable, given the /// value of argv[0] from program startup. Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { |