Use InitLLVM in clang-tidy
authorRui Ueyama <ruiu@google.com>
Thu, 28 Nov 2019 04:50:35 +0000 (13:50 +0900)
committerRui Ueyama <ruiu@google.com>
Thu, 28 Nov 2019 04:50:35 +0000 (13:50 +0900)
Update clang-tidy to use InitLLVM, like several other llvm tools that
were previously updated. On Windows, this allows clang-tidy to operate
on arguments containing characters which cannot be represented in the
system's ANSI code page such as filenames with Unicode characters.

Fixes bugzilla bug 43751.

Patch by Tristan Labelle.

Differential Revision: https://reviews.llvm.org/D70694

clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp

index df83de8..ad6182d 100644 (file)
@@ -18,6 +18,7 @@
 #include "../ClangTidyForceLinker.h"
 #include "../GlobList.h"
 #include "clang/Tooling/CommonOptionsParser.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/TargetSelect.h"
@@ -327,7 +328,7 @@ getVfsFromFile(const std::string &OverlayFile,
 }
 
 static int clangTidyMain(int argc, const char **argv) {
-  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+  llvm::InitLLVM X(argc, argv);
   CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory,
                                     cl::ZeroOrMore);
   llvm::IntrusiveRefCntPtr<vfs::OverlayFileSystem> BaseFS(