Added Mozilla style, cleaned get*Style methods.
Summary: Patch based on a patch by Ehsan Akhgari.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D750
git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@181196 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/ClangFormat.cpp b/ClangFormat.cpp
index 1477e93..57833ed 100644
--- a/ClangFormat.cpp
+++ b/ClangFormat.cpp
@@ -36,7 +36,7 @@
"Can only be used with one input file."));
static cl::opt<std::string> Style(
"style",
- cl::desc("Coding style, currently supports: LLVM, Google, Chromium."),
+ cl::desc("Coding style, currently supports: LLVM, Google, Chromium, Mozilla."),
cl::init("LLVM"));
static cl::opt<bool> Inplace("i",
cl::desc("Inplace edit <file>s, if specified."));
@@ -63,8 +63,13 @@
FormatStyle TheStyle = getGoogleStyle();
if (Style == "LLVM")
TheStyle = getLLVMStyle();
- if (Style == "Chromium")
+ else if (Style == "Chromium")
TheStyle = getChromiumStyle();
+ else if (Style == "Mozilla")
+ TheStyle = getMozillaStyle();
+ else if (Style != "Google")
+ llvm::errs() << "Unknown style " << Style << ", using Google style.\n";
+
return TheStyle;
}