diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-03-08 20:28:55 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-08 20:28:55 +0000 |
commit | 7a8c758868f00b7fbe105ad2b469a289cfc92b6d (patch) | |
tree | f7c403d957085a0a8e7a35f8913126056456ed7a | |
parent | 3cb8e2f5e9ce7677ea01adf5746a6b529fae934b (diff) |
[AST] APValue: Split the fast path of MakeUninit to be inline.
- This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think
it is the right thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152330 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/APValue.h | 6 | ||||
-rw-r--r-- | lib/AST/APValue.cpp | 2 |
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) |