clang 20.0.0git
Public Member Functions | Protected Member Functions | List of all members
clang::DependencyCollector Class Reference

An interface for collecting the dependencies of a compilation. More...

#include "clang/Frontend/Utils.h"

Inheritance diagram for clang::DependencyCollector:
Inheritance graph
[legend]

Public Member Functions

virtual ~DependencyCollector ()
 
virtual void attachToPreprocessor (Preprocessor &PP)
 
virtual void attachToASTReader (ASTReader &R)
 
ArrayRef< std::string > getDependencies () const
 
virtual bool sawDependency (StringRef Filename, bool FromModule, bool IsSystem, bool IsModuleFile, bool IsMissing)
 Called when a new file is seen.
 
virtual void finishedMainFile (DiagnosticsEngine &Diags)
 Called when the end of the main file is reached.
 
virtual bool needSystemDependencies ()
 Return true if system files should be passed to sawDependency().
 
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.
 

Protected Member Functions

bool addDependency (StringRef Filename)
 Return true if the filename was added to the list of dependencies, false otherwise.
 

Detailed Description

An interface for collecting the dependencies of a compilation.

Users should use attachToPreprocessor and attachToASTReader to get all of the dependencies. FIXME: Migrate DependencyGraphGen to use this interface.

Definition at line 63 of file Utils.h.

Constructor & Destructor Documentation

◆ ~DependencyCollector()

DependencyCollector::~DependencyCollector ( )
virtual

Definition at line 208 of file DependencyFile.cpp.

Member Function Documentation

◆ addDependency()

bool DependencyCollector::addDependency ( StringRef  Filename)
protected

Return true if the filename was added to the list of dependencies, false otherwise.

Definition at line 178 of file DependencyFile.cpp.

References Filename.

Referenced by clang::DependencyFileGenerator::DependencyFileGenerator(), and maybeAddDependency().

◆ attachToASTReader()

void DependencyCollector::attachToASTReader ( ASTReader R)
virtual

◆ attachToPreprocessor()

void DependencyCollector::attachToPreprocessor ( Preprocessor PP)
virtual

◆ finishedMainFile()

virtual void clang::DependencyCollector::finishedMainFile ( DiagnosticsEngine Diags)
inlinevirtual

Called when the end of the main file is reached.

Reimplemented in clang::DependencyFileGenerator.

Definition at line 79 of file Utils.h.

◆ getDependencies()

ArrayRef< std::string > clang::DependencyCollector::getDependencies ( ) const
inline

Definition at line 69 of file Utils.h.

Referenced by clang::DependencyFileGenerator::outputDependencyFile().

◆ maybeAddDependency()

void DependencyCollector::maybeAddDependency ( StringRef  Filename,
bool  FromModule,
bool  IsSystem,
bool  IsModuleFile,
bool  IsMissing 
)
virtual

Add a dependency Filename if it has not been seen before and sawDependency() returns true.

Definition at line 170 of file DependencyFile.cpp.

References addDependency(), Filename, and sawDependency().

◆ needSystemDependencies()

virtual bool clang::DependencyCollector::needSystemDependencies ( )
inlinevirtual

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

Reimplemented in clang::DependencyFileGenerator.

Definition at line 82 of file Utils.h.

Referenced by sawDependency().

◆ sawDependency()

bool DependencyCollector::sawDependency ( StringRef  Filename,
bool  FromModule,
bool  IsSystem,
bool  IsModuleFile,
bool  IsMissing 
)
virtual

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 in clang::DependencyFileGenerator.

Definition at line 201 of file DependencyFile.cpp.

References Filename, isSpecialFilename(), and needSystemDependencies().

Referenced by maybeAddDependency().


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