[PATCH] clang-format recognizes alternative binary operator keywords

Bobby Moretti bobmoretti at gmail.com
Tue May 6 21:28:50 PDT 2014


I didn't add the LanguageKind parameter initially. However, without checking the LanguageKind parameter, a protocol buffers test fails.

Specifically, the `and` in the following test (`FormatTestProto.cpp` line 54):

    verifyFormat("message SomeMessage {\n"
                 "  optional really.really.long.and.qualified.type.aaaaaaa\n"
                 "      fiiiiiiiiiiiiiiiiiiiiiiiiield = 1;\n"
                 "  optional\n"
                 "      really.really.long.and.qualified.type.aaaaaaa.aaaaaaaa\n"
                 "          another_fiiiiiiiiiiiiiiiiiiiiield = 2;\n"
                 "}");

The `and` gets misrepresented as an identifier, and the reformatter inserts a space before `.qualified`.

I don't know the first thing about protocol buffers. Is `and` a valid type identifier?

If it's not, I'd be happy to replace it in the test, and remove the `LanguageKind` parameter from `getFormattingLangOpts`.

http://reviews.llvm.org/D3634






More information about the cfe-commits mailing list