Modified DeclGroupRef to always load/store the internal pointer value as Decl*. This hopefully will obviate any concerns with violating strict type-aliasing issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57213 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclGroup.cpp b/lib/AST/DeclGroup.cpp
index 6ec0e5b..34b37da 100644
--- a/lib/AST/DeclGroup.cpp
+++ b/lib/AST/DeclGroup.cpp
@@ -43,17 +43,18 @@
}
DeclGroupOwningRef::~DeclGroupOwningRef() {
- assert (Raw == 0 && "Destroy method not called.");
+ assert (D == 0 && "Destroy method not called.");
}
void DeclGroupOwningRef::Destroy(ASTContext& C) {
- if (!Raw)
+ if (!D)
return;
if (getKind() == DeclKind)
- reinterpret_cast<Decl*>(Raw)->Destroy(C);
- else
- reinterpret_cast<DeclGroup*>(Raw & ~Mask)->Destroy(C);
+ D->Destroy(C);
+ else
+ reinterpret_cast<DeclGroup*>(reinterpret_cast<uintptr_t>(D) &
+ ~Mask)->Destroy(C);
- Raw = 0;
+ D = 0;
}