Implement computeBounds.

This commit is contained in:
ykiko
2024-12-07 23:44:35 +08:00
parent dc081384d5
commit 4ccc577f57
3 changed files with 174 additions and 13 deletions

View File

@@ -141,12 +141,19 @@ struct CompliationParams {
/// `#include` directive that includes the header to speed up the parsing.
std::optional<clang::PreambleBounds> bounds;
/// Output file path.
llvm::SmallString<128> outPath;
/// Computes the preamble bounds for the given content.
/// If the bounds are not provided explicitly, they will be calculated based on the content.
///
/// - If the header is empty, the bounds can be determined by lexing the source file.
/// - If the header is not empty, the preprocessor must be executed to compute the bounds.
void computeBounds(llvm::StringRef header = "");
/// Command line arguments.
llvm::ArrayRef<const char*> args;
/// Output file path.
llvm::SmallString<128> outPath;
llvm::IntrusiveRefCntPtr<vfs::FileSystem> vfs = new ThreadSafeFS();
/// Information about reuse PCH.
@@ -161,8 +168,6 @@ struct CompliationParams {
uint32_t line = 0;
uint32_t column = 0;
void computeBounds();
void addPCH(const PCHInfo& info) {
pch = info.path;
pchBounds = info.bounds();