aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2022-09-09 16:42:00 +0700
committerSerge Pavlov <sepavloff@gmail.com>2022-09-09 16:43:15 +0700
commit55e1441f7b5d01a37fc46eb1711f03ee69845316 (patch)
treeb7191256e1c9b9adb6f2b9daf97555de28c78675 /llvm/lib/Support/CommandLine.cpp
parent9b4c3c2c5ba8ad85385efd41c3d4623de34a7817 (diff)
downloadllvm-55e1441f7b5d01a37fc46eb1711f03ee69845316.zip
llvm-55e1441f7b5d01a37fc46eb1711f03ee69845316.tar.gz
llvm-55e1441f7b5d01a37fc46eb1711f03ee69845316.tar.bz2
Revert "[Clang] Use virtual FS in processing config files"
This reverts commit 9424497e43aff088e014d65fd952ec557e28e6cf. Some buildbots failed, reverted for investigation.
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp31
1 files changed, 11 insertions, 20 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index d81e115..b8375f6 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1264,17 +1264,10 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
// always have an absolute path deduced from the containing file.
SmallString<128> CurrDir;
if (llvm::sys::path::is_relative(FName)) {
- if (!CurrentDir) {
- if (auto CWD = FS.getCurrentWorkingDirectory()) {
- CurrDir = *CWD;
- } else {
- // TODO: The error should be propagated up the stack.
- llvm::consumeError(llvm::errorCodeToError(CWD.getError()));
- return false;
- }
- } else {
+ if (!CurrentDir)
+ llvm::sys::fs::current_path(CurrDir);
+ else
CurrDir = *CurrentDir;
- }
llvm::sys::path::append(CurrDir, FName);
FName = CurrDir.c_str();
}
@@ -1364,26 +1357,24 @@ bool cl::expandResponseFiles(int Argc, const char *const *Argv,
}
bool cl::readConfigFile(StringRef CfgFile, StringSaver &Saver,
- SmallVectorImpl<const char *> &Argv,
- llvm::vfs::FileSystem &FS) {
+ SmallVectorImpl<const char *> &Argv) {
SmallString<128> AbsPath;
if (sys::path::is_relative(CfgFile)) {
- AbsPath.assign(CfgFile);
- if (std::error_code EC = FS.makeAbsolute(AbsPath))
- return false;
+ llvm::sys::fs::current_path(AbsPath);
+ llvm::sys::path::append(AbsPath, CfgFile);
CfgFile = AbsPath.str();
}
- if (llvm::Error Err =
- ExpandResponseFile(CfgFile, Saver, cl::tokenizeConfigFile, Argv,
- /*MarkEOLs=*/false, /*RelativeNames=*/true,
- /*ExpandBasePath=*/true, FS)) {
+ if (llvm::Error Err = ExpandResponseFile(
+ CfgFile, Saver, cl::tokenizeConfigFile, Argv,
+ /*MarkEOLs=*/false, /*RelativeNames=*/true, /*ExpandBasePath=*/true,
+ *llvm::vfs::getRealFileSystem())) {
// TODO: The error should be propagated up the stack.
llvm::consumeError(std::move(Err));
return false;
}
return ExpandResponseFiles(Saver, cl::tokenizeConfigFile, Argv,
/*MarkEOLs=*/false, /*RelativeNames=*/true,
- /*ExpandBasePath=*/true, llvm::None, FS);
+ /*ExpandBasePath=*/true, llvm::None);
}
static void initCommonOptions();