fix: compiling C source file without -std=c++20 (#334)

This commit is contained in:
Myriad-Dreamin
2026-01-07 23:13:21 +08:00
committed by GitHub
parent dd8f0dd90d
commit f30f68f573

View File

@@ -690,8 +690,11 @@ CompilationContext CompilationDatabase::lookup(llvm::StringRef file,
if(info) {
directory = self->strings.get(info->directory);
arguments = self->mangle_command(file, *info, options);
} else {
// TODO: other c++ suffixes
} else if(file.ends_with(".cpp") || file.ends_with(".hpp") || file.ends_with(".cc")) {
arguments = {"clang++", "-std=c++20"};
} else {
arguments = {"clang"};
}
auto append_arg = [&](llvm::StringRef s) {