]> granicus.if.org Git - clang/commit
[clang-format] Add a default format style that can be used by users of `getStyle`
authorEric Liu <ioeric@google.com>
Mon, 25 Jun 2018 16:29:19 +0000 (16:29 +0000)
committerEric Liu <ioeric@google.com>
Mon, 25 Jun 2018 16:29:19 +0000 (16:29 +0000)
commite0e097a759cc3c58306d8201dcc4e2f5fcc84e63
tree0d354c7492685189b16d0d6068ca715f86777e05
parenta605c7e73552ba349e2ceb5baa8daba92d9faf98
[clang-format] Add a default format style that can be used by users of `getStyle`

Summary:
Tools that reformat code often call `getStyle` to decide the format style
to use on a certain source file. In practice, "file" style is widely used. As a
result, many tools hardcode "file" when calling `getStyle`, which makes it hard
to control the default style in tools across a codebase when needed. This change
introduces a `DefaultFormatStyle` constant (default to "file" in upstream), which
can be modified downstream if wanted, so that all users/tools built from the same
source tree can have a consistent default format style.

This also adds an DefaultFallbackStyle that is recommended to be used by tools and can be modified downstream.

Reviewers: sammccall, djasper

Reviewed By: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48492

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335492 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Format/Format.h
lib/Format/Format.cpp
tools/clang-format/ClangFormat.cpp