aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/APValue.h6
-rw-r--r--lib/AST/APValue.cpp2
2 files changed, 6 insertions, 2 deletions
diff --git a/include/clang/AST/APValue.h b/include/clang/AST/APValue.h
index f687fb7beb..b7e588fba4 100644
--- a/include/clang/AST/APValue.h
+++ b/include/clang/AST/APValue.h
@@ -385,7 +385,11 @@ public:
const APValue &operator=(const APValue &RHS);
private:
- void MakeUninit();
+ void DestroyDataAndMakeUninit();
+ void MakeUninit() {
+ if (Kind != Uninitialized)
+ DestroyDataAndMakeUninit();
+ }
void MakeInt() {
assert(isUninit() && "Bad state change");
new ((void*)Data) APSInt(1);
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp
index 4e17d3b69e..976629cea2 100644
--- a/lib/AST/APValue.cpp
+++ b/lib/AST/APValue.cpp
@@ -189,7 +189,7 @@ const APValue &APValue::operator=(const APValue &RHS) {
return *this;
}
-void APValue::MakeUninit() {
+void APValue::DestroyDataAndMakeUninit() {
if (Kind == Int)
((APSInt*)(char*)Data)->~APSInt();
else if (Kind == Float)