aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/Attr.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-04 06:34:08 +0000
committerChris Lattner <sabre@nondot.org>2009-03-04 06:34:08 +0000
commit0b2b6e1cb1573bb295c0a65813dc4df8d57f305b (patch)
tree589229ea4c46c0f00d28e87cec88880fd2c107be /include/clang/AST/Attr.h
parent63d1d60e853e6af6b48b1a8cdb93835a7e86f32e (diff)
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
Diffstat (limited to 'include/clang/AST/Attr.h')
-rw-r--r--include/clang/AST/Attr.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/clang/AST/Attr.h b/include/clang/AST/Attr.h
index 89fe0f0416..0d6ed01e51 100644
--- a/include/clang/AST/Attr.h
+++ b/include/clang/AST/Attr.h
@@ -69,16 +69,23 @@ private:
bool Inherited : 1;
protected:
+ void* operator new(size_t bytes) throw() {
+ assert(0 && "Attrs cannot be allocated with regular 'new'.");
+ return 0;
+ }
+ void operator delete(void* data) throw() {
+ assert(0 && "Attrs cannot be released with regular 'delete'.");
+ }
+
+protected:
Attr(Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
virtual ~Attr() {
- delete Next;
+ assert(Next == 0 && "Destroy didn't work");
}
public:
- void Destroy(ASTContext &C) {
- delete this;
- }
-
+ void Destroy(ASTContext &C);
+
/// \brief Whether this attribute should be merged to new
/// declarations.
virtual bool isMerged() const { return true; }