clang 20.0.0git
|
Classes | |
class | CrossTranslationUnitContext |
This class is used for tools that requires cross translation unit capability. More... | |
class | IndexError |
Typedefs | |
using | InvocationListTy = llvm::StringMap< llvm::SmallVector< std::string, 32 > > |
Functions | |
llvm::Expected< llvm::StringMap< std::string > > | parseCrossTUIndex (StringRef IndexPath) |
This function parses an index file that determines which translation unit contains which definition. | |
std::string | createCrossTUIndexString (const llvm::StringMap< std::string > &Index) |
llvm::Expected< InvocationListTy > | parseInvocationList (StringRef FileContent, llvm::sys::path::Style PathStyle=llvm::sys::path::Style::posix) |
Parse the YAML formatted invocation list file content FileContent . | |
bool | shouldImport (const VarDecl *VD, const ASTContext &ACtx) |
Returns true if it makes sense to import a foreign variable definition. | |
static bool | parseCrossTUIndexItem (StringRef LineRef, StringRef &LookupName, StringRef &FilePath) |
Parse one line of the input CTU index file. | |
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) |
using clang::cross_tu::InvocationListTy = typedef llvm::StringMap<llvm::SmallVector<std::string, 32> > |
Definition at line 102 of file CrossTranslationUnit.h.
|
strong |
Definition at line 40 of file CrossTranslationUnit.h.
std::string clang::cross_tu::createCrossTUIndexString | ( | const llvm::StringMap< std::string > & | Index | ) |
Definition at line 215 of file CrossTranslationUnit.cpp.
References E, and clang::Result.
|
static |
Definition at line 228 of file CrossTranslationUnit.cpp.
References D.
Referenced by hasBodyOrInit().
Definition at line 234 of file CrossTranslationUnit.cpp.
References D, hasBodyOrInit(), clang::T, and Unused.
Definition at line 231 of file CrossTranslationUnit.cpp.
References D.
llvm::Expected< llvm::StringMap< std::string > > clang::cross_tu::parseCrossTUIndex | ( | StringRef | IndexPath | ) |
This function parses an index file that determines which translation unit contains which definition.
The IndexPath is not prefixed with CTUDir, so an absolute path is expected for consistent results.
The index file format is the following: each line consists of an USR and a filepath separated by a space.
Definition at line 182 of file CrossTranslationUnit.cpp.
References invalid_index_format, clang::Line, missing_index_file, multiple_definitions, parseCrossTUIndexItem(), and clang::Result.
|
static |
Parse one line of the input CTU index file.
[in] | LineRef | The input CTU index item in format "<USR-Length>:<USR> <File-Path>". |
[out] | LookupName | The lookup name in format "<USR-Length>:<USR>". |
[out] | FilePath | The file path "<File-Path>". |
Definition at line 158 of file CrossTranslationUnit.cpp.
Referenced by parseCrossTUIndex().
llvm::Expected< InvocationListTy > clang::cross_tu::parseInvocationList | ( | StringRef | FileContent, |
llvm::sys::path::Style | PathStyle = llvm::sys::path::Style::posix |
||
) |
Parse the YAML formatted invocation list file content FileContent
.
The format is expected to be a mapping from absolute source file paths in the filesystem to a list of command-line parts, which constitute the invocation needed to compile that file. That invocation will be used to produce the AST of the TU.
LLVM YAML parser is used to extract information from invocation list file.
Only the first document is processed.
There has to be at least one document available.
According to the format specified the document must be a mapping, where the keys are paths to source files, and values are sequences of invocation parts.
The keys should be strings, which represent a source-file path.
The values should be sequences of strings, each representing a part of the invocation.
Every conversion starts with an empty working storage, as it is not clear if this is a requirement of the YAML parser.
LLVM YAML parser is used to extract information from invocation list file.
Only the first document is processed.
There has to be at least one document available.
According to the format specified the document must be a mapping, where the keys are paths to source files, and values are sequences of invocation parts.
The keys should be strings, which represent a source-file path.
The values should be sequences of strings, each representing a part of the invocation.
Every conversion starts with an empty working storage, as it is not clear if this is a requirement of the YAML parser.
Definition at line 619 of file CrossTranslationUnit.cpp.
References invocation_list_ambiguous, invocation_list_empty, invocation_list_wrong_format, and SM.
bool clang::cross_tu::shouldImport | ( | const VarDecl * | VD, |
const ASTContext & | ACtx | ||
) |
Returns true if it makes sense to import a foreign variable definition.
For instance, we don't want to import variables that have non-trivial types because the constructor might have side-effects.
Definition at line 223 of file CrossTranslationUnit.cpp.
References clang::ASTContext::getCanonicalType(), clang::ValueDecl::getType(), clang::CanQual< T >::isConstQualified(), and clang::QualType::isTrivialType().