1 //===--- CleanupInfo.cpp - Cleanup Control in Sema ------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file implements a set of operations on whether generating an 11 // ExprWithCleanups in a full expression. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_SEMA_CLEANUP_INFO_H 16 #define LLVM_CLANG_SEMA_CLEANUP_INFO_H 17 18 namespace clang { 19 20 class CleanupInfo { 21 bool ExprNeedsCleanups = false; 22 bool CleanupsHaveSideEffects = false; 23 24 public: exprNeedsCleanups()25 bool exprNeedsCleanups() const { return ExprNeedsCleanups; } 26 cleanupsHaveSideEffects()27 bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; } 28 setExprNeedsCleanups(bool SideEffects)29 void setExprNeedsCleanups(bool SideEffects) { 30 ExprNeedsCleanups = true; 31 CleanupsHaveSideEffects |= SideEffects; 32 } 33 reset()34 void reset() { 35 ExprNeedsCleanups = false; 36 CleanupsHaveSideEffects = false; 37 } 38 mergeFrom(CleanupInfo Rhs)39 void mergeFrom(CleanupInfo Rhs) { 40 ExprNeedsCleanups |= Rhs.ExprNeedsCleanups; 41 CleanupsHaveSideEffects |= Rhs.CleanupsHaveSideEffects; 42 } 43 }; 44 45 } // end namespace clang 46 47 #endif 48