This is the primary development repository for 3C, a tool for automatically converting legacy C code to the Checked C extension of C, which aims to enforce spatial memory safety. This repository is a fork of Checked C's.
14
stars
5
forks
source link
Ensure that `convert_project` works with compilation databases that use the `command` field #720
convert_project currently has some logic that only works if the compilation database (compile_commands.json file) uses the arguments field rather than the command field:
https://github.com/correctcomputation/checkedc-clang/blob/2a0df403e4c803edecbe8ed6019320d7b170708a/clang/tools/3c/utils/port_tools/generate_ccommands.py#L152-L163
It seems that, knowing this, we've mostly standardized (notably, in the benchmark workflow) on using compilation databases that use arguments (as generated by Bear) rather than command (as generated by cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON), and we haven't made much of an effort to address the command case in recent changes to convert_project. (To be clear, that "we" is mostly me.) I did a simple test with cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON, and the 3C run seemed to work, but the macro expander didn't work at all.
Ideally, all of our tools should support all important features of the Clang compilation database specification. command is the main feature we are missing; output might also be worth considering where it is relevant (e.g., for the macro expander). We can start with convert_project. Some of our utils-5c tools may also need work, notably compdb build; we can file a separate issue in the utils-5c repository if we want.
convert_project
currently has some logic that only works if the compilation database (compile_commands.json
file) uses thearguments
field rather than thecommand
field: https://github.com/correctcomputation/checkedc-clang/blob/2a0df403e4c803edecbe8ed6019320d7b170708a/clang/tools/3c/utils/port_tools/generate_ccommands.py#L152-L163 It seems that, knowing this, we've mostly standardized (notably, in the benchmark workflow) on using compilation databases that usearguments
(as generated by Bear) rather thancommand
(as generated bycmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
), and we haven't made much of an effort to address thecommand
case in recent changes toconvert_project
. (To be clear, that "we" is mostly me.) I did a simple test withcmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
, and the 3C run seemed to work, but the macro expander didn't work at all.Ideally, all of our tools should support all important features of the Clang compilation database specification.
command
is the main feature we are missing;output
might also be worth considering where it is relevant (e.g., for the macro expander). We can start withconvert_project
. Some of ourutils-5c
tools may also need work, notablycompdb build
; we can file a separate issue in theutils-5c
repository if we want.