basic setting of ParsedAST.
This commit is contained in:
11
include/AST/Diagnostic.h
Normal file
11
include/AST/Diagnostic.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <clang/AST/RecursiveASTVisitor.h>
|
||||
#include <clang/Basic/Diagnostic.h>
|
||||
#include <clang/Frontend/CompilerInstance.h>
|
||||
#include <clang/Frontend/FrontendActions.h>
|
||||
#include <clang/Frontend/TextDiagnosticPrinter.h>
|
||||
#include <clang/Sema/Sema.h>
|
||||
#include <clang/Tooling/CompilationDatabase.h>
|
||||
#include <clang/Tooling/Syntax/Tokens.h>
|
||||
#include <clang/Lex/PPCallbacks.h>
|
||||
21
include/AST/ParsedAST.h
Normal file
21
include/AST/ParsedAST.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "Preamble.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
struct ParsedAST {
|
||||
std::unique_ptr<clang::FrontendAction> action;
|
||||
std::unique_ptr<clang::CompilerInstance> instance;
|
||||
|
||||
static std::unique_ptr<ParsedAST>
|
||||
build(llvm::StringRef filename, llvm::StringRef content, std::vector<const char*>& args, Preamble* preamble);
|
||||
|
||||
auto& ASTContext() const { return instance->getASTContext(); }
|
||||
|
||||
auto& SourceManager() const { return instance->getSourceManager(); }
|
||||
|
||||
auto TranslationUnitDecl() const { return ASTContext().getTranslationUnitDecl(); }
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
17
include/AST/Preamble.h
Normal file
17
include/AST/Preamble.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "Diagnostic.h"
|
||||
|
||||
namespace clice {
|
||||
|
||||
/// Represents the preamble of a translation unit.
|
||||
/// We build preamble for the translation after first edit.
|
||||
/// The preamble is used to speed up the reparse of the translation unit.
|
||||
struct Preamble {
|
||||
clang::PrecompiledPreamble data;
|
||||
|
||||
static std::unique_ptr<Preamble>
|
||||
build(llvm::StringRef filename, llvm::StringRef content, std::vector<const char*>& args);
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
Reference in New Issue
Block a user