mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[Support] Don't include VirtualFileSystem.h in CommandLine.h
CommandLine.h is indirectly included in ~50% of TUs when building clang, and VirtualFileSystem.h is large. (Already remarked by jhenderson on D70769.) No behavior change. Differential Revision: https://reviews.llvm.org/D100957
This commit is contained in:
parent
2f6d5a3c21
commit
25b1225bca
@ -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 <cassert>
|
||||
#include <climits>
|
||||
@ -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 @@ bool readConfigFile(StringRef CfgFileName, StringSaver &Saver,
|
||||
/// \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<const char *> &Argv, bool MarkEOLs,
|
||||
bool RelativeNames,
|
||||
llvm::Optional<llvm::StringRef> CurrentDir,
|
||||
llvm::vfs::FileSystem &FS);
|
||||
|
||||
/// An overload of ExpandResponseFiles() that uses
|
||||
/// llvm::vfs::getRealFileSystem().
|
||||
bool ExpandResponseFiles(
|
||||
StringSaver &Saver, TokenizerCallback Tokenizer,
|
||||
SmallVectorImpl<const char *> &Argv, bool MarkEOLs = false,
|
||||
bool RelativeNames = false,
|
||||
llvm::vfs::FileSystem &FS = *llvm::vfs::getRealFileSystem(),
|
||||
llvm::Optional<llvm::StringRef> CurrentDir = llvm::None);
|
||||
|
||||
/// A convenience helper which concatenates the options specified by the
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#define DEBUG_TYPE "cseinfo"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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 <vector>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1138,8 +1138,9 @@ static llvm::Error ExpandResponseFile(
|
||||
/// StringSaver and tokenization strategy.
|
||||
bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
|
||||
SmallVectorImpl<const char *> &Argv, bool MarkEOLs,
|
||||
bool RelativeNames, llvm::vfs::FileSystem &FS,
|
||||
llvm::Optional<llvm::StringRef> CurrentDir) {
|
||||
bool RelativeNames,
|
||||
llvm::Optional<llvm::StringRef> CurrentDir,
|
||||
llvm::vfs::FileSystem &FS) {
|
||||
bool AllExpanded = true;
|
||||
struct ResponseFileRecord {
|
||||
std::string File;
|
||||
@ -1247,6 +1248,15 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
|
||||
return AllExpanded;
|
||||
}
|
||||
|
||||
bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
|
||||
SmallVectorImpl<const char *> &Argv, bool MarkEOLs,
|
||||
bool RelativeNames,
|
||||
llvm::Optional<StringRef> 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<const char *> &NewArgv) {
|
||||
@ -1273,14 +1283,14 @@ bool cl::readConfigFile(StringRef CfgFile, StringSaver &Saver,
|
||||
}
|
||||
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,
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "llvm/Support/WithColor.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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 <functional>
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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 <map>
|
||||
|
@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "PerfReader.h"
|
||||
#include "ProfileGenerator.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
|
||||
static cl::opt<bool> ShowMmapEvents("show-mmap-events", cl::ReallyHidden,
|
||||
cl::init(false), cl::ZeroOrMore,
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -827,8 +827,8 @@ TEST(CommandLineTest, ResponseFiles) {
|
||||
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",
|
||||
@ -889,9 +889,9 @@ TEST(CommandLineTest, RecursiveResponseFiles) {
|
||||
#else
|
||||
cl::TokenizerCallback Tokenizer = cl::TokenizeGNUCommandLine;
|
||||
#endif
|
||||
ASSERT_FALSE(
|
||||
cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, FS,
|
||||
/*CurrentDir=*/llvm::StringRef(TestRoot)));
|
||||
ASSERT_FALSE(cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false,
|
||||
/*CurrentDir=*/llvm::StringRef(TestRoot),
|
||||
FS));
|
||||
|
||||
EXPECT_THAT(Argv,
|
||||
testing::Pointwise(StringEquality(),
|
||||
@ -929,8 +929,8 @@ TEST(CommandLineTest, ResponseFilesAtArguments) {
|
||||
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 @@ TEST(CommandLineTest, ResponseFileRelativePath) {
|
||||
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 @@ TEST(CommandLineTest, ResponseFileEOLs) {
|
||||
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());
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user