aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/Path.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/Path.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/Path.cpp b/contrib/llvm-project/llvm/lib/Support/Path.cpp
index 63d8d4ee4648..283dc70f2bc9 100644
--- a/contrib/llvm-project/llvm/lib/Support/Path.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/Path.cpp
@@ -22,7 +22,6 @@
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include <cctype>
-#include <cstring>
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
@@ -761,11 +760,15 @@ bool remove_dots(SmallVectorImpl<char> &the_path, bool remove_dot_dot,
}
}
+ SmallString<256> buffer = root;
+ // "root" could be "/", which may need to be translated into "\".
+ make_preferred(buffer, style);
+ needs_change |= root != buffer;
+
// Avoid rewriting the path unless we have to.
if (!needs_change)
return false;
- SmallString<256> buffer = root;
if (!components.empty()) {
buffer += components[0];
for (StringRef C : makeArrayRef(components).drop_front()) {
@@ -1199,9 +1202,18 @@ Error readNativeFileToEOF(file_t FileHandle, SmallVectorImpl<char> &Buffer,
#include "Windows/Path.inc"
#endif
+bool IsLLVMDriver = false;
+
namespace llvm {
namespace sys {
namespace fs {
+
+std::string getMainExecutable(const char *Argv0, void *MainAddr) {
+ if (IsLLVMDriver)
+ return sys::path::stem(Argv0).str();
+ return getMainExecutableImpl(Argv0, MainAddr);
+}
+
TempFile::TempFile(StringRef Name, int FD)
: TmpName(std::string(Name)), FD(FD) {}
TempFile::TempFile(TempFile &&Other) { *this = std::move(Other); }