[clang-tools-extra] [clangd] Use InitLLVM (PR #69119)
Aleksandr Platonov via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 15 12:02:12 PDT 2023
https://github.com/ArcsinX created https://github.com/llvm/llvm-project/pull/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.
>From e64a5fa3cc13aaba1ff7f8be503707cb52ac8356 Mon Sep 17 00:00:00 2001
From: Aleksandr Platonov <platonov.aleksandr at huawei.com>
Date: Sun, 15 Oct 2023 21:39:28 +0300
Subject: [PATCH] [clangd] Use InitLLVM
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.
---
clang-tools-extra/clangd/tool/ClangdMain.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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