LLVM  10.0.0svn
InitLLVM.h
Go to the documentation of this file.
1 //===- InitLLVM.h -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_SUPPORT_LLVM_H
10 #define LLVM_SUPPORT_LLVM_H
11 
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/Support/Allocator.h"
15 
16 // The main() functions in typical LLVM tools start with InitLLVM which does
17 // the following one-time initializations:
18 //
19 // 1. Setting up a signal handler so that pretty stack trace is printed out
20 // if a process crashes.
21 //
22 // 2. Set up the global new-handler which is called when a memory allocation
23 // attempt fails.
24 //
25 // 3. If running on Windows, obtain command line arguments using a
26 // multibyte character-aware API and convert arguments into UTF-8
27 // encoding, so that you can assume that command line arguments are
28 // always encoded in UTF-8 on any platform.
29 //
30 // InitLLVM calls llvm_shutdown() on destruction, which cleans up
31 // ManagedStatic objects.
32 namespace llvm {
33 class InitLLVM {
34 public:
35  InitLLVM(int &Argc, const char **&Argv);
36  InitLLVM(int &Argc, char **&Argv)
37  : InitLLVM(Argc, const_cast<const char **&>(Argv)) {}
38 
39  ~InitLLVM();
40 
41 private:
42  BumpPtrAllocator Alloc;
44  PrettyStackTraceProgram StackPrinter;
45 };
46 } // namespace llvm
47 
48 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
PrettyStackTraceProgram - This object prints a specified program arguments to the stream as the stack...
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
InitLLVM(int &Argc, const char **&Argv)
Definition: InitLLVM.cpp:24
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:140
InitLLVM(int &Argc, char **&Argv)
Definition: InitLLVM.h:36
aarch64 promote const