From 6ed79f0c13217aa62f6618d2106fc185f24a4a43 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 26 Sep 2008 23:19:04 +0000 Subject: [PATCH] Use a union instead of a bunch of magic casts to implement a variant. This removes the type-punning errors for DeclGroup. llvm-svn: 56708 --- clang/lib/AST/DeclGroup.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/lib/AST/DeclGroup.cpp b/clang/lib/AST/DeclGroup.cpp index 5987d5a7012a..10c39283a61f 100644 --- a/clang/lib/AST/DeclGroup.cpp +++ b/clang/lib/AST/DeclGroup.cpp @@ -43,17 +43,17 @@ void DeclGroup::Destroy(ASTContext& C) { } DeclGroupOwningRef::~DeclGroupOwningRef() { - assert (ThePtr == 0 && "Destroy method not called."); + assert (Raw == 0 && "Destroy method not called."); } void DeclGroupOwningRef::Destroy(ASTContext& C) { - if (!ThePtr) + if (!Raw) return; if (getKind() == DeclKind) - reinterpret_cast(ThePtr)->Destroy(C); + reinterpret_cast(Raw)->Destroy(C); else - reinterpret_cast(ThePtr & ~Mask)->Destroy(C); + reinterpret_cast(Raw & ~Mask)->Destroy(C); - ThePtr = 0; + Raw = 0; }