AutoBreak is a ClangTool that automatically inserts missing break
statements
to case
-s of the switch
statement.
When case has:
- No
break
statement (obviously). - No
return
statement. - No
[[fallthrough]]
attribute.
Currently, AutoBreak is unaware of:
[[noreturn]]
function calls.
cmake \
-B build/release \
-D CMAKE_BUILD_TYPE=Release \
-D LLVM_DIR=<path/to/llvm> \
-D CLANG_DIR=<path/to/clang>
cmake --build build/release --target auto-break
Tests are unavailable yet.
cmake \
-B build/test \
-D CMAKE_BUILD_TYPE=Debug \
-D LLVM_DIR=<path/to/llvm> \
-D CLANG_DIR=<path/to/clang> \
-D AUTO_BREAK_ENABLE_TESTS=ON
cmake --build build/test --target test_empty_switch