LLVM 22.0.0git
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_INITLLVM_H
10#define LLVM_SUPPORT_INITLLVM_H
11
16#include <optional>
17
18// The main() functions in typical LLVM tools start with InitLLVM which does
19// the following one-time initializations:
20//
21// 1. Setting up a signal handler so that pretty stack trace is printed out
22// if a process crashes. A signal handler that exits when a failed write to
23// a pipe occurs may optionally be installed: this is on-by-default.
24//
25// 2. Set up the global new-handler which is called when a memory allocation
26// attempt fails.
27//
28// 3. If running on Windows, obtain command line arguments using a
29// multibyte character-aware API and convert arguments into UTF-8
30// encoding, so that you can assume that command line arguments are
31// always encoded in UTF-8 on any platform.
32//
33// InitLLVM calls llvm_shutdown() on destruction, which cleans up
34// ManagedStatic objects.
35namespace llvm {
36class InitLLVM {
37public:
38 LLVM_ABI InitLLVM(int &Argc, const char **&Argv,
39 bool InstallPipeSignalExitHandler = true);
40 InitLLVM(int &Argc, char **&Argv, bool InstallPipeSignalExitHandler = true)
41 : InitLLVM(Argc, const_cast<const char **&>(Argv),
42 InstallPipeSignalExitHandler) {}
43
45
46private:
49 std::optional<PrettyStackTraceProgram> StackPrinter;
50};
51} // namespace llvm
52
53#endif
aarch64 promote const
This file defines the BumpPtrAllocator interface.
#define LLVM_ABI
Definition Compiler.h:213
This file defines the SmallVector class.
LLVM_ABI ~InitLLVM()
Definition InitLLVM.cpp:109
LLVM_ABI InitLLVM(int &Argc, const char **&Argv, bool InstallPipeSignalExitHandler=true)
Definition InitLLVM.cpp:47
InitLLVM(int &Argc, char **&Argv, bool InstallPipeSignalExitHandler=true)
Definition InitLLVM.h:40
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383