[cfe-users] how to customize fallback-style in clang-format

Guo, Gcwenken via cfe-users cfe-users at lists.llvm.org
Wed May 10 11:38:03 PDT 2017


I do not like the BreakBeforeBraces in the default llvm style, I want to use GNU style. The final behavior of clang-format should be:

1. if .clang-format exits in project directory, use the style in .clang-format
2. if no .clang-format exits, use -style={BasedOnStyle: LLVM, BreakBeforeBraces: GNU}

from http://releases.llvm.org/4.0.0/tools/clang/docs/ClangFormat.html. I guess

clang-format -fallback-style='{BasedOnStyle: LLVM, BreakBeforeBraces: GNU}'

should do the job, however, I get

Invalid fallback style "{BasedOnStyle: LLVM, BreakBeforeBraces: GNU}" using LLVM style

I always use the clang-format via its vim plugin clang-format.py. If there is a method to do the job by modifying clang-format.py or .vimrc, it is also welcome.

Thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20170510/032869e0/attachment.html>

More information about the cfe-users mailing list