Stabilize compilation interface (#117)

This commit is contained in:
ykiko
2025-03-30 21:30:52 +08:00
committed by GitHub
parent 74f2ebc4f4
commit 3f408a8e8e
6 changed files with 58 additions and 80 deletions

View File

@@ -38,9 +38,7 @@ struct CompilationParams {
llvm::StringMap<std::string> pcms;
/// Code completion file:line:column.
llvm::StringRef file = "";
uint32_t line = 0;
uint32_t column = 0;
std::tuple<std::string, std::uint32_t, std::uint32_t> completion;
};
namespace impl {
@@ -58,13 +56,14 @@ std::unique_ptr<clang::CompilerInstance> createInstance(CompilationParams& param
/// their reusability and update in time.
std::expected<ASTInfo, std::string> compile(CompilationParams& params);
/// Run code completion at the given location.
std::expected<ASTInfo, std::string> compile(CompilationParams& params, clang::CodeCompleteConsumer* consumer);
/// Build PCH from given file path and content.
std::expected<ASTInfo, std::string> compile(CompilationParams& params, PCHInfo& out);
/// Build PCM from given file path and content.
std::expected<ASTInfo, std::string> compile(CompilationParams& params, PCMInfo& out);
/// Run code completion at the given location.
std::expected<ASTInfo, std::string> compile(CompilationParams& params,
clang::CodeCompleteConsumer* consumer);
} // namespace clice