aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-09-02 16:39:23 +0000
committerAlexander Kornienko <alexfh@google.com>2013-09-02 16:39:23 +0000
commite3648fbe1a78340dbcd8c17f9cd7dceeaffdf339 (patch)
tree65f37c3844a29b0fdbecf9e33a63cadd9653db21
parent815c635cec733e183b2408af493182a4718e1261 (diff)
downloadllvm-e3648fbe1a78340dbcd8c17f9cd7dceeaffdf339.zip
llvm-e3648fbe1a78340dbcd8c17f9cd7dceeaffdf339.tar.gz
llvm-e3648fbe1a78340dbcd8c17f9cd7dceeaffdf339.tar.bz2
Added WebKit style to the BasedOnStyle handling and to the relevant help messages.
llvm-svn: 189765
-rw-r--r--clang/docs/ClangFormat.rst7
-rw-r--r--clang/lib/Format/Format.cpp3
-rw-r--r--clang/tools/clang-format/ClangFormat.cpp2
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py8
4 files changed, 12 insertions, 8 deletions
diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index 489b9b7..b932007 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -54,7 +54,7 @@ to format C/C++/Obj-C code.
Can only be used with one input file.
-output-replacements-xml - Output replacements as XML.
-style=<string> - Coding style, currently supports:
- LLVM, Google, Chromium, Mozilla.
+ LLVM, Google, Chromium, Mozilla, WebKit.
Use -style=file to load style configuration from
.clang-format file located in one of the parent
directories of the source file (or current
@@ -139,12 +139,13 @@ a unified diff and reformats all contained lines with :program:`clang-format`.
usage: clang-format-diff.py [-h] [-p P] [-style STYLE]
- Reformat changed lines in diff
+ Reformat changed lines in diff.
optional arguments:
-h, --help show this help message and exit
-p P strip the smallest prefix containing P slashes
- -style STYLE formatting style to apply (LLVM, Google, Chromium)
+ -style STYLE formatting style to apply (LLVM, Google, Chromium, Mozilla,
+ WebKit)
So to reformat all the lines in the latest :program:`git` commit, just do:
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 39d2c0f..76e6faa 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -68,7 +68,8 @@ struct ScalarEnumerationTraits<
template <> struct MappingTraits<clang::format::FormatStyle> {
static void mapping(llvm::yaml::IO &IO, clang::format::FormatStyle &Style) {
if (IO.outputting()) {
- StringRef StylesArray[] = { "LLVM", "Google", "Chromium", "Mozilla" };
+ StringRef StylesArray[] = { "LLVM", "Google", "Chromium",
+ "Mozilla", "WebKit" };
ArrayRef<StringRef> Styles(StylesArray);
for (size_t i = 0, e = Styles.size(); i < e; ++i) {
StringRef StyleName(Styles[i]);
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp
index cd28c59..2d415b3 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -64,7 +64,7 @@ LineRanges("lines", cl::desc("<start line>:<end line> - format a range of\n"
static cl::opt<std::string>
Style("style",
cl::desc("Coding style, currently supports:\n"
- " LLVM, Google, Chromium, Mozilla.\n"
+ " LLVM, Google, Chromium, Mozilla, WebKit.\n"
"Use -style=file to load style configuration from\n"
".clang-format file located in one of the parent\n"
"directories of the source file (or current\n"
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index bb18730..89fa052 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -82,11 +82,13 @@ def formatRange(r, style):
def main():
parser = argparse.ArgumentParser(description=
- 'Reformat changed lines in diff')
+ 'Reformat changed lines in diff.')
parser.add_argument('-p', default=0,
help='strip the smallest prefix containing P slashes')
- parser.add_argument('-style',
- help='formatting style to apply (LLVM, Google, Chromium)')
+ parser.add_argument(
+ '-style',
+ help=
+ 'formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)')
args = parser.parse_args()
filename = None