As noted in https://reviews.llvm.org/D86137#2460135 parsing of
the clang-format parameter -Wno-error=unknown fails.
This currently is done by having -Wno-error=unknown as an option.
In this patch this is changed to make -Wno-error= parse an enum into a bit set.
This way the parsing is fixed and also we can possibly add new options easily.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Quoting my questions from the other review, as it should be more appropriate to discuss this here:
The formatting of the --help page is still slightly off (I guess cl::values descriptions are supposed to be single line), so I guess I have to investigate my formatting options here or move the more extensive description somewhere else...
Clang-format options: --Werror - If set, changes formatting warnings to errors --Wno-error=<value> - If set don't error out on the specified warning type. =unknown - If set, unknown format options are only warned about. This can be used to enable formatting, even if the configuration contains unknown (newer) options. Use with caution, as this might lead to dramatically differing format depending on an option being supported or not. --assume-filename=<string> - Override filename used to determine the language. When reading from stdin, clang-format assumes this filename to determine the language. --cursor=<uint> - The position of the cursor when invoking ...
Btw. is there a way to add tests for command-line options, so this won't happen unnoticed again?
I'd guess some lit tests could be used to verify the command line syntax is correct
// RUN: clang-format --Wno-error=unknown --style=`{UnknownKey: true}` --dump-config
If it can't parse that command line, or it maybe parses it incorrectly, clang-format will return non-zero and fail the test
Update ClangFormat.rst.
This is manually well formatted.. will try to make a new patch in the coming days to actually fix it in the support library.