clang  14.0.0git
Public Member Functions | Protected Member Functions | List of all members
clang::DependencyFileGenerator Class Reference

Builds a dependency file when attached to a Preprocessor (for includes) and ASTReader (for module imports), and writes it out at the end of processing a source file. More...

#include "clang/Frontend/Utils.h"

Inheritance diagram for clang::DependencyFileGenerator:
Inheritance graph
[legend]
Collaboration diagram for clang::DependencyFileGenerator:
Collaboration graph
[legend]

Public Member Functions

 DependencyFileGenerator (const DependencyOutputOptions &Opts)
 
void attachToPreprocessor (Preprocessor &PP) override
 
void finishedMainFile (DiagnosticsEngine &Diags) override
 Called when the end of the main file is reached. More...
 
bool needSystemDependencies () final override
 Return true if system files should be passed to sawDependency(). More...
 
bool sawDependency (StringRef Filename, bool FromModule, bool IsSystem, bool IsModuleFile, bool IsMissing) final override
 Called when a new file is seen. More...
 
- Public Member Functions inherited from clang::DependencyCollector
virtual ~DependencyCollector ()
 
virtual void attachToASTReader (ASTReader &R)
 
ArrayRef< std::stringgetDependencies () const
 
virtual void maybeAddDependency (StringRef Filename, bool FromModule, bool IsSystem, bool IsModuleFile, bool IsMissing)
 Add a dependency Filename if it has not been seen before and sawDependency() returns true. More...
 

Protected Member Functions

void outputDependencyFile (llvm::raw_ostream &OS)
 
- Protected Member Functions inherited from clang::DependencyCollector
bool addDependency (StringRef Filename)
 Return true if the filename was added to the list of dependencies, false otherwise. More...
 

Detailed Description

Builds a dependency file when attached to a Preprocessor (for includes) and ASTReader (for module imports), and writes it out at the end of processing a source file.

Users should attach to the ast reader whenever a module is loaded.

Definition at line 118 of file Utils.h.

Constructor & Destructor Documentation

◆ DependencyFileGenerator()

DependencyFileGenerator::DependencyFileGenerator ( const DependencyOutputOptions Opts)

Member Function Documentation

◆ attachToPreprocessor()

void DependencyFileGenerator::attachToPreprocessor ( Preprocessor PP)
overridevirtual

◆ finishedMainFile()

void DependencyFileGenerator::finishedMainFile ( DiagnosticsEngine Diags)
overridevirtual

Called when the end of the main file is reached.

Reimplemented from clang::DependencyCollector.

Definition at line 231 of file DependencyFile.cpp.

References outputDependencyFile().

◆ needSystemDependencies()

bool clang::DependencyFileGenerator::needSystemDependencies ( )
inlinefinaloverridevirtual

Return true if system files should be passed to sawDependency().

Reimplemented from clang::DependencyCollector.

Definition at line 126 of file Utils.h.

◆ outputDependencyFile()

void DependencyFileGenerator::outputDependencyFile ( llvm::raw_ostream &  OS)
protected

◆ sawDependency()

bool DependencyFileGenerator::sawDependency ( StringRef  Filename,
bool  FromModule,
bool  IsSystem,
bool  IsModuleFile,
bool  IsMissing 
)
finaloverridevirtual

Called when a new file is seen.

Return true if Filename should be added to the list of dependencies.

The default implementation ignores <built-in> and system files.

Reimplemented from clang::DependencyCollector.

Definition at line 209 of file DependencyFile.cpp.

References Filename, and isSpecialFilename().


The documentation for this class was generated from the following files: