summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-22 21:45:16 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-22 21:45:16 +0000
commitb1c170e64b76eeb4586d597ce628d4bf3e6c2907 (patch)
treea9d43521289fc7f7d7b4af25d8282228289da4ef /clang/lib/Analysis
parent49513ccaec77e64329a3388b3a3715fed828192b (diff)
downloadbcm5719-llvm-b1c170e64b76eeb4586d597ce628d4bf3e6c2907.tar.gz
bcm5719-llvm-b1c170e64b76eeb4586d597ce628d4bf3e6c2907.zip
Make 'SaveAndRestore' and friends reusable classes in libAnalysis.
llvm-svn: 76795
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFG.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 79ca8114a7b..4c2ecb92f60 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/Analysis/Support/SaveAndRestore.h"
#include "clang/Analysis/CFG.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/PrettyPrinter.h"
@@ -27,18 +28,6 @@ using namespace clang;
namespace {
-// SaveAndRestore - A utility class that uses RIIA to save and restore
-// the value of a variable.
-template<typename T>
-struct VISIBILITY_HIDDEN SaveAndRestore {
- SaveAndRestore(T& x) : X(x), old_value(x) {}
- ~SaveAndRestore() { X = old_value; }
- T get() { return old_value; }
-
- T& X;
- T old_value;
-};
-
static SourceLocation GetEndLoc(Decl* D) {
if (VarDecl* VD = dyn_cast<VarDecl>(D))
if (Expr* Ex = VD->getInit())
OpenPOWER on IntegriCloud