clang 10.0.0git

Classes | Enumerations | Functions
clang::cross_tu Namespace Reference

## Classes
class | CrossTranslationUnitContext
| This class is used for tools that requires cross translation unit capability. More...
class | IndexError

## Enumerations
enum | index_error_code { index_error_code::unspecified = 1, index_error_code::missing_index_file, index_error_code::invalid_index_format, index_error_code::multiple_definitions, index_error_code::missing_definition, index_error_code::failed_import, index_error_code::failed_to_get_external_ast, index_error_code::failed_to_generate_usr, index_error_code::triple_mismatch, index_error_code::lang_mismatch, index_error_code::lang_dialect_mismatch, index_error_code::load_threshold_reached }

## Functions
llvm::Expected< llvm::StringMap< std::string > > | parseCrossTUIndex (StringRef IndexPath, StringRef CrossTUDir)
| This function parses an index file that determines which translation unit contains which definition. More...
std::string | createCrossTUIndexString (const llvm::StringMap< std::string > &Index)
bool | containsConst (const VarDecl *VD, const ASTContext &ACtx)
static bool | hasBodyOrInit (const FunctionDecl *D, const FunctionDecl *&DefD)
static bool | hasBodyOrInit (const VarDecl *D, const VarDecl *&DefD)
template<typename T >
static bool | hasBodyOrInit (const T *D)

## Enumeration Type Documentation

## ◆ index_error_code

enum clang::cross_tu::index_error_code
| strong

Enumerator
unspecified |
missing_index_file |
invalid_index_format |
multiple_definitions |
missing_definition |
failed_import |
failed_to_get_external_ast |
failed_to_generate_usr |
triple_mismatch |
lang_mismatch |
lang_dialect_mismatch |
load_threshold_reached |

Definition at line 38 of file CrossTranslationUnit.h.

## Function Documentation

## ◆ containsConst()

bool clang::cross_tu::containsConst | ( | const VarDecl * | VD,
|  | const ASTContext & | ACtx
| ) |  |

Definition at line 169 of file CrossTranslationUnit.cpp.

References clang::CanQual< T >::getAs(), clang::ASTContext::getCanonicalType(), clang::ValueDecl::getType(), clang::RecordType::hasConstFields(), and clang::CanQual< T >::isConstQualified().

## ◆ createCrossTUIndexString()

std::string clang::cross_tu::createCrossTUIndexString | ( | const llvm::StringMap< std::string > & | Index | ) |

Definition at line 162 of file CrossTranslationUnit.cpp.

Referenced by clang::cross_tu::IndexError::getTripleFromName().

## ◆ hasBodyOrInit() [1/3]

static bool clang::cross_tu::hasBodyOrInit | ( | const FunctionDecl * | D,
|  | const FunctionDecl *& | DefD
| ) |  |
| static

Definition at line 179 of file CrossTranslationUnit.cpp.

References clang::FunctionDecl::hasBody().

Referenced by clang::cross_tu::CrossTranslationUnitContext::getLookupName(), hasBodyOrInit(), and clang::cross_tu::CrossTranslationUnitContext::loadExternalAST().

## ◆ hasBodyOrInit() [2/3]

static bool clang::cross_tu::hasBodyOrInit | ( | const VarDecl * | D,
|  | const VarDecl *& | DefD
| ) |  |
| static

Definition at line 182 of file CrossTranslationUnit.cpp.

References clang::VarDecl::getAnyInitializer().

## ◆ hasBodyOrInit() [3/3]

template<typename T >

static bool clang::cross_tu::hasBodyOrInit | ( | const T * | D | ) |
| static

Definition at line 185 of file CrossTranslationUnit.cpp.

References hasBodyOrInit(), and Unused.

## ◆ parseCrossTUIndex()

llvm::Expected< llvm::StringMap< std::string > > clang::cross_tu::parseCrossTUIndex | ( | StringRef | IndexPath,
|  | StringRef | CrossTUDir
| ) |  |

This function parses an index file that determines which translation unit contains which definition.

The index file format is the following: each line consists of an USR and a filepath separated by a space.

Returns
  Returns a map where the USR is the key and the filepath is the value or an error.

Definition at line 132 of file CrossTranslationUnit.cpp.

References invalid_index_format, Line, missing_index_file, and multiple_definitions.

Referenced by clang::cross_tu::CrossTranslationUnitContext::emitCrossTUDiagnostics(), and clang::cross_tu::IndexError::getTripleFromName().