diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/APValue.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/AST/APValue.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/APValue.cpp b/contrib/llvm/tools/clang/lib/AST/APValue.cpp index 98e825b..541836b21b 100644 --- a/contrib/llvm/tools/clang/lib/AST/APValue.cpp +++ b/contrib/llvm/tools/clang/lib/AST/APValue.cpp @@ -212,6 +212,40 @@ void APValue::DestroyDataAndMakeUninit() { Kind = Uninitialized; } +bool APValue::needsCleanup() const { + switch (getKind()) { + case Uninitialized: + case AddrLabelDiff: + return false; + case Struct: + case Union: + case Array: + case Vector: + return true; + case Int: + return getInt().needsCleanup(); + case Float: + return getFloat().needsCleanup(); + case ComplexFloat: + assert(getComplexFloatImag().needsCleanup() == + getComplexFloatReal().needsCleanup() && + "In _Complex float types, real and imaginary values always have the " + "same size."); + return getComplexFloatReal().needsCleanup(); + case ComplexInt: + assert(getComplexIntImag().needsCleanup() == + getComplexIntReal().needsCleanup() && + "In _Complex int types, real and imaginary values must have the " + "same size."); + return getComplexIntReal().needsCleanup(); + case LValue: + return reinterpret_cast<const LV *>(Data)->hasPathPtr(); + case MemberPointer: + return reinterpret_cast<const MemberPointerData *>(Data)->hasPathPtr(); + } + llvm_unreachable("Unknown APValue kind!"); +} + void APValue::swap(APValue &RHS) { std::swap(Kind, RHS.Kind); char TmpData[MaxSize]; |