Switch attributes to be allocated from the declcontext bump pointer just like
decls. This reduces the number of calls to malloc on cocoa.h with pth and
-disable-free from 15958 to 12444 times (down ~3500).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66023 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 1ebfbf7..eaf69f0 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -22,10 +22,21 @@
using namespace clang;
+void Attr::Destroy(ASTContext &C) {
+ if (Next) {
+ Next->Destroy(C);
+ Next = 0;
+ }
+ this->~Attr();
+ C.Deallocate((void*)this);
+}
+
+
//===----------------------------------------------------------------------===//
// Decl Allocation/Deallocation Method Implementations
//===----------------------------------------------------------------------===//
+
TranslationUnitDecl *TranslationUnitDecl::Create(ASTContext &C) {
return new (C) TranslationUnitDecl();
}