]> granicus.if.org Git - clang/commitdiff
Added WebKit style to the BasedOnStyle handling and to the relevant help messages.
authorAlexander Kornienko <alexfh@google.com>
Mon, 2 Sep 2013 16:39:23 +0000 (16:39 +0000)
committerAlexander Kornienko <alexfh@google.com>
Mon, 2 Sep 2013 16:39:23 +0000 (16:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189765 91177308-0d34-0410-b5e6-96231b3b80d8

docs/ClangFormat.rst
lib/Format/Format.cpp
tools/clang-format/ClangFormat.cpp
tools/clang-format/clang-format-diff.py

index 489b9b71b1c935b75a52717db3271c5a86ba8c63..b932007dd70378cfeaa5e84439f3833d9cecffca 100644 (file)
@@ -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:
 
index 39d2c0f96c3667ed6443bd2c6eed54fae4c7f2b9..76e6faa40ca7d72be69610a94a631f2a2305c665 100644 (file)
@@ -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]);
index cd28c595fd8687053017ddbafc82f1c25544e5ca..2d415b358fc5dee5157033766bfef6c21e8e742a 100644 (file)
@@ -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"
index bb18730b63c6847247937938c199549bfc44839a..89fa0521eee4b885cf6c85c8f80f7a6a6bf40719 100755 (executable)
@@ -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