From f30f68f5737c6765e5b02aac5f931c18f54d3fa8 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> Date: Wed, 7 Jan 2026 23:13:21 +0800 Subject: [PATCH] fix: compiling C source file without `-std=c++20` (#334) --- src/Compiler/Command.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Command.cpp b/src/Compiler/Command.cpp index 2cf3b91a..04c1825f 100644 --- a/src/Compiler/Command.cpp +++ b/src/Compiler/Command.cpp @@ -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) {