clang  12.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. More...
 
virtual void finishedMainFile (DiagnosticsEngine &Diags)
 Called when the end of the main file is reached. More...
 
virtual bool needSystemDependencies ()
 Return true if system files should be passed to sawDependency(). More...
 
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

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

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 76 of file Utils.h.

Constructor & Destructor Documentation

◆ ~DependencyCollector()

DependencyCollector::~DependencyCollector ( )
virtual

Definition at line 170 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 148 of file DependencyFile.cpp.

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

◆ 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 92 of file Utils.h.

◆ getDependencies()

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

Definition at line 82 of file Utils.h.

References Filename.

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 140 of file DependencyFile.cpp.

◆ needSystemDependencies()

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

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

Reimplemented in clang::DependencyFileGenerator.

Definition at line 95 of file Utils.h.

◆ 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 163 of file DependencyFile.cpp.

References isSpecialFilename().


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