clang 24.0.0git
EHPersonality.h
Go to the documentation of this file.
1//===--- EHPersonality.h - Shared EH personality descriptions ---*- 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// This file describes the exception personality functions that both classic
10// CodeGen and CIR CodeGen can select for a function.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_CODEGENUTILS_EHPERSONALITY_H
15#define LLVM_CLANG_CODEGENUTILS_EHPERSONALITY_H
16
17namespace clang {
18class CodeGenOptions;
19class FunctionDecl;
20class LangOptions;
21class TargetInfo;
22} // namespace clang
23
24namespace clang::CodeGenUtils {
25
26/// The exceptions personality for a function.
28 const char *PersonalityFn = nullptr;
29
30 // If this is non-null, this personality requires a non-standard
31 // function for rethrowing an exception after a catchall cleanup.
32 // This function must have prototype void(void*).
33 const char *CatchallRethrowFn = nullptr;
34
35 static const EHPersonality GNU_C;
38 static const EHPersonality GNU_ObjC;
53
54 /// Does this personality use landingpads or the family of pad instructions
55 /// designed to form funclets?
56 bool usesFuncletPads() const {
58 }
59
60 bool isMSVCPersonality() const {
61 return this == &MSVC_except_handler || this == &MSVC_C_specific_handler ||
62 this == &MSVC_CxxFrameHandler3;
63 }
64
65 bool isWasmPersonality() const { return this == &GNU_Wasm_CPlusPlus; }
66
67 bool isMSVCXXPersonality() const { return this == &MSVC_CxxFrameHandler3; }
68};
69
70/// Selects the personality function to use for \p FD, or for the translation
71/// unit as a whole when \p FD is null.
72const EHPersonality &getEHPersonality(const TargetInfo &Target,
73 const LangOptions &LangOpts,
74 const CodeGenOptions &CGOpts,
75 const FunctionDecl *FD);
76
77/// Selects the personality function that plain C++ would use. ObjC++ consults
78/// this to decide whether it can fall back on the C++ personality.
79const EHPersonality &getCXXEHPersonality(const TargetInfo &Target,
80 const CodeGenOptions &CGOpts);
81
82} // namespace clang::CodeGenUtils
83
84#endif // LLVM_CLANG_CODEGENUTILS_EHPERSONALITY_H
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Represents a function declaration or definition.
Definition Decl.h:2059
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
Definition TargetInfo.h:228
const EHPersonality & getEHPersonality(const TargetInfo &Target, const LangOptions &LangOpts, const CodeGenOptions &CGOpts, const FunctionDecl *FD)
Selects the personality function to use for FD, or for the translation unit as a whole when FD is nul...
const EHPersonality & getCXXEHPersonality(const TargetInfo &Target, const CodeGenOptions &CGOpts)
Selects the personality function that plain C++ would use.
Top level wrappers for InstallAPI frontend operations.
The exceptions personality for a function.
static const EHPersonality GNU_CPlusPlus_SEH
static const EHPersonality MSVC_CxxFrameHandler3
static const EHPersonality NeXT_ObjC
static const EHPersonality GNU_ObjCXX
static const EHPersonality GNU_Wasm_CPlusPlus
static const EHPersonality MSVC_C_specific_handler
static const EHPersonality GNU_CPlusPlus_SJLJ
static const EHPersonality GNUstep_ObjC
bool usesFuncletPads() const
Does this personality use landingpads or the family of pad instructions designed to form funclets?
static const EHPersonality GNU_C
static const EHPersonality GNU_CPlusPlus
static const EHPersonality GNU_ObjC_SJLJ
static const EHPersonality GNU_ObjC
static const EHPersonality ZOS_CPlusPlus
static const EHPersonality GNU_C_SJLJ
static const EHPersonality GNU_C_SEH
static const EHPersonality GNU_ObjC_SEH
static const EHPersonality XL_CPlusPlus
static const EHPersonality MSVC_except_handler