[clang-tools-extra] [clangd] Use InitLLVM (PR #69119)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 15 12:02:46 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangd
Author: Aleksandr Platonov (ArcsinX)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/69119.diff
1 Files Affected:
- (modified) clang-tools-extra/clangd/tool/ClangdMain.cpp (+2-1)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/69119
More information about the cfe-commits
mailing list