9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDUNIT_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDUNIT_H 21 #include "clang/Frontend/FrontendAction.h" 22 #include "clang/Frontend/PrecompiledPreamble.h" 23 #include "clang/Lex/Preprocessor.h" 24 #include "clang/Serialization/ASTBitCodes.h" 25 #include "clang/Tooling/CompilationDatabase.h" 26 #include "clang/Tooling/Core/Replacement.h" 27 #include "clang/Tooling/Syntax/Tokens.h" 43 struct CompileCommand;
52 std::vector<std::string> MainFileMacros,
53 std::unique_ptr<PreambleFileStatusCache> StatCache,
77 static llvm::Optional<ParsedAST>
78 build(std::unique_ptr<clang::CompilerInvocation> CI,
79 std::shared_ptr<const PreambleData>
Preamble,
80 std::unique_ptr<llvm::MemoryBuffer> Buffer,
92 ASTContext &getASTContext();
93 const ASTContext &getASTContext()
const;
95 Preprocessor &getPreprocessor();
96 std::shared_ptr<Preprocessor> getPreprocessorPtr();
97 const Preprocessor &getPreprocessor()
const;
100 return getASTContext().getSourceManager();
103 return getASTContext().getSourceManager();
109 ArrayRef<Decl *> getLocalTopLevelDecls();
111 const std::vector<Diag> &getDiagnostics()
const;
115 std::size_t getUsedBytes()
const;
124 ParsedAST(std::shared_ptr<const PreambleData> Preamble,
125 std::unique_ptr<CompilerInstance> Clang,
126 std::unique_ptr<FrontendAction>
Action, syntax::TokenBuffer
Tokens,
127 std::vector<Decl *> LocalTopLevelDecls, std::vector<Diag> Diags,
132 std::shared_ptr<const PreambleData>
Preamble;
138 std::unique_ptr<CompilerInstance> Clang;
139 std::unique_ptr<FrontendAction>
Action;
144 syntax::TokenBuffer
Tokens;
147 std::vector<Diag> Diags;
150 std::vector<Decl *> LocalTopLevelDecls;
156 std::function<void(ASTContext &, std::shared_ptr<clang::Preprocessor>,
165 std::shared_ptr<const PreambleData>
167 std::shared_ptr<const PreambleData> OldPreamble,
168 const tooling::CompileCommand &OldCompileCommand,
175 llvm::Optional<ParsedAST>
178 std::shared_ptr<const PreambleData>
Preamble);
183 const Position &Pos,
const FileID FID);
192 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CLANGDUNIT_H Some operations such as code completion produce a set of candidates.
std::vector< std::string > MainFileMacros
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS
void dumpAST(ParsedAST &AST, llvm::raw_ostream &OS)
For testing/debugging purposes.
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
llvm::StringRef PathRef
A typedef to represent a ref to file path.
const syntax::TokenBuffer & getTokens() const
Tokens recorded while parsing the main file.
SourceLocation getBeginningOfIdentifier(const ParsedAST &Unit, const Position &Pos, const FileID FID)
Get the beginning SourceLocation at a specified Pos.
std::shared_ptr< const PreambleData > buildPreamble(PathRef FileName, CompilerInvocation &CI, std::shared_ptr< const PreambleData > OldPreamble, const tooling::CompileCommand &OldCompileCommand, const ParseInputs &Inputs, bool StoreInMemory, PreambleParsedCallback PreambleCallback)
Rebuild the preamble for the new inputs unless the old one can be reused.
Maps a definition location onto an #include file, based on a set of filename rules.
CanonicalIncludes CanonIncludes
std::unique_ptr< PreambleFileStatusCache > StatCache
const SourceManager & getSourceManager() const
llvm::unique_function< void()> Action
llvm::Optional< ParsedAST > buildAST(PathRef FileName, std::unique_ptr< CompilerInvocation > Invocation, const ParseInputs &Inputs, std::shared_ptr< const PreambleData > Preamble)
Build an AST from provided user inputs.
Stores and provides access to parsed AST.
std::function< void(ASTContext &, std::shared_ptr< clang::Preprocessor >, const CanonicalIncludes &)> PreambleParsedCallback
SourceManager & getSourceManager()
tooling::CompileCommand CompileCommand
const PreambleData * Preamble
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::vector< Diag > Diags
PrecompiledPreamble Preamble
IncludeStructure Includes
const SymbolIndex * Index