-
Notifications
You must be signed in to change notification settings - Fork 355
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
Update usage.md #4154
base: master
Are you sure you want to change the base?
Update usage.md #4154
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ in your source code and integrate the static analysis into your CI flow to preve | |
- [Step 1: Integrate CodeChecker into your build system](#step-1-integrate-codechecker-into-your-build-system) | ||
- [Step in the docs/examples directory](#step-in-the-docsexamples-directory) | ||
- [Clean the workspace](#clean-the-workspace) | ||
- [Log your build](#log-your-build) | ||
- [Generate a compilation database](#generate-a-compilation-database) | ||
- [Check the contents of compile\_commands.json file](#check-the-contents-of-compile_commandsjson-file) | ||
- [Step 2: Analyze your code](#step-2-analyze-your-code) | ||
- [Run the analysis](#run-the-analysis) | ||
|
@@ -81,15 +81,25 @@ cd <repo root dir>/docs/examples | |
make clean | ||
``` | ||
|
||
### Log your build | ||
### Generate a compilation database | ||
|
||
There are different ways to generate a | ||
[compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html). | ||
This compilation database is an input of the next analysis step. | ||
|
||
You can check [LLVM documentation](https://clang.llvm.org/docs/JSONCompilationDatabase.html) | ||
for the different options on how to generate this file. | ||
|
||
Alternatively, you can run `CodeChecker log` command to generate a compilation database. | ||
|
||
Logging means that during the whole compilation process CodeChecker catches | ||
compiler calls and saves commands in a | ||
[compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) | ||
file. This compilation database is an input of the next analysis step. | ||
compiler calls and saves commands in a compilation database file. | ||
|
||
note: This command is currently not working on macOS. | ||
The System Integrity Protection (SIP) in macOS blocks the usage of `LD_LIBRARY_PATH`. | ||
Please try to obtain the `compile_commands.json` in an other way, with the help of CMake for example. | ||
Please try to obtain the `compile_commands.json` in an other way, with the help of | ||
[CMake](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html) | ||
for example. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So maybe I should close this PR and open a new one only keeping this last change? (link to CMake documentation), what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for that, just create a new commit with the changes from your previous one. The merged PR will contain the merged sequence of the two commits. 🙂 So if you remove in commit 2 what you added in commit 1, it will simply not make it to the upstream repository at all. |
||
|
||
```sh | ||
CodeChecker log --build "make" --output ./compile_commands.json | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a true equal alternative. For example, if code is generated during the build process (such as in the case of LLVM), then the CMake-generated compilation database will not be usable as an input if you don't also execute a build prior to analysis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your answer.
I missed that.