diff options
author | Rui Ueyama <ruiu@google.com> | 2019-11-26 10:15:47 +0900 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-11-26 10:56:10 +0900 |
commit | 3f76260dc0674cc0acb25f550a0f0c594cf537ea (patch) | |
tree | c85ddc69df1991d41efed7219820b7a1e47a085d /clang-tools-extra/tool-template | |
parent | 06d1110584c516e774cad7637ce8eadfcc06e233 (diff) | |
download | llvm-3f76260dc0674cc0acb25f550a0f0c594cf537ea.tar.gz |
Use InitLLVM to setup a pretty stack printer
InitLLVM does not only save a few lines from main() but also makes the
commands do the right thing for multibyte character pathnames on
Windows (i.e. canonicalize argv's to UTF-8) because of the code we
have in this file:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/InitLLVM.cpp#L32
For many LLVM commands, we already have calls of InitLLVM, but there
are still remainings.
Differential Revision: https://reviews.llvm.org/D70702
Diffstat (limited to 'clang-tools-extra/tool-template')
-rw-r--r-- | clang-tools-extra/tool-template/ToolTemplate.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang-tools-extra/tool-template/ToolTemplate.cpp b/clang-tools-extra/tool-template/ToolTemplate.cpp index 3220eb33ac40..f9949d79a3f9 100644 --- a/clang-tools-extra/tool-template/ToolTemplate.cpp +++ b/clang-tools-extra/tool-template/ToolTemplate.cpp @@ -44,6 +44,7 @@ #include "clang/Tooling/Refactoring/AtomicChange.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" @@ -88,7 +89,7 @@ static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage); static cl::OptionCategory ToolTemplateCategory("tool-template options"); int main(int argc, const char **argv) { - llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); + llvm::InitLLVM X(argc, argv); auto Executor = clang::tooling::createExecutorFromCommandLineArgs( argc, argv, ToolTemplateCategory); |