]> granicus.if.org Git - clang/commitdiff
Destroy and delete the FieldDecl members of a RecordDecl.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 8 Aug 2008 14:08:55 +0000 (14:08 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 8 Aug 2008 14:08:55 +0000 (14:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54527 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index 3b340393cfdd74e3e070a07bc2dbc997f9fa5011..1ab8a59611c8ee75a7687eb669026ea4849eaf50 100644 (file)
@@ -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,
index a2b39c438d538edf2ede2f374d763c946625a047..7930c9095377cac1182fdcacb65e8827f419eddf 100644 (file)
@@ -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.