clang
24.0.0git
include
clang
CodeGenUtils
ClassUtils.h
Go to the documentation of this file.
1
//===--- ClassUtils.h - Shared C++ class emission queries -------*- 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 holds the AST queries about C++ class construction and destruction
10
// that both classic CodeGen and CIR CodeGen need, chiefly to decide when a
11
// vtable pointer has to be established before running member initializers or
12
// a destructor body.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CLANG_CODEGENUTILS_CLASSUTILS_H
17
#define LLVM_CLANG_CODEGENUTILS_CLASSUTILS_H
18
19
#include "
clang/AST/ASTContext.h
"
20
21
namespace
clang::CodeGenUtils
{
22
23
/// Check whether \p Init uses 'this' in a way which requires the vtable to be
24
/// properly set.
25
bool
baseInitializerUsesThis
(ASTContext &Ctx,
const
Expr *
Init
);
26
27
/// Check whether we need to initialize any vtable pointers before calling this
28
/// destructor.
29
bool
canSkipVTablePointerInitialization
(ASTContext &Ctx,
30
const
CXXDestructorDecl *Dtor);
31
32
/// Check whether destructing \p Field has no observable behaviors, and thus can
33
/// be skipped when creating a destructor body. So non-record types, anonymous
34
/// structs/unions, or record types where the destructor doesnt DO anything are
35
/// considered as this version of 'trivial'.
36
/// Note: This is a more liberal definition of trivial destruction than the C++
37
/// Standard's version, and thus cannot be used as a substitute for C++ Standard
38
/// requirements.
39
bool
fieldHasTrivialDestructorBody
(ASTContext &Ctx,
const
FieldDecl *Field);
40
41
/// Return whether \p BaseInit initializes a base class that is dynamic, that
42
/// is, one whose vtable pointer must be set before the initializer runs.
43
bool
isInitializerOfDynamicClass
(
const
CXXCtorInitializer *BaseInit);
44
45
}
// namespace clang::CodeGenUtils
46
47
#endif
// LLVM_CLANG_CODEGENUTILS_CLASSUTILS_H
ASTContext.h
Defines the clang::ASTContext interface.
clang::CodeGenUtils
Definition
CallUtils.h:21
clang::CodeGenUtils::isInitializerOfDynamicClass
bool isInitializerOfDynamicClass(const CXXCtorInitializer *BaseInit)
Return whether BaseInit initializes a base class that is dynamic, that is, one whose vtable pointer m...
Definition
ClassUtils.cpp:112
clang::CodeGenUtils::canSkipVTablePointerInitialization
bool canSkipVTablePointerInitialization(ASTContext &Ctx, const CXXDestructorDecl *Dtor)
Check whether we need to initialize any vtable pointers before calling this destructor.
Definition
ClassUtils.cpp:90
clang::CodeGenUtils::fieldHasTrivialDestructorBody
bool fieldHasTrivialDestructorBody(ASTContext &Ctx, const FieldDecl *Field)
Check whether destructing Field has no observable behaviors, and thus can be skipped when creating a ...
Definition
ClassUtils.cpp:76
clang::CodeGenUtils::baseInitializerUsesThis
bool baseInitializerUsesThis(ASTContext &Ctx, const Expr *Init)
Check whether Init uses 'this' in a way which requires the vtable to be properly set.
Definition
ClassUtils.cpp:33
clang::OpenACCDirectiveKind::Init
@ Init
Definition
OpenACCKinds.h:59
Generated on
for clang by
1.14.0