Skip to content

Commit 8bc845f

Browse files
Merge pull request #3048 from verilog-to-routing/docs_add_iwyu
Add documentation for include sanitization
2 parents 2517149 + 7c25e8d commit 8bc845f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.developers.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,29 @@ For large scale reformatting (should only be performed by VTR maintainers) the s
179179

180180
Python files are automatically checked using `pylint` to ensure they follow established Python conventions. You can run `pylint` on the entire repository by running `./dev/pylint_check.py`. Certain files which were created before we adopted Python lint checking are grandfathered and are not checked. To check *all* files, provide the `--check_grandfathered` argument. You can also manually check individual files using `./dev/pylint_check.py <path_to_file1> <path_to_file2> ...`.
181181

182+
# Sanitizing Includes
183+
184+
You can use include-what-you-use or the clangd language server to make sure includes are correct and you don't have missing or unused includes.
185+
186+
## include-what-you-use
187+
188+
First, install include-what-you-use. Ubuntu/Debian users can run `sudo apt install iwyu` and Fedora/RHEL users can run `sudo dnf install iwyu`. You can then compile VTR with include-what-you-use enabled to get diagnostic messages about includes in all files with the following command:
189+
190+
```
191+
make CMAKE_PARAMS="-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE=include-what-you-use"
192+
```
193+
194+
Note that this method checks all source files and the diagnostic messages can be very long.
195+
196+
## clangd language server
197+
198+
Alternatively, if your editor supports clangd, you can use it to get diagnostic messages for the specific file you are working with. Visual Studio Code users can use the clangd extension to use clangd instead of Microsoft's C/C++ extension. To enable include diagnostics, create a file named `.clangd` in VTR root directory and add the following lines to it:
199+
```
200+
Diagnostics:
201+
UnusedIncludes: Strict
202+
MissingIncludes: Strict
203+
```
204+
182205
# Running Tests
183206

184207
VTR has a variety of tests which are used to check for correctness, performance and Quality of Result (QoR).

0 commit comments

Comments
 (0)