Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:59

0001 //===--- CleanupInfo.cpp - Cleanup Control in Sema ------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file implements a set of operations on whether generating an
0010 //  ExprWithCleanups in a full expression.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_SEMA_CLEANUPINFO_H
0015 #define LLVM_CLANG_SEMA_CLEANUPINFO_H
0016 
0017 namespace clang {
0018 
0019 class CleanupInfo {
0020   bool ExprNeedsCleanups = false;
0021   bool CleanupsHaveSideEffects = false;
0022 
0023 public:
0024   bool exprNeedsCleanups() const { return ExprNeedsCleanups; }
0025 
0026   bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; }
0027 
0028   void setExprNeedsCleanups(bool SideEffects) {
0029     ExprNeedsCleanups = true;
0030     CleanupsHaveSideEffects |= SideEffects;
0031   }
0032 
0033   void reset() {
0034     ExprNeedsCleanups = false;
0035     CleanupsHaveSideEffects = false;
0036   }
0037 
0038   void mergeFrom(CleanupInfo Rhs) {
0039     ExprNeedsCleanups |= Rhs.ExprNeedsCleanups;
0040     CleanupsHaveSideEffects |= Rhs.CleanupsHaveSideEffects;
0041   }
0042 };
0043 
0044 } // end namespace clang
0045 
0046 #endif