[lld] r330046 - Define InitLLVM to do common initialization all at once.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 13 11:26:06 PDT 2018
Author: ruiu
Date: Fri Apr 13 11:26:06 2018
New Revision: 330046
URL: http://llvm.org/viewvc/llvm-project?rev=330046&view=rev
Log:
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
Modified:
lld/trunk/tools/lld/lld.cpp
Modified: lld/trunk/tools/lld/lld.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld/lld.cpp?rev=330046&r1=330045&r2=330046&view=diff
==============================================================================
--- lld/trunk/tools/lld/lld.cpp (original)
+++ lld/trunk/tools/lld/lld.cpp Fri Apr 13 11:26:06 2018
@@ -20,10 +20,8 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Signals.h"
#include <cstdlib>
using namespace lld;
@@ -114,10 +112,7 @@ static bool canExitEarly() { return Stri
/// Universal linker main(). This linker emulates the gnu, darwin, or
/// windows linker based on the argv[0] or -flavor option.
int main(int Argc, const char **Argv) {
- // Standard set up, so program fails gracefully.
- sys::PrintStackTraceOnErrorSignal(Argv[0]);
- PrettyStackTraceProgram StackPrinter(Argc, Argv);
- llvm_shutdown_obj Shutdown;
+ InitLLVM X(Argc, Argv);
std::vector<const char *> Args(Argv, Argv + Argc);
switch (parseFlavor(Args)) {
More information about the llvm-commits
mailing list