clang 24.0.0git
DependencyScanningWorker.cpp File Reference
#include "clang/DependencyScanning/DependencyScanningWorker.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "clang/Basic/DiagnosticSerialization.h"
#include "clang/DependencyScanning/DependencyActionController.h"
#include "clang/DependencyScanning/DependencyConsumer.h"
#include "clang/DependencyScanning/DependencyScanningFilesystem.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/SemaOpenACC.h"
#include "clang/Serialization/ObjectFilePCHContainerReader.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/AdvisoryLock.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/TargetParser/Host.h"
#include <mutex>
#include <thread>

Go to the source code of this file.

Classes

class  clang::dependencies::CompilerInstanceWithContext

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::dependencies

Functions

static bool checkHeaderSearchPaths (const HeaderSearchOptions &HSOpts, const HeaderSearchOptions &ExistingHSOpts, DiagnosticsEngine *Diags, const LangOptions &LangOpts)
static bool visitPrebuiltModule (StringRef PrebuiltModuleFilename, CompilerInstance &CI, PrebuiltModuleFilesT &ModuleFiles, PrebuiltModulesAttrsMap &PrebuiltModulesASTMap, DiagnosticsEngine &Diags, const ArrayRef< StringRef > StableDirs)
 Visit the given prebuilt module and collect all of the modules it transitively imports and contributing input files.
static std::string makeObjFileName (StringRef FileName)
 Transform arbitrary file name into an object-like file name.
static std::string deduceDepTarget (const std::string &OutputFile, const SmallVectorImpl< FrontendInputFile > &InputFiles)
 Deduce the dependency target based on the output file and input files.
static std::optional< StringRef > getSimpleMacroName (StringRef Macro)
static void canonicalizeDefines (PreprocessorOptions &PPOpts)
static void sanitizeDiagOpts (DiagnosticOptions &DiagOpts)
 Sanitize diagnostic options for dependency scan.
static std::unique_ptr< CompilerInvocationcreateCompilerInvocation (ArrayRef< std::string > CommandLine, DiagnosticsEngine &Diags)
static void initializeScanCompilerInstance (CompilerInstance &ScanInstance, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, DiagnosticConsumer *DiagConsumer, DependencyScanningService &Service, IntrusiveRefCntPtr< DependencyScanningWorkerFilesystem > DepFS)
static std::shared_ptr< CompilerInvocationcreateScanCompilerInvocation (const CompilerInvocation &Invocation, const DependencyScanningService &Service, DependencyActionController &Controller)
static llvm::SmallVector< StringRef > getInitialStableDirs (const CompilerInstance &ScanInstance)
static std::optional< PrebuiltModulesAttrsMapcomputePrebuiltModulesASTMap (CompilerInstance &ScanInstance, llvm::SmallVector< StringRef > &StableDirs)
static std::unique_ptr< DependencyOutputOptionscreateDependencyOutputOptions (const CompilerInvocation &Invocation)
static std::shared_ptr< ModuleDepCollectorinitializeScanInstanceDependencyCollector (CompilerInstance &ScanInstance, std::unique_ptr< DependencyOutputOptions > DepOutputOpts, DependencyScanningService &Service, CompilerInvocation &Inv, DependencyActionController &Controller, PrebuiltModulesAttrsMap PrebuiltModulesASTMap, SmallVector< StringRef > &StableDirs)
static void runTUModulePrescan (CompilerInstance &PrescanCI, DependencyScanningService &Service, DependencyActionController &Controller, AsyncModuleCompiles &Compiles)
std::unique_ptr< DiagnosticOptionsclang::dependencies::createScanningDiagOptions (ArrayRef< std::string > CommandLine)

Function Documentation

◆ canonicalizeDefines()

◆ checkHeaderSearchPaths()

bool checkHeaderSearchPaths ( const HeaderSearchOptions & HSOpts,
const HeaderSearchOptions & ExistingHSOpts,
DiagnosticsEngine * Diags,
const LangOptions & LangOpts )
static

◆ computePrebuiltModulesASTMap()

◆ createCompilerInvocation()

std::unique_ptr< CompilerInvocation > createCompilerInvocation ( ArrayRef< std::string > CommandLine,
DiagnosticsEngine & Diags )
static

◆ createDependencyOutputOptions()

◆ createScanCompilerInvocation()

◆ deduceDepTarget()

std::string deduceDepTarget ( const std::string & OutputFile,
const SmallVectorImpl< FrontendInputFile > & InputFiles )
static

Deduce the dependency target based on the output file and input files.

Definition at line 225 of file DependencyScanningWorker.cpp.

References makeObjFileName().

Referenced by createDependencyOutputOptions().

◆ getInitialStableDirs()

◆ getSimpleMacroName()

std::optional< StringRef > getSimpleMacroName ( StringRef Macro)
static

Definition at line 246 of file DependencyScanningWorker.cpp.

References clang::Macro.

Referenced by canonicalizeDefines().

◆ initializeScanCompilerInstance()

◆ initializeScanInstanceDependencyCollector()

std::shared_ptr< ModuleDepCollector > initializeScanInstanceDependencyCollector ( CompilerInstance & ScanInstance,
std::unique_ptr< DependencyOutputOptions > DepOutputOpts,
DependencyScanningService & Service,
CompilerInvocation & Inv,
DependencyActionController & Controller,
PrebuiltModulesAttrsMap PrebuiltModulesASTMap,
SmallVector< StringRef > & StableDirs )
static

◆ makeObjFileName()

std::string makeObjFileName ( StringRef FileName)
static

Transform arbitrary file name into an object-like file name.

Definition at line 217 of file DependencyScanningWorker.cpp.

References clang::FileName.

Referenced by deduceDepTarget().

◆ runTUModulePrescan()

void runTUModulePrescan ( CompilerInstance & PrescanCI,
DependencyScanningService & Service,
DependencyActionController & Controller,
AsyncModuleCompiles & Compiles )
static

◆ sanitizeDiagOpts()

void sanitizeDiagOpts ( DiagnosticOptions & DiagOpts)
static

◆ visitPrebuiltModule()

bool visitPrebuiltModule ( StringRef PrebuiltModuleFilename,
CompilerInstance & CI,
PrebuiltModuleFilesT & ModuleFiles,
PrebuiltModulesAttrsMap & PrebuiltModulesASTMap,
DiagnosticsEngine & Diags,
const ArrayRef< StringRef > StableDirs )
static