瀏覽代碼

Use a union instead of a bunch of magic casts to implement a variant. This removes the type-punning errors for DeclGroup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56708 91177308-0d34-0410-b5e6-96231b3b80d8
Ted Kremenek 17 年之前
父節點
當前提交
1377e541ea
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      lib/AST/DeclGroup.cpp

+ 5 - 5
lib/AST/DeclGroup.cpp

@@ -43,17 +43,17 @@ void DeclGroup::Destroy(ASTContext& C) {
 }
 }
 
 
 DeclGroupOwningRef::~DeclGroupOwningRef() {
 DeclGroupOwningRef::~DeclGroupOwningRef() {
-  assert (ThePtr == 0 && "Destroy method not called.");
+  assert (Raw == 0 && "Destroy method not called.");
 }
 }
 
 
 void DeclGroupOwningRef::Destroy(ASTContext& C) {
 void DeclGroupOwningRef::Destroy(ASTContext& C) {
-  if (!ThePtr)
+  if (!Raw)
     return;
     return;
   
   
   if (getKind() == DeclKind)
   if (getKind() == DeclKind)
-    reinterpret_cast<Decl*>(ThePtr)->Destroy(C);
+    reinterpret_cast<Decl*>(Raw)->Destroy(C);
   else
   else
-    reinterpret_cast<DeclGroup*>(ThePtr & ~Mask)->Destroy(C);
+    reinterpret_cast<DeclGroup*>(Raw & ~Mask)->Destroy(C);
   
   
-  ThePtr = 0;
+  Raw = 0;
 }
 }