15 #ifndef LLVM_CLANG_CROSSTU_CROSSTRANSLATIONUNIT_H 16 #define LLVM_CLANG_CROSSTU_CROSSTRANSLATIONUNIT_H 20 #include "llvm/ADT/DenseMap.h" 21 #include "llvm/ADT/SmallPtrSet.h" 22 #include "llvm/ADT/StringMap.h" 23 #include "llvm/Support/Error.h" 26 class CompilerInstance;
33 class TranslationUnitDecl;
55 : Code(C), FileName(
std::move(FileName)), LineNo(LineNo) {}
57 std::string TripleFromName)
58 : Code(C), FileName(
std::move(FileName)),
59 TripleToName(
std::move(TripleToName)),
60 TripleFromName(
std::move(TripleFromName)) {}
61 void log(raw_ostream &OS)
const override;
62 std::error_code convertToErrorCode()
const override;
73 std::string TripleToName;
74 std::string TripleFromName;
122 getCrossTUDefinition(
const FunctionDecl *FD, StringRef CrossTUDir,
123 StringRef IndexName,
bool DisplayCTUProgress =
false);
139 StringRef CrossTUDir,
141 bool DisplayCTUProgress =
false);
151 static std::string getLookupName(
const NamedDecl *ND);
154 void emitCrossTUDiagnostics(
const IndexError &IE);
160 StringRef LookupFnName);
162 llvm::StringMap<std::unique_ptr<clang::ASTUnit>> FileASTUnitMap;
163 llvm::StringMap<clang::ASTUnit *> FunctionASTUnitMap;
164 llvm::StringMap<std::string> FunctionFileMap;
165 llvm::DenseMap<TranslationUnitDecl *, std::unique_ptr<ASTImporter>>
169 std::unique_ptr<ASTImporterLookupTable> LookupTable;
175 #endif // LLVM_CLANG_CROSSTU_CROSSTRANSLATIONUNIT_H Represents a function declaration or definition.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::string createCrossTUIndexString(const llvm::StringMap< std::string > &Index)
std::string getFileName() const
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...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
IndexError(index_error_code C, std::string FileName, std::string TripleToName, std::string TripleFromName)
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
This class is used for tools that requires cross translation unit capability.
index_error_code getCode() const
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
IndexError(index_error_code C, std::string FileName, int LineNo=0)
The top declaration context.
This represents a decl that may have a name.
std::string getTripleToName() const
IndexError(index_error_code C)
std::string getTripleFromName() const