Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCan codeql binary use compile_database.json for cpp projects? #9
Comments
For C++, it's actually a bit more than that: In the default configuration, CodeQL will look at linker invocations as well, which allows it to distinguish versions of the same function (or an identically-name-mangled function) compiled into different binaries. Having said that, one can actually get a pretty long way with just the data from a If you're willing to take that risk, then indeed it would be possible to drive database creation from just a
You're right, we'd save the time that a clean build would take. Note that database creation still won't be instantaneous, as we have to do everything the compiler would do during the build (to parse the code and create ASTs) and then some more (to output the database data). |
Do I understand correctly, that to create new database with codeql for cpp project, it is enough to provide a list of files and build flags?
If so, can you please add an option to create a database from
compile_commands.jsonfile (https://clang.llvm.org/docs/JSONCompilationDatabase.html)?If project uses cmake, to generate it, it is enough to define a single var:
If project uses autotools, like bitcoin or linux, it is enough to execute
compiledbI am sure, there are ways to generate one for other build systems.
This feature can save a lot of time during database creation for cpp projects, because generation of this file is fast, as opposed to providing
-cflag tocodeqlbinary to actually build the project.