[PATCH] D61519: [clangd] Support -fallback-style, similar to clang-format.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 6 01:10:32 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL360016: [clangd] Support -fallback-style, similar to clang-format. (authored by sammccall, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61519/new/
https://reviews.llvm.org/D61519
Files:
clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
@@ -16,6 +16,7 @@
#include "index/Background.h"
#include "index/Serialization.h"
#include "clang/Basic/Version.h"
+#include "clang/Format/Format.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
@@ -231,6 +232,12 @@
llvm::cl::desc("Enable clang-tidy diagnostics."),
llvm::cl::init(true));
+static llvm::cl::opt<std::string>
+ FallbackStyle("fallback-style",
+ llvm::cl::desc("clang-format style to apply by default when "
+ "no .clang-format file is found"),
+ llvm::cl::init(clang::format::DefaultFallbackStyle));
+
static llvm::cl::opt<bool> SuggestMissingIncludes(
"suggest-missing-includes",
llvm::cl::desc("Attempts to fix diagnostic errors caused by missing "
@@ -352,6 +359,8 @@
llvm::errs() << "Ignoring -j because -run-synchronously is set.\n";
WorkerThreadsCount = 0;
}
+ if (FallbackStyle.getNumOccurrences())
+ clang::format::DefaultFallbackStyle = FallbackStyle.c_str();
// Validate command line arguments.
llvm::Optional<llvm::raw_fd_ostream> InputMirrorStream;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61519.198231.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190506/db08e951/attachment.bin>
More information about the cfe-commits
mailing list