[cfe-commits] r56708 - /cfe/trunk/lib/AST/DeclGroup.cpp

Ted Kremenek kremenek at apple.com
Fri Sep 26 16:19:06 PDT 2008


Author: kremenek
Date: Fri Sep 26 18:19:04 2008
New Revision: 56708

URL: http://llvm.org/viewvc/llvm-project?rev=56708&view=rev
Log:
Use a union instead of a bunch of magic casts to implement a variant.  This removes the type-punning errors for DeclGroup.

Modified:
    cfe/trunk/lib/AST/DeclGroup.cpp

Modified: cfe/trunk/lib/AST/DeclGroup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclGroup.cpp?rev=56708&r1=56707&r2=56708&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclGroup.cpp (original)
+++ cfe/trunk/lib/AST/DeclGroup.cpp Fri Sep 26 18:19:04 2008
@@ -43,17 +43,17 @@
 }
 
 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<Decl*>(ThePtr)->Destroy(C);
+    reinterpret_cast<Decl*>(Raw)->Destroy(C);
   else
-    reinterpret_cast<DeclGroup*>(ThePtr & ~Mask)->Destroy(C);
+    reinterpret_cast<DeclGroup*>(Raw & ~Mask)->Destroy(C);
   
-  ThePtr = 0;
+  Raw = 0;
 }





More information about the cfe-commits mailing list