diff options
author | Pavel Labath <labath@google.com> | 2017-01-23 15:56:45 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-01-23 15:56:45 +0000 |
commit | 1d5855b1078569ba49682010fc9be5ec32fef5ea (patch) | |
tree | c289a6559b748db3ae617b7a3a1db5efac8c6acf /lldb/source/Target/Platform.cpp | |
parent | 1f46b70b5dec51858074248da4af3fbc38198a13 (diff) | |
download | bcm5719-llvm-1d5855b1078569ba49682010fc9be5ec32fef5ea.tar.gz bcm5719-llvm-1d5855b1078569ba49682010fc9be5ec32fef5ea.zip |
Replace getcwd with the llvm equivalent
Summary:
getcwd() is not available (well.. um.. deprecated?) on windows, and the way
PosixApi.h is providing it causes strange compile errors when it's included in
the wrong order. The best way to avoid that is to just not use chdir.
This replaces all uses of getcwd in generic code. There are still a couple of
more uses, but these are in platform-specific code.
chdir() is causing a similar problem, but for that there is no llvm equivalent
for that (yet).
Reviewers: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D28858
llvm-svn: 292795
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r-- | lldb/source/Target/Platform.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index d8db53663f1..4f285e09807 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -523,11 +523,11 @@ void Platform::AddClangModuleCompilationOptions( FileSpec Platform::GetWorkingDirectory() { if (IsHost()) { - char cwd[PATH_MAX]; - if (getcwd(cwd, sizeof(cwd))) - return FileSpec{cwd, true}; - else + llvm::SmallString<64> cwd; + if (llvm::sys::fs::current_path(cwd)) return FileSpec{}; + else + return FileSpec(cwd, true); } else { if (!m_working_dir) m_working_dir = GetRemoteWorkingDirectory(); |