/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Sema/CleanupInfo.h
Line | Count | Source |
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_CLEANUP_INFO_H |
15 | | #define LLVM_CLANG_SEMA_CLEANUP_INFO_H |
16 | | |
17 | | namespace clang { |
18 | | |
19 | | class CleanupInfo { |
20 | | bool ExprNeedsCleanups = false; |
21 | | bool CleanupsHaveSideEffects = false; |
22 | | |
23 | | public: |
24 | 26.0M | bool exprNeedsCleanups() const { return ExprNeedsCleanups; } |
25 | | |
26 | 107k | bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; } |
27 | | |
28 | 169k | void setExprNeedsCleanups(bool SideEffects) { |
29 | 169k | ExprNeedsCleanups = true; |
30 | 169k | CleanupsHaveSideEffects |= SideEffects; |
31 | 169k | } |
32 | | |
33 | 40.9M | void reset() { |
34 | 40.9M | ExprNeedsCleanups = false; |
35 | 40.9M | CleanupsHaveSideEffects = false; |
36 | 40.9M | } |
37 | | |
38 | 5.95M | void mergeFrom(CleanupInfo Rhs) { |
39 | 5.95M | ExprNeedsCleanups |= Rhs.ExprNeedsCleanups; |
40 | 5.95M | CleanupsHaveSideEffects |= Rhs.CleanupsHaveSideEffects; |
41 | 5.95M | } |
42 | | }; |
43 | | |
44 | | } // end namespace clang |
45 | | |
46 | | #endif |