diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp index 4178d1fd352c3..a3deb907c23ed 100644 --- a/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp @@ -358,9 +358,8 @@ void sanitizeDiagOpts(DiagnosticOptions &DiagOpts) { } } // namespace -namespace clang::tooling::dependencies { std::unique_ptr -createDiagOptions(ArrayRef CommandLine) { +dependencies::createDiagOptions(ArrayRef CommandLine) { std::vector CLI; for (const std::string &Arg : CommandLine) CLI.push_back(Arg.c_str()); @@ -382,9 +381,10 @@ DignosticsEngineWithDiagOpts::DignosticsEngineWithDiagOpts( } std::pair, std::unique_ptr> -buildCompilation(ArrayRef ArgStrs, DiagnosticsEngine &Diags, - IntrusiveRefCntPtr FS, - llvm::BumpPtrAllocator &Alloc) { +dependencies::buildCompilation(ArrayRef ArgStrs, + DiagnosticsEngine &Diags, + IntrusiveRefCntPtr FS, + llvm::BumpPtrAllocator &Alloc) { SmallVector Argv; Argv.reserve(ArgStrs.size()); for (const std::string &Arg : ArgStrs) @@ -417,8 +417,8 @@ buildCompilation(ArrayRef ArgStrs, DiagnosticsEngine &Diags, } std::unique_ptr -createCompilerInvocation(ArrayRef CommandLine, - DiagnosticsEngine &Diags) { +dependencies::createCompilerInvocation(ArrayRef CommandLine, + DiagnosticsEngine &Diags) { llvm::opt::ArgStringList Argv; for (const std::string &Str : ArrayRef(CommandLine).drop_front()) Argv.push_back(Str.c_str()); @@ -432,10 +432,10 @@ createCompilerInvocation(ArrayRef CommandLine, } std::pair, std::vector> -initVFSForTUBuferScanning(IntrusiveRefCntPtr BaseFS, - ArrayRef CommandLine, - StringRef WorkingDirectory, - llvm::MemoryBufferRef TUBuffer) { +dependencies::initVFSForTUBuferScanning( + IntrusiveRefCntPtr BaseFS, + ArrayRef CommandLine, StringRef WorkingDirectory, + llvm::MemoryBufferRef TUBuffer) { // Reset what might have been modified in the previous worker invocation. BaseFS->setCurrentWorkingDirectory(WorkingDirectory); @@ -459,9 +459,10 @@ initVFSForTUBuferScanning(IntrusiveRefCntPtr BaseFS, std::pair, std::vector> -initVFSForByNameScanning(IntrusiveRefCntPtr BaseFS, - ArrayRef CommandLine, - StringRef WorkingDirectory, StringRef ModuleName) { +dependencies::initVFSForByNameScanning( + IntrusiveRefCntPtr BaseFS, + ArrayRef CommandLine, StringRef WorkingDirectory, + StringRef ModuleName) { // Reset what might have been modified in the previous worker invocation. BaseFS->setCurrentWorkingDirectory(WorkingDirectory); @@ -486,7 +487,7 @@ initVFSForByNameScanning(IntrusiveRefCntPtr BaseFS, return std::make_pair(OverlayFS, ModifiedCommandLine); } -bool initializeScanCompilerInstance( +bool dependencies::initializeScanCompilerInstance( CompilerInstance &ScanInstance, IntrusiveRefCntPtr FS, DiagnosticConsumer *DiagConsumer, DependencyScanningService &Service, @@ -559,7 +560,7 @@ bool initializeScanCompilerInstance( } llvm::SmallVector -getInitialStableDirs(const CompilerInstance &ScanInstance) { +dependencies::getInitialStableDirs(const CompilerInstance &ScanInstance) { // Create a collection of stable directories derived from the ScanInstance // for determining whether module dependencies would fully resolve from // those directories. @@ -571,8 +572,8 @@ getInitialStableDirs(const CompilerInstance &ScanInstance) { } std::optional -computePrebuiltModulesASTMap(CompilerInstance &ScanInstance, - llvm::SmallVector &StableDirs) { +dependencies::computePrebuiltModulesASTMap( + CompilerInstance &ScanInstance, llvm::SmallVector &StableDirs) { // Store a mapping of prebuilt module files and their properties like header // search options. This will prevent the implicit build to create duplicate // modules and will force reuse of the existing prebuilt module files @@ -590,7 +591,8 @@ computePrebuiltModulesASTMap(CompilerInstance &ScanInstance, } std::unique_ptr -takeAndUpdateDependencyOutputOptionsFrom(CompilerInstance &ScanInstance) { +dependencies::takeAndUpdateDependencyOutputOptionsFrom( + CompilerInstance &ScanInstance) { // This function moves the existing dependency output options from the // invocation to the collector. The options in the invocation are reset, // which ensures that the compiler won't create new dependency collectors, @@ -607,7 +609,8 @@ takeAndUpdateDependencyOutputOptionsFrom(CompilerInstance &ScanInstance) { return Opts; } -std::shared_ptr initializeScanInstanceDependencyCollector( +std::shared_ptr +dependencies::initializeScanInstanceDependencyCollector( CompilerInstance &ScanInstance, std::unique_ptr DepOutputOpts, StringRef WorkingDirectory, DependencyConsumer &Consumer, @@ -633,7 +636,6 @@ std::shared_ptr initializeScanInstanceDependencyCollector( return MDC; } -} // namespace clang::tooling::dependencies bool DependencyScanningAction::runInvocation( std::unique_ptr Invocation,