This formula makes it easy to install include-what-you-use
on any modern OS X system.
Just brew tap jasonmp85/iwyu
and then brew install iwyu
.
The project's page goes into more detail, but there are three basic ways to use iwyu
…
Invoke it on a single file, as you would a compiler: iwyu hello_world.c
. Messages about what includes to add or remove will be printed to standard output.
Tell make to use it as the C compiler: make -k CC=iwyu
. It's necessary to use the -k
flag to continue after errors (iwyu
always errors to signal that no compilation has actually taken place).
include-what-you-use
bundles a Python script capable of parsing its output in order to automatically fix any include problems, in-place if you desire. It's not perfect, but something like fix_include hello_world.c < iwyu hello_world.c
should work to update a file named hello_world.c with the suggestions made by iwyu
.
Copyright © 2014–2016 Jason Petersen
Code released under the MIT License.