Improve PCH handling (#136)
This commit is contained in:
@@ -45,15 +45,8 @@ struct CompilationParams {
|
||||
}
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
|
||||
/// Create a compiler invocation from the given compilation parameters.
|
||||
std::unique_ptr<clang::CompilerInvocation> createInvocation(CompilationParams& params);
|
||||
|
||||
/// Create a compiler instance from the given compilation parameters.
|
||||
std::unique_ptr<clang::CompilerInstance> createInstance(CompilationParams& params);
|
||||
|
||||
} // namespace impl
|
||||
/// Only preprocess ths source flie.
|
||||
std::expected<ASTInfo, std::string> preprocess(CompilationParams& params);
|
||||
|
||||
/// Build AST from given file path and content. If pch or pcm provided, apply them to the compiler.
|
||||
/// Note this function will not check whether we need to update the PCH or PCM, caller should check
|
||||
|
||||
@@ -115,12 +115,25 @@ struct Pragma {
|
||||
clang::SourceLocation loc;
|
||||
};
|
||||
|
||||
struct Import {
|
||||
/// The name of imported module.
|
||||
std::string name;
|
||||
|
||||
/// The location of import keyword, may comes from macro expansion.
|
||||
clang::SourceLocation location;
|
||||
|
||||
/// The locations of tokens that make up the token name, may comes
|
||||
/// from macro expansion.
|
||||
std::vector<clang::SourceLocation> name_locations;
|
||||
};
|
||||
|
||||
struct Directive {
|
||||
std::vector<Include> includes;
|
||||
std::vector<HasInclude> hasIncludes;
|
||||
std::vector<Condition> conditions;
|
||||
std::vector<MacroRef> macros;
|
||||
std::vector<Pragma> pragmas;
|
||||
std::vector<Import> imports;
|
||||
|
||||
/// Tell preprocessor to collect directives information and store them in `directives`.
|
||||
static void attach(clang::Preprocessor& pp,
|
||||
|
||||
Reference in New Issue
Block a user