LLVM  8.0.1
InitLLVM.h
Go to the documentation of this file.
1 //===- InitLLVM.h -----------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_SUPPORT_LLVM_H
11 #define LLVM_SUPPORT_LLVM_H
12 
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/Support/Allocator.h"
16 
17 // The main() functions in typical LLVM tools start with InitLLVM which does
18 // the following one-time initializations:
19 //
20 // 1. Setting up a signal handler so that pretty stack trace is printed out
21 // if a process crashes.
22 //
23 // 2. If running on Windows, obtain command line arguments using a
24 // multibyte character-aware API and convert arguments into UTF-8
25 // encoding, so that you can assume that command line arguments are
26 // always encoded in UTF-8 on any platform.
27 //
28 // InitLLVM calls llvm_shutdown() on destruction, which cleans up
29 // ManagedStatic objects.
30 namespace llvm {
31 class InitLLVM {
32 public:
33  InitLLVM(int &Argc, const char **&Argv);
34  InitLLVM(int &Argc, char **&Argv)
35  : InitLLVM(Argc, const_cast<const char **&>(Argv)) {}
36 
37  ~InitLLVM();
38 
39 private:
40  BumpPtrAllocator Alloc;
42  PrettyStackTraceProgram StackPrinter;
43 };
44 } // namespace llvm
45 
46 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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:25
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:141
InitLLVM(int &Argc, char **&Argv)
Definition: InitLLVM.h:34
aarch64 promote const