void Decl::Destroy(ASTContext &C) { // Free attributes for this decl. if (HasAttrs) { C.getDeclAttrs(this)->Destroy(C); invalidateAttrs(); HasAttrs = false; } #if 0 // FIXME: Once ownership is fully understood, we can enable this code if (DeclContext *DC = dyn_cast<DeclContext>(this)) DC->decls_begin()->Destroy(C); // Observe the unrolled recursion. By setting N->NextDeclInContext = 0x0 // within the loop, only the Destroy method for the first Decl // will deallocate all of the Decls in a chain. Decl* N = getNextDeclInContext(); while (N) { Decl* Tmp = N->getNextDeclInContext(); N->NextDeclInContext = 0; N->Destroy(C); N = Tmp; } this->~Decl(); C.Deallocate((void *)this); #endif }