Skip to content

Conversation

ArthurVasseur
Copy link

This PR improves C++ language detection by analyzing compiler arguments.

Before my PR, the language was detected by checking if "++" existed in the compiler name. This approach is incorrect in certain cases.

// If ++ exists within the compiler name (e.g. clang++, g++, etc), use C++
std::string exe(clang_getCString(clang_CompileCommand_getArg(cmd, 0)));
use_c_ = (exe.find("++", 0) == std::string::npos);

e.g my build utility xmake is only using clang not clang++ in the compile_commands.json and setting -std=c++20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant