Switch the default mode for clang-format to '-file'. Make 'LLVM' the
fallback syntax used when we fail to find a '.clang-format' file. Adjust
variable names appropriately.

Update the editor integration pieces that specify a '-style' option to
specify it as '-style=file'. I left the functionality in place because
even if the preferred method is to use '.clang-format' files, this way
if someone needs to clobber the style in their editor we show how to do
so in these examples.

Also check in a '.clang-format' file for Clang to ensure that separate
checkouts and builds of Clang from LLVM can still get the nice
formatting. =] This unfortunately required nuking the test for the
absence of a '.clang-format' file as now the directory happening to be
under your clang source tree will cause there to always be a file. ;]

git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@189741 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/ClangFormat.cpp b/ClangFormat.cpp
index faf96fd..b76504d 100644
--- a/ClangFormat.cpp
+++ b/ClangFormat.cpp
@@ -27,8 +27,8 @@
 
 using namespace llvm;
 
-// Default style to use when no style specified or specified style not found.
-static const char *DefaultStyle = "LLVM";
+// Fallback style when no style specified or found in a .clang-format file.
+static const char FallbackStyle[] = "LLVM";
 
 static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden);
 
@@ -72,7 +72,7 @@
                    "Use -style=\"{key: value, ...}\" to set specific\n"
                    "parameters, e.g.:\n"
                    "  -style=\"{BasedOnStyle: llvm, IndentWidth: 8}\""),
-          cl::init(DefaultStyle), cl::cat(ClangFormatCategory));
+          cl::init("file"), cl::cat(ClangFormatCategory));
 static cl::opt<bool> Inplace("i",
                              cl::desc("Inplace edit <file>s, if specified."),
                              cl::cat(ClangFormatCategory));
@@ -108,20 +108,20 @@
 
 FormatStyle getStyle(StringRef StyleName, StringRef FileName) {
   FormatStyle Style;
-  getPredefinedStyle(DefaultStyle, &Style);
+  getPredefinedStyle(FallbackStyle, &Style);
 
   if (StyleName.startswith("{")) {
     // Parse YAML/JSON style from the command line.
     if (error_code ec = parseConfiguration(StyleName, &Style)) {
       llvm::errs() << "Error parsing -style: " << ec.message()
-                   << ", using " << DefaultStyle << " style\n";
+                   << ", using " << FallbackStyle << " style\n";
     }
     return Style;
   }
 
   if (!StyleName.equals_lower("file")) {
     if (!getPredefinedStyle(StyleName, &Style))
-      llvm::errs() << "Invalid value for -style, using " << DefaultStyle
+      llvm::errs() << "Invalid value for -style, using " << FallbackStyle
                    << " style\n";
     return Style;
   }
@@ -153,7 +153,7 @@
       return Style;
     }
   }
-  llvm::errs() << "Can't find usable .clang-format, using " << DefaultStyle
+  llvm::errs() << "Can't find usable .clang-format, using " << FallbackStyle
                << " style\n";
   return Style;
 }