Skip to content
UNDER THE HOOD

tools/weavec and tools/weavec-cc

weavec is a libTooling application: weavec file.c -- <compiler flags> or weavec -p build/ file.c with a compilation database. It injects -isystem <resource-dir>/include and -D__WEAVEC__=1 so user code can #include <weavec.h>. --whole-program analyses every file given (or every file of the compilation database) as one program. --dump-analysis prints the inferred facts and summary per function for debugging (and, in whole-program mode, the program database); --report-unannotated offers fix-its for exported functions; --strict-externs makes every call into unknown code a raw operation, so it is an error outside a WEAVEC_UNSAFE region. -Wno-weavec-<id> and the other -W spellings are accepted.

weavec-cc is the drop-in compiler: CC=weavec-cc make. Compile steps analyse the unit alone and write <object>.weavec; the link step reads the sidecars, re-analyses the units whose results depend on other units, reports what only the program could know, and refuses to link on an error. WeaveC’s own flags are -fweavec/-fno-weavec, -fweavec-strict, -fweavec-report-unannotated, -fweavec-analyze-headers, -fweavec-dump-analysis, -fweavec-exclusive-borrows, -fweavec-link/-fno-weavec-link and the -W spellings; everything else is Clang’s. The design is RFC 0005.