refactor: simplify CompilationDatabase, extract ArgumentParser, remove pimpl (#371)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ykiko
2026-03-27 13:15:49 +08:00
committed by GitHub
parent 498c975042
commit 46ba1e4db6
19 changed files with 1724 additions and 1824 deletions

View File

@@ -1,4 +1,5 @@
#include "test/test.h"
#include "command/argument_parser.h"
#include "command/command.h"
#include "command/toolchain.h"
#include "compile/compilation.h"
@@ -6,7 +7,6 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/StringSaver.h"
#include "clang/Driver/Driver.h"
namespace clice::testing {
namespace {
@@ -52,10 +52,8 @@ TEST_CASE(GCC, {.skip = !(CIEnvironment && (Windows || Linux))}) {
llvm::BumpPtrAllocator a;
llvm::StringSaver s(a);
auto arguments = toolchain::query_toolchain({
.arguments = {"g++",
"-std=c++23", "-resource-dir",
CompilationDatabase::resource_dir().data(),
"-xc++", file->c_str()},
.arguments =
{"g++", "-std=c++23", "-resource-dir", resource_dir().data(), "-xc++", file->c_str()},
.callback = [&](const char* str) { return s.save(str).data(); }
});
@@ -93,7 +91,7 @@ TEST_CASE(Clang, {.skip = !CIEnvironment}) {
auto arguments = toolchain::query_toolchain({
.arguments = {"clang++",
"-std=c++23", "-resource-dir",
CompilationDatabase::resource_dir().data(),
resource_dir().data(),
"-xc++", file->c_str()},
.callback = [&](const char* str) { return s.save(str).data(); }
});