summaryrefslogtreecommitdiff
path: root/include/clang/Analysis/Support/SaveAndRestore.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Analysis/Support/SaveAndRestore.h')
-rw-r--r--include/clang/Analysis/Support/SaveAndRestore.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/clang/Analysis/Support/SaveAndRestore.h b/include/clang/Analysis/Support/SaveAndRestore.h
index 4720c22d990ef..f720639490d9d 100644
--- a/include/clang/Analysis/Support/SaveAndRestore.h
+++ b/include/clang/Analysis/Support/SaveAndRestore.h
@@ -22,6 +22,9 @@ namespace clang {
template<typename T>
struct SaveAndRestore {
SaveAndRestore(T& x) : X(x), old_value(x) {}
+ SaveAndRestore(T& x, const T &new_value) : X(x), old_value(x) {
+ X = new_value;
+ }
~SaveAndRestore() { X = old_value; }
T get() { return old_value; }
private: