forked from OSchip/llvm-project
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
This commit is contained in:
parent
f5e7e3ae26
commit
6ed79f0c13
|
@ -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<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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue