aboutsummaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-04-13 18:26:06 +0000
committerRui Ueyama <ruiu@google.com>2018-04-13 18:26:06 +0000
commit0b9d56a30ed2735116198d18a2c85f7ecb4c405e (patch)
tree036b225dfdca6d7401b91fa8bec3690020a722dc /tools/opt
parent275d90b83cca79bb887bc053a150e87e1a46ca27 (diff)
Define InitLLVM to do common initialization all at once.
We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/opt.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 3a421256997..32260effd2e 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -41,10 +41,8 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
-#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/PluginLoader.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/TargetRegistry.h"
@@ -367,13 +365,11 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
// main for opt
//
int main(int argc, char **argv) {
- sys::PrintStackTraceOnErrorSignal(argv[0]);
- llvm::PrettyStackTraceProgram X(argc, argv);
+ InitLLVM X(argc, argv);
// Enable debug stream buffering.
EnableDebugBuffering = true;
- llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
LLVMContext Context;
InitializeAllTargets();