clang 8.0.0

Public 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:
[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 ()
| 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...
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...

## 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 DependencyFileGen and DependencyGraphGen to use this interface.

Definition at line 83 of file Utils.h.

## Constructor & Destructor Documentation

## ◆ ~DependencyCollector()

DependencyCollector::~DependencyCollector | ( |  | ) |
| virtual

Definition at line 140 of file DependencyFile.cpp.

## Member Function Documentation

## ◆ attachToASTReader()

void DependencyCollector::attachToASTReader | ( | ASTReader & | R | ) |
| virtual

Reimplemented in clang::ModuleDependencyCollector.

Definition at line 147 of file DependencyFile.cpp.

References clang::ASTReader::addListener(), clang::DependencyOutputOptions::AddMissingHeaderDeps, clang::DependencyOutputOptions::ExtraDeps, clang::FileEntry::getName(), clang::DependencyOutputOptions::IncludeModuleFiles, clang::DependencyOutputOptions::IncludeSystemHeaders, clang::SrcMgr::isSystem(), clang::DependencyOutputOptions::OutputFile, clang::DependencyOutputOptions::OutputFormat, Parent, clang::DependencyOutputOptions::Targets, and clang::DependencyOutputOptions::UsePhonyTargets.

## ◆ attachToPreprocessor()

void DependencyCollector::attachToPreprocessor | ( | Preprocessor & | PP | ) |
| virtual

Reimplemented in clang::ModuleDependencyCollector.

Definition at line 141 of file DependencyFile.cpp.

References clang::ModuleMap::addModuleMapCallbacks(), clang::Preprocessor::addPPCallbacks(), clang::Preprocessor::getHeaderSearchInfo(), clang::HeaderSearch::getModuleMap(), and clang::Preprocessor::getSourceManager().

## ◆ finishedMainFile()

virtual void clang::DependencyCollector::finishedMainFile | ( |  | ) |
| inline virtual

Called when the end of the main file is reached.

Definition at line 99 of file Utils.h.

## ◆ getDependencies()

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

Definition at line 89 of file Utils.h.

References Filename.

## ◆ maybeAddDependency()

void DependencyCollector::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.

Definition at line 118 of file DependencyFile.cpp.

## ◆ needSystemDependencies()

virtual bool clang::DependencyCollector::needSystemDependencies | ( |  | ) |
| inline virtual

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

Definition at line 102 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.

Definition at line 133 of file DependencyFile.cpp.

References isSpecialFilename().

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

- include/clang/Frontend/Utils.h
- lib/Frontend/DependencyFile.cpp