-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
allow configuring cc/cxx on analyze #112
base: master
Are you sure you want to change the base?
Conversation
Hey Joseph, did you try the |
Yea but it never got that far to use the analyzer until I made this change. |
I'm confused, please help me to understand then. You have a JSON compilation database. (Could you show me one entry from it?) Then you want to run the static analyzer against those files. (That should not take |
Right. I can try to make a repo to reproduce it if that helps. Maybe I'm missing something. |
Here's a repo that exhibits the issue https://github.com/joprice/bazel-ios-example. I have the |
Thanks Joseph. Was only looking at the repo, but did not run it (mainly because I have no OSX machine available). But one question interest me the most: Is that JSON compilation database works with any other programs? (clang-format? clang-tidy?) I could not notice that the I did a little research on Bazel about a year before. It do bind mounts the needed source and header files before run the compiler. (This is how they guarantee that only those header files you see, what you were mentioned in the build file.) If the compilation database is created the way they execute the build, then scan-build (and other tools) will not work. So, are the |
When I make the above changes, all the paths work out and scan-build works for me. I have not tried with other tools yet. I can modify the example to be a plain c file. |
When trying to use a compilation database generated from a bazel build, I found that analyze-build was finishing suspiciously quickly, and reporting no issues. After tracing this locally, I found that the code was trying to find 'cc' or 'c++' in the command for each entry. However, the command in the case of bazel is
external/local_config_cc/wrapped_clang
. I noticed that these strings are configurable via command line arguments when thecdb
flag is not being used, so I changed the argument parser to always include those flags. Not sure this is the right solution. If it is, I'd like to follow up with some tests.