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/c-index-test | |
parent | 06d1110584c516e774cad7637ce8eadfcc06e233 (diff) | |
download | bcm5719-llvm-3f76260dc0674cc0acb25f550a0f0c594cf537ea.tar.gz bcm5719-llvm-3f76260dc0674cc0acb25f550a0f0c594cf537ea.zip |
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/c-index-test')
-rw-r--r-- | clang/tools/c-index-test/core_main.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/tools/c-index-test/core_main.cpp b/clang/tools/c-index-test/core_main.cpp index faf8b668b4e..6a8877b113e 100644 --- a/clang/tools/c-index-test/core_main.cpp +++ b/clang/tools/c-index-test/core_main.cpp @@ -13,16 +13,17 @@ #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/CompilerInvocation.h" #include "clang/Frontend/FrontendAction.h" -#include "clang/Index/IndexingAction.h" #include "clang/Index/IndexDataConsumer.h" +#include "clang/Index/IndexingAction.h" #include "clang/Index/USRGeneration.h" #include "clang/Lex/Preprocessor.h" #include "clang/Serialization/ASTReader.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/InitLLVM.h" +#include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Support/PrettyStackTrace.h" using namespace clang; using namespace clang::index; @@ -320,8 +321,7 @@ static void printSymbolNameAndUSR(const clang::Module *Mod, raw_ostream &OS) { //===----------------------------------------------------------------------===// int indextest_core_main(int argc, const char **argv) { - sys::PrintStackTraceOnErrorSignal(argv[0]); - PrettyStackTraceProgram X(argc, argv); + llvm::InitLLVM X(argc, argv); void *MainAddr = (void*) (intptr_t) indextest_core_main; std::string Executable = llvm::sys::fs::getMainExecutable(argv[0], MainAddr); |