clang 17.0.0git
CleanupInfo.h
Go to the documentation of this file.
1//===--- CleanupInfo.cpp - Cleanup Control in Sema ------------------------===//
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 implements a set of operations on whether generating an
10// ExprWithCleanups in a full expression.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_CLEANUPINFO_H
15#define LLVM_CLANG_SEMA_CLEANUPINFO_H
16
17namespace clang {
18
20 bool ExprNeedsCleanups = false;
21 bool CleanupsHaveSideEffects = false;
22
23public:
24 bool exprNeedsCleanups() const { return ExprNeedsCleanups; }
25
26 bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; }
27
28 void setExprNeedsCleanups(bool SideEffects) {
29 ExprNeedsCleanups = true;
30 CleanupsHaveSideEffects |= SideEffects;
31 }
32
33 void reset() {
34 ExprNeedsCleanups = false;
35 CleanupsHaveSideEffects = false;
36 }
37
39 ExprNeedsCleanups |= Rhs.ExprNeedsCleanups;
40 CleanupsHaveSideEffects |= Rhs.CleanupsHaveSideEffects;
41 }
42};
43
44} // end namespace clang
45
46#endif
void mergeFrom(CleanupInfo Rhs)
Definition: CleanupInfo.h:38
void setExprNeedsCleanups(bool SideEffects)
Definition: CleanupInfo.h:28
bool cleanupsHaveSideEffects() const
Definition: CleanupInfo.h:26
bool exprNeedsCleanups() const
Definition: CleanupInfo.h:24