https://github.com/sebastianbach/clang-format-generator
Command line tool that creates a clang-format file from a formatted C++ source code file.
https://github.com/sebastianbach/clang-format-generator
clang-format codestyle cpp cpp20
Last synced: 8 months ago
JSON representation
Command line tool that creates a clang-format file from a formatted C++ source code file.
- Host: GitHub
- URL: https://github.com/sebastianbach/clang-format-generator
- Owner: SebastianBach
- License: mit
- Created: 2024-01-29T19:23:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-15T19:24:45.000Z (over 1 year ago)
- Last Synced: 2025-01-08T13:51:59.949Z (9 months ago)
- Topics: clang-format, codestyle, cpp, cpp20
- Language: C++
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clang Format Generator
[](https://github.com/SebastianBach/clang-format-generator/actions/workflows/build.yml)
Command line tool that creates a ```clang-format``` file from a formatted C++ source code file.
See https://clang.llvm.org/docs/ClangFormat.html
# Build
Requires a ```C++20``` compiler.
```sh
mkdir build
cd build
cmake ..
cmake --build . --config Release
ctest -C Release -VV
```# Usage
## Create the Reference Source File
Use the tool to create a reference source file:
```sh
clang_format_generator source_file.cpp
```## Format the Reference Source File
Format the generated source file as you like. Do not add or remove anything.
## Create the clang-format File
Run the tool to parse the reference file and create the clang-format file. Specify the target version of *clang-format*.
```sh
clang_format_generator source_file.cpp .clang-format 160
```Define the target version of *clang-format* as an integer. For example, use ```160``` for version 16.0.