diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-08-08 14:08:55 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-08-08 14:08:55 +0000 |
commit | 997b6c6d73541f010afc81e28191c8eae7b24f77 (patch) | |
tree | 9b68e322cdf8d563d3203b336380a99eed82e759 | |
parent | afebac1df82d16d6889470801e82501d714149c0 (diff) |
Destroy and delete the FieldDecl members of a RecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54527 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Decl.h | 4 | ||||
-rw-r--r-- | lib/AST/Decl.cpp | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 3b340393cf..1ab8a59611 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -808,6 +808,10 @@ protected: Members = 0; NumMembers = -1; } + + virtual ~RecordDecl(); + virtual void Destroy(ASTContext& C); + public: static RecordDecl *Create(ASTContext &C, TagKind TK, DeclContext *DC, diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index a2b39c438d..7930c90953 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -217,6 +217,19 @@ unsigned FunctionDecl::getMinRequiredArguments() const { // RecordDecl Implementation //===----------------------------------------------------------------------===// +RecordDecl::~RecordDecl() { + delete[] Members; +} + +void RecordDecl::Destroy(ASTContext& C) { + if (isDefinition()) + for (field_iterator I=field_begin(), E=field_end(); I!=E; ++I) + (*I)->Destroy(C); + + TagDecl::Destroy(C); +} + + /// defineBody - When created, RecordDecl's correspond to a forward declared /// record. This method is used to mark the decl as being defined, with the /// specified contents. |