#include "clang/CrossTU/CrossTranslationUnit.h"
#include "clang/AST/ASTImporter.h"
#include "clang/AST/Decl.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CrossTU/CrossTUDiagnostic.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Index/USRGeneration.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <fstream>
#include <optional>
#include <sstream>
#include <tuple>
namespace clang {
namespace cross_tu {
namespace …
char IndexError::ID;
void IndexError::log(raw_ostream &OS) const { … }
std::error_code IndexError::convertToErrorCode() const { … }
static bool parseCrossTUIndexItem(StringRef LineRef, StringRef &LookupName,
StringRef &FilePath) { … }
llvm::Expected<llvm::StringMap<std::string>>
parseCrossTUIndex(StringRef IndexPath) { … }
std::string
createCrossTUIndexString(const llvm::StringMap<std::string> &Index) { … }
bool shouldImport(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) { … }
CrossTranslationUnitContext::CrossTranslationUnitContext(CompilerInstance &CI)
: … { … }
CrossTranslationUnitContext::~CrossTranslationUnitContext() { … }
std::optional<std::string>
CrossTranslationUnitContext::getLookupName(const NamedDecl *ND) { … }
template <typename T>
const T *
CrossTranslationUnitContext::findDefInDeclContext(const DeclContext *DC,
StringRef LookupName) { … }
template <typename T>
llvm::Expected<const T *> CrossTranslationUnitContext::getCrossTUDefinitionImpl(
const T *D, StringRef CrossTUDir, StringRef IndexName,
bool DisplayCTUProgress) { … }
llvm::Expected<const FunctionDecl *>
CrossTranslationUnitContext::getCrossTUDefinition(const FunctionDecl *FD,
StringRef CrossTUDir,
StringRef IndexName,
bool DisplayCTUProgress) { … }
llvm::Expected<const VarDecl *>
CrossTranslationUnitContext::getCrossTUDefinition(const VarDecl *VD,
StringRef CrossTUDir,
StringRef IndexName,
bool DisplayCTUProgress) { … }
void CrossTranslationUnitContext::emitCrossTUDiagnostics(const IndexError &IE) { … }
CrossTranslationUnitContext::ASTUnitStorage::ASTUnitStorage(
CompilerInstance &CI)
: … { … }
llvm::Expected<ASTUnit *>
CrossTranslationUnitContext::ASTUnitStorage::getASTUnitForFile(
StringRef FileName, bool DisplayCTUProgress) { … }
llvm::Expected<ASTUnit *>
CrossTranslationUnitContext::ASTUnitStorage::getASTUnitForFunction(
StringRef FunctionName, StringRef CrossTUDir, StringRef IndexName,
bool DisplayCTUProgress) { … }
llvm::Expected<std::string>
CrossTranslationUnitContext::ASTUnitStorage::getFileForFunction(
StringRef FunctionName, StringRef CrossTUDir, StringRef IndexName) { … }
llvm::Error CrossTranslationUnitContext::ASTUnitStorage::ensureCTUIndexLoaded(
StringRef CrossTUDir, StringRef IndexName) { … }
llvm::Expected<ASTUnit *> CrossTranslationUnitContext::loadExternalAST(
StringRef LookupName, StringRef CrossTUDir, StringRef IndexName,
bool DisplayCTUProgress) { … }
CrossTranslationUnitContext::ASTLoader::ASTLoader(
CompilerInstance &CI, StringRef CTUDir, StringRef InvocationListFilePath)
: … { … }
CrossTranslationUnitContext::LoadResultTy
CrossTranslationUnitContext::ASTLoader::load(StringRef Identifier) { … }
CrossTranslationUnitContext::LoadResultTy
CrossTranslationUnitContext::ASTLoader::loadFromDump(StringRef ASTDumpPath) { … }
CrossTranslationUnitContext::LoadResultTy
CrossTranslationUnitContext::ASTLoader::loadFromSource(
StringRef SourceFilePath) { … }
llvm::Expected<InvocationListTy>
parseInvocationList(StringRef FileContent, llvm::sys::path::Style PathStyle) { … }
llvm::Error CrossTranslationUnitContext::ASTLoader::lazyInitInvocationList() { … }
template <typename T>
llvm::Expected<const T *>
CrossTranslationUnitContext::importDefinitionImpl(const T *D, ASTUnit *Unit) { … }
llvm::Expected<const FunctionDecl *>
CrossTranslationUnitContext::importDefinition(const FunctionDecl *FD,
ASTUnit *Unit) { … }
llvm::Expected<const VarDecl *>
CrossTranslationUnitContext::importDefinition(const VarDecl *VD,
ASTUnit *Unit) { … }
void CrossTranslationUnitContext::lazyInitImporterSharedSt(
TranslationUnitDecl *ToTU) { … }
ASTImporter &
CrossTranslationUnitContext::getOrCreateASTImporter(ASTUnit *Unit) { … }
std::optional<clang::MacroExpansionContext>
CrossTranslationUnitContext::getMacroExpansionContextForSourceLocation(
const clang::SourceLocation &ToLoc) const { … }
bool CrossTranslationUnitContext::isImportedAsNew(const Decl *ToDecl) const { … }
bool CrossTranslationUnitContext::hasError(const Decl *ToDecl) const { … }
}
}