Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect C++ language from compiler arguments #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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