File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,25 @@ reducing SIL test cases by:
437
437
For more information and a high level example, see:
438
438
./swift/utils/bug_reducer/README.md.
439
439
440
+ Using ``clang-tidy `` to run the Static Analyzer
441
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
442
+
443
+ Recent versions of LLVM package the tool ``clang-tidy ``. This can be used in
444
+ combination with a json compilation database to run static analyzer checks as
445
+ well as cleanups/modernizations on a code-base. Swift's cmake invocation by
446
+ default creates one of these json databases at the root path of the swift host
447
+ build, for example on macOS::
448
+
449
+ $PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json
450
+
451
+ Using this file, one invokes ``clang-tidy `` on a specific file in the codebase
452
+ as follows::
453
+
454
+ clang-tidy -p=$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json $FULL_PATH_TO_FILE
455
+
456
+ One can also use shell regex to visit multiple files in the same directory. Example::
457
+
458
+ clang-tidy -p=$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json $FULL_PATH_TO_DIR/*.cpp
440
459
441
460
Debugging Swift Executables
442
461
===========================
You can’t perform that action at this time.
0 commit comments