Index: clang/include/clang/Frontend/FrontendOptions.h =================================================================== --- clang/include/clang/Frontend/FrontendOptions.h +++ clang/include/clang/Frontend/FrontendOptions.h @@ -15,6 +15,7 @@ #include "clang/Sema/CodeCompleteOptions.h" #include "clang/Serialization/ModuleFileExtension.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/MemoryBuffer.h" #include #include #include Index: clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp =================================================================== --- clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp +++ clang/lib/Tooling/ExpandResponseFilesCompilationDatabase.cpp @@ -60,8 +60,8 @@ continue; llvm::BumpPtrAllocator Alloc; llvm::StringSaver Saver(Alloc); - llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, *FS, - llvm::StringRef(Cmd.Directory)); + llvm::cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, + llvm::StringRef(Cmd.Directory), *FS); // Don't assign directly, Argv aliases CommandLine. std::vector ExpandedArgv(Argv.begin(), Argv.end()); Cmd.CommandLine = std::move(ExpandedArgv); Index: clang/tools/apinotes-test/APINotesTest.cpp =================================================================== --- clang/tools/apinotes-test/APINotesTest.cpp +++ clang/tools/apinotes-test/APINotesTest.cpp @@ -8,6 +8,8 @@ #include "clang/APINotes/APINotesYAMLCompiler.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/WithColor.h" Index: clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp =================================================================== --- clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp +++ clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp @@ -27,6 +27,7 @@ #include "llvm/Support/Errc.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" #include "llvm/Support/ToolOutputFile.h" Index: llvm/include/llvm/Support/CommandLine.h =================================================================== --- llvm/include/llvm/Support/CommandLine.h +++ llvm/include/llvm/Support/CommandLine.h @@ -31,7 +31,6 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -44,6 +43,10 @@ namespace llvm { +namespace vfs { +class FileSystem; +} + class StringSaver; /// cl Namespace - This namespace contains all of the command line option @@ -2091,11 +2094,18 @@ /// \param [in] CurrentDir Path used to resolve relative rsp files. If set to /// None, process' cwd is used instead. /// \return true if all @files were expanded successfully or there were none. +bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, + SmallVectorImpl &Argv, bool MarkEOLs, + bool RelativeNames, + llvm::Optional CurrentDir, + llvm::vfs::FileSystem &FS); + +/// An overload of ExpandResponseFiles() that uses +/// llvm::vfs::getRealFileSystem(). bool ExpandResponseFiles( StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl &Argv, bool MarkEOLs = false, bool RelativeNames = false, - llvm::vfs::FileSystem &FS = *llvm::vfs::getRealFileSystem(), llvm::Optional CurrentDir = llvm::None); /// A convenience helper which concatenates the options specified by the Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp =================================================================== --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -50,6 +50,7 @@ #include "llvm/Pass.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include #include #include Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -110,6 +110,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Path.h" Index: llvm/lib/CodeGen/CommandFlags.cpp =================================================================== --- llvm/lib/CodeGen/CommandFlags.cpp +++ llvm/lib/CodeGen/CommandFlags.cpp @@ -17,6 +17,7 @@ #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Host.h" +#include "llvm/Support/MemoryBuffer.h" using namespace llvm; Index: llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp +++ llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp @@ -10,6 +10,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/GlobalISel/CSEInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Support/Error.h" #include "llvm/InitializePasses.h" #define DEBUG_TYPE "cseinfo" Index: llvm/lib/LTO/LTO.cpp =================================================================== --- llvm/lib/LTO/LTO.cpp +++ llvm/lib/LTO/LTO.cpp @@ -35,6 +35,7 @@ #include "llvm/Object/IRObjectFile.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" Index: llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp =================================================================== --- llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -20,10 +20,10 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/Object/Binary.h" +#include "llvm/Object/COFF.h" #include "llvm/Object/Error.h" #include "llvm/Object/MachOUniversal.h" #include "llvm/Object/ObjectFile.h" -#include "llvm/Object/COFF.h" #include "llvm/ProfileData/InstrProf.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compression.h" @@ -33,6 +33,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" #include Index: llvm/lib/Remarks/YAMLRemarkSerializer.cpp =================================================================== --- llvm/lib/Remarks/YAMLRemarkSerializer.cpp +++ llvm/lib/Remarks/YAMLRemarkSerializer.cpp @@ -13,6 +13,7 @@ #include "llvm/Remarks/YAMLRemarkSerializer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" using namespace llvm; using namespace llvm::remarks; Index: llvm/lib/Support/CommandLine.cpp =================================================================== --- llvm/lib/Support/CommandLine.cpp +++ llvm/lib/Support/CommandLine.cpp @@ -1138,8 +1138,9 @@ /// StringSaver and tokenization strategy. bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl &Argv, bool MarkEOLs, - bool RelativeNames, llvm::vfs::FileSystem &FS, - llvm::Optional CurrentDir) { + bool RelativeNames, + llvm::Optional CurrentDir, + llvm::vfs::FileSystem &FS) { bool AllExpanded = true; struct ResponseFileRecord { std::string File; @@ -1247,6 +1248,15 @@ return AllExpanded; } +bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, + SmallVectorImpl &Argv, bool MarkEOLs, + bool RelativeNames, + llvm::Optional CurrentDir) { + return ExpandResponseFiles(Saver, std::move(Tokenizer), Argv, MarkEOLs, + RelativeNames, std::move(CurrentDir), + *vfs::getRealFileSystem()); +} + bool cl::expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, StringSaver &Saver, SmallVectorImpl &NewArgv) { @@ -1273,14 +1283,14 @@ } if (llvm::Error Err = ExpandResponseFile(CfgFile, Saver, cl::tokenizeConfigFile, Argv, - /*MarkEOLs*/ false, /*RelativeNames*/ true, + /*MarkEOLs=*/false, /*RelativeNames=*/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); + /*MarkEOLs=*/false, /*RelativeNames=*/true); } bool cl::ParseCommandLineOptions(int argc, const char *const *argv, Index: llvm/lib/Support/WithColor.cpp =================================================================== --- llvm/lib/Support/WithColor.cpp +++ llvm/lib/Support/WithColor.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/WithColor.h" +#include "llvm/Support/Error.h" #include "llvm/Support/CommandLine.h" using namespace llvm; Index: llvm/lib/Transforms/Utils/Debugify.cpp =================================================================== --- llvm/lib/Transforms/Utils/Debugify.cpp +++ llvm/lib/Transforms/Utils/Debugify.cpp @@ -25,6 +25,7 @@ #include "llvm/IR/PassInstrumentation.h" #include "llvm/Pass.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/JSON.h" #define DEBUG_TYPE "debugify" Index: llvm/tools/llvm-cov/TestingSupport.cpp =================================================================== --- llvm/tools/llvm-cov/TestingSupport.cpp +++ llvm/tools/llvm-cov/TestingSupport.cpp @@ -10,6 +10,7 @@ #include "llvm/ProfileData/InstrProf.h" #include "llvm/Support/Alignment.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/LEB128.h" #include "llvm/Support/raw_ostream.h" #include Index: llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp =================================================================== --- llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp +++ llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp @@ -11,10 +11,11 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/LineIterator.h" #include "llvm/Support/MemoryBuffer.h" Index: llvm/tools/llvm-exegesis/llvm-exegesis.cpp =================================================================== --- llvm/tools/llvm-exegesis/llvm-exegesis.cpp +++ llvm/tools/llvm-exegesis/llvm-exegesis.cpp @@ -32,6 +32,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/Path.h" #include "llvm/Support/SourceMgr.h" Index: llvm/tools/llvm-jitlink/llvm-jitlink.cpp =================================================================== --- llvm/tools/llvm-jitlink/llvm-jitlink.cpp +++ llvm/tools/llvm-jitlink/llvm-jitlink.cpp @@ -37,6 +37,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" Index: llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp =================================================================== --- llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -21,6 +21,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/LineIterator.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/WithColor.h" #include "llvm/TextAPI/Architecture.h" #include Index: llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp =================================================================== --- llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -27,6 +27,7 @@ #include "llvm/Object/SymbolSize.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/DynamicLibrary.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/MSVCErrorWorkarounds.h" #include "llvm/Support/Memory.h" Index: llvm/tools/split-file/split-file.cpp =================================================================== --- llvm/tools/split-file/split-file.cpp +++ llvm/tools/split-file/split-file.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileOutputBuffer.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/LineIterator.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" Index: llvm/unittests/Support/CommandLineTest.cpp =================================================================== --- llvm/unittests/Support/CommandLineTest.cpp +++ llvm/unittests/Support/CommandLineTest.cpp @@ -827,8 +827,8 @@ llvm::BumpPtrAllocator A; llvm::StringSaver Saver(A); ASSERT_TRUE(llvm::cl::ExpandResponseFiles( - Saver, llvm::cl::TokenizeGNUCommandLine, Argv, false, true, FS, - /*CurrentDir=*/StringRef(TestRoot))); + Saver, llvm::cl::TokenizeGNUCommandLine, Argv, false, true, + /*CurrentDir=*/StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise( StringEquality(), {"test/test", "-flag_1", "-option_1", "-option_2", @@ -890,8 +890,8 @@ cl::TokenizerCallback Tokenizer = cl::TokenizeGNUCommandLine; #endif ASSERT_FALSE( - cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, FS, - /*CurrentDir=*/llvm::StringRef(TestRoot))); + cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, + /*CurrentDir=*/llvm::StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise(StringEquality(), @@ -929,8 +929,8 @@ BumpPtrAllocator A; StringSaver Saver(A); ASSERT_FALSE(cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Argv, - false, false, FS, - /*CurrentDir=*/StringRef(TestRoot))); + false, false, + /*CurrentDir=*/StringRef(TestRoot), FS)); // ASSERT instead of EXPECT to prevent potential out-of-bounds access. ASSERT_EQ(Argv.size(), 1 + NON_RSP_AT_ARGS + 2); @@ -964,8 +964,8 @@ BumpPtrAllocator A; StringSaver Saver(A); ASSERT_TRUE(cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Argv, - false, true, FS, - /*CurrentDir=*/StringRef(TestRoot))); + false, true, + /*CurrentDir=*/StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise(StringEquality(), {"test/test", "-flag"})); } @@ -984,8 +984,8 @@ BumpPtrAllocator A; StringSaver Saver(A); ASSERT_TRUE(cl::ExpandResponseFiles(Saver, cl::TokenizeWindowsCommandLine, - Argv, true, true, FS, - /*CurrentDir=*/StringRef(TestRoot))); + Argv, true, true, + /*CurrentDir=*/StringRef(TestRoot), FS)); const char *Expected[] = {"clang", "-Xclang", "-Wno-whatever", nullptr, "input.cpp"}; ASSERT_EQ(array_lengthof(Expected), Argv.size()); Index: llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp =================================================================== --- llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp +++ llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp @@ -22,6 +22,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/PatternMatch.h" #include "llvm/IR/Verifier.h" +#include "llvm/Support/SourceMgr.h" #include "gtest/gtest.h" namespace llvm { Index: llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp =================================================================== --- llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp +++ llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp @@ -10,6 +10,7 @@ #include "X86InstrInfo.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" Index: llvm/utils/TableGen/GICombinerEmitter.cpp =================================================================== --- llvm/utils/TableGen/GICombinerEmitter.cpp +++ llvm/utils/TableGen/GICombinerEmitter.cpp @@ -15,6 +15,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/Timer.h" #include "llvm/TableGen/Error.h"