class CrossTranslationUnitContext::ASTUnitStorage

Declaration

class CrossTranslationUnitContext::ASTUnitStorage { /* full declaration omitted */ };

Description

Storage and load of ASTUnits, cached access, and providing searchability are the concerns of ASTUnitStorage class.

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:291

Member Variables

private clang::cross_tu::CrossTranslationUnitContext:: ASTUnitStorage::OwningMapTy FileASTUnitMap
private clang::cross_tu::CrossTranslationUnitContext:: ASTUnitStorage::NonOwningMapTy NameASTUnitMap
private clang::cross_tu::CrossTranslationUnitContext:: ASTUnitStorage::IndexMapTy NameFileMap
private clang::cross_tu::CrossTranslationUnitContext:: ASTLoader Loader
Loads the AST based on the identifier found in the index.
private clang::cross_tu::CrossTranslationUnitContext:: ASTLoadGuard LoadGuard
Limit the number of loaded ASTs. It is used to limit the memory usage of the CrossTranslationUnitContext. The ASTUnitStorage has the information whether the AST to load is actually loaded or returned from cache. This information is needed to maintain the counter.

Method Overview

  • public ASTUnitStorage(clang::CompilerInstance & CI)
  • private llvm::Error ensureCTUIndexLoaded(llvm::StringRef CrossTUDir, llvm::StringRef IndexName)
  • private llvm::Expected<ASTUnit *> getASTUnitForFile(llvm::StringRef FileName, bool DisplayCTUProgress)
  • public llvm::Expected<ASTUnit *> getASTUnitForFunction(llvm::StringRef FunctionName, llvm::StringRef CrossTUDir, llvm::StringRef IndexName, bool DisplayCTUProgress)
  • public llvm::Expected<std::string> getFileForFunction(llvm::StringRef FunctionName, llvm::StringRef CrossTUDir, llvm::StringRef IndexName)

Methods

ASTUnitStorage(clang::CompilerInstance& CI)

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:293

Parameters

clang::CompilerInstance& CI

llvm::Error ensureCTUIndexLoaded(
    llvm::StringRef CrossTUDir,
    llvm::StringRef IndexName)

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:324

Parameters

llvm::StringRef CrossTUDir
llvm::StringRef IndexName

llvm::Expected<ASTUnit*> getASTUnitForFile(
    llvm::StringRef FileName,
    bool DisplayCTUProgress)

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:325

Parameters

llvm::StringRef FileName
bool DisplayCTUProgress

llvm::Expected<ASTUnit*> getASTUnitForFunction(
    llvm::StringRef FunctionName,
    llvm::StringRef CrossTUDir,
    llvm::StringRef IndexName,
    bool DisplayCTUProgress)

Description

Loads an ASTUnit for a function.

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:305

Parameters

llvm::StringRef FunctionName
USR name of the function.
llvm::StringRef CrossTUDir
Path to the directory used to store CTU related files.
llvm::StringRef IndexName
Name of the file inside \p CrossTUDir which maps function USR names to file paths. These files contain the corresponding AST-dumps.
bool DisplayCTUProgress
Display a message about loading new ASTs.

Returns

An Expected instance which contains the ASTUnit pointer or the error occurred during the load.

llvm::Expected<std::string> getFileForFunction(
    llvm::StringRef FunctionName,
    llvm::StringRef CrossTUDir,
    llvm::StringRef IndexName)

Description

Identifies the path of the file which can be used to load the ASTUnit for a given function.

Declared at: clang/include/clang/CrossTU/CrossTranslationUnit.h:319

Parameters

llvm::StringRef FunctionName
USR name of the function.
llvm::StringRef CrossTUDir
Path to the directory used to store CTU related files.
llvm::StringRef IndexName
Name of the file inside \p CrossTUDir which maps function USR names to file paths. These files contain the corresponding AST-dumps.

Returns

An Expected instance containing the filepath.