Go to the documentation of this file.
20 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_PARSEDAST_H
21 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_PARSEDAST_H
29 #include "clang/Frontend/FrontendAction.h"
30 #include "clang/Lex/Preprocessor.h"
31 #include "clang/Tooling/Syntax/Tokens.h"
32 #include "llvm/ADT/ArrayRef.h"
33 #include "llvm/ADT/Optional.h"
34 #include "llvm/ADT/StringRef.h"
42 class HeuristicResolver;
50 static llvm::Optional<ParsedAST>
52 std::unique_ptr<clang::CompilerInvocation>
CI,
53 llvm::ArrayRef<Diag> CompilerInvocationDiags,
54 std::shared_ptr<const PreambleData> Preamble);
103 const std::vector<PragmaMark> &
getMarks()
const;
106 const syntax::TokenBuffer &
getTokens()
const {
return Tokens; }
109 llvm::StringRef
version()
const {
return Version; }
116 return Resolver.get();
121 std::shared_ptr<const PreambleData> Preamble,
122 std::unique_ptr<CompilerInstance> Clang,
123 std::unique_ptr<FrontendAction> Action, syntax::TokenBuffer Tokens,
125 std::vector<Decl *> LocalTopLevelDecls,
132 std::shared_ptr<const PreambleData>
Preamble;
138 std::unique_ptr<CompilerInstance> Clang;
139 std::unique_ptr<FrontendAction> Action;
144 syntax::TokenBuffer Tokens;
149 std::vector<PragmaMark> Marks;
151 llvm::Optional<std::vector<Diag>> Diags;
154 std::vector<Decl *> LocalTopLevelDecls;
157 std::unique_ptr<HeuristicResolver> Resolver;
163 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_PARSEDAST_H
std::shared_ptr< Preprocessor > getPreprocessorPtr()
const IncludeStructure & getIncludeStructure() const
ASTContext & getASTContext()
Note that the returned ast will not contain decls from the preamble that were not deserialized during...
std::unique_ptr< CompilerInvocation > CI
std::string Filename
Filename as a string.
const CanonicalIncludes & getCanonicalIncludes() const
const LangOptions & getLangOpts() const
const PreambleData & Preamble
ParsedAST(ParsedAST &&Other)
static llvm::Optional< ParsedAST > build(llvm::StringRef Filename, const ParseInputs &Inputs, std::unique_ptr< clang::CompilerInvocation > CI, llvm::ArrayRef< Diag > CompilerInvocationDiags, std::shared_ptr< const PreambleData > Preamble)
Attempts to run Clang and store the parsed AST.
llvm::StringRef version() const
Returns the version of the ParseInputs this AST was built from.
Maps a definition location onto an #include file, based on a set of filename rules.
ParsedAST & operator=(ParsedAST &&Other)
const HeuristicResolver * getHeuristicResolver() const
Preprocessor & getPreprocessor()
const llvm::Optional< std::vector< Diag > > & getDiagnostics() const
const std::vector< PragmaMark > & getMarks() const
Gets all pragma marks in the main file.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
const syntax::TokenBuffer & getTokens() const
Tokens recorded while parsing the main file.
ArrayRef< Decl * > getLocalTopLevelDecls()
This function returns top-level decls present in the main file of the AST.
std::size_t getUsedBytes() const
Returns the estimated size of the AST and the accessory structures, in bytes.
Stores and provides access to parsed AST.
SourceManager & getSourceManager()
const SourceManager & getSourceManager() const
llvm::Optional< llvm::StringRef > preambleVersion() const
Returns the version of the ParseInputs used to build Preamble part of this AST.
const MainFileMacros & getMacros() const
Gets all macro references (definition, expansions) present in the main file, including those in the p...