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
diff --git a/clang/utils/TableGen/TableGen.cpp b/clang/utils/TableGen/TableGen.cpp
index c988a58..3b9c833 100644
--- a/clang/utils/TableGen/TableGen.cpp
+++ b/clang/utils/TableGen/TableGen.cpp
@@ -10,9 +10,10 @@
//
//===----------------------------------------------------------------------===//
-#include "TableGenBackends.h" // Declares all backends.
#include "ClangASTEmitters.h"
+#include "TableGenBackends.h" // Declares all backends.
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/TableGen/Error.h"
@@ -349,8 +350,7 @@
}
int main(int argc, char **argv) {
- sys::PrintStackTraceOnErrorSignal(argv[0]);
- PrettyStackTraceProgram X(argc, argv);
+ llvm::InitLLVM X(argc, argv);
cl::ParseCommandLineOptions(argc, argv);
llvm_shutdown_obj Y;