[clang-tools-extra] f575d79 - [clangd] Use InitLLVM (#69119)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 12 09:46:51 PST 2023
Author: Aleksandr Platonov
Date: 2023-11-12T20:46:47+03:00
New Revision: f575d792c6467234076f860fe7eecced620d3aae
URL: https://github.com/llvm/llvm-project/commit/f575d792c6467234076f860fe7eecced620d3aae
DIFF: https://github.com/llvm/llvm-project/commit/f575d792c6467234076f860fe7eecced620d3aae.diff
LOG: [clangd] Use InitLLVM (#69119)
This patch is similar to a7acba29c19ac67c77ed282ec9432602ae21268d but
for clangd.
It allows to pass non-UTF8 encoded command line arguments (e.g. path
where compile-commands.json file is located) on Windows.
Added:
Modified:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index f656a8c587c6533..9fd002d0eebba5f 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -35,6 +35,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
@@ -714,8 +715,8 @@ int clangdMain(int argc, char *argv[]) {
// Clang could run on the main thread. e.g., when the flag '-check' or '-sync'
// is enabled.
clang::noteBottomOfStack();
+ llvm::InitLLVM X(argc, argv);
llvm::InitializeAllTargetInfos();
- llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::sys::AddSignalHandler(
[](void *) {
ThreadCrashReporter::runCrashHandlers();
More information about the cfe-commits
mailing list