]> granicus.if.org Git - clang/commitdiff
Use SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'
authorTed Kremenek <kremenek@apple.com>
Wed, 22 Jul 2009 21:52:10 +0000 (21:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 22 Jul 2009 21:52:10 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76800 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/GRExprEngineBuilders.h

index 0f3a1372a0f04c297bae33636b48582e6f227600..607c9015615a2adce8defea8fd73a0b9a532c375 100644 (file)
 #ifndef LLVM_CLANG_ANALYSIS_GREXPRENGINE_BUILDERS
 #define LLVM_CLANG_ANALYSIS_GREXPRENGINE_BUILDERS
 #include "clang/Analysis/PathSensitive/GRExprEngine.h"
+#include "clang/Analysis/Support/SaveAndRestore.h"
 
 namespace clang {
-  
-
-// SaveAndRestore - A utility class that uses RAII to save and restore
-//  the value of a variable.
-template<typename T>
-struct SaveAndRestore {
-  SaveAndRestore(T& x) : X(x), old_value(x) {}
-  ~SaveAndRestore() { X = old_value; }
-  T get() { return old_value; }
-private:  
-  T& X;
-  T old_value;
-};
-
-// SaveOr - Similar to SaveAndRestore.  Operates only on bools; the old
-//  value of a variable is saved, and during the dstor the old value is
-//  or'ed with the new value.
-struct SaveOr {
-  SaveOr(bool& x) : X(x), old_value(x) { x = false; }
-  ~SaveOr() { X |= old_value; }
-private:
-  bool& X;
-  const bool old_value;
-};
 
 class GRStmtNodeBuilderRef {
   GRExprEngine::NodeSet &Dst;