[cfe-commits] r76783 - in /cfe/trunk/lib: AST/DeclCXX.cpp Sema/SemaDeclCXX.cpp Sema/SemaTemplate.cpp

Douglas Gregor dgregor at apple.com
Wed Jul 22 13:56:01 PDT 2009


Author: dgregor
Date: Wed Jul 22 15:55:49 2009
New Revision: 76783

URL: http://llvm.org/viewvc/llvm-project?rev=76783&view=rev
Log:
Fix some memory allocation/deallocation issues

Modified:
    cfe/trunk/lib/AST/DeclCXX.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=76783&r1=76782&r2=76783&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Jul 22 15:55:49 2009
@@ -131,10 +131,9 @@
       CXXRecordDecl *VBaseClassDecl
         = cast<CXXRecordDecl>(QT->getAsRecordType()->getDecl());
       this->VBases[i] = 
-        *new (C) CXXBaseSpecifier(
-                          VBaseClassDecl->getSourceRange(), true,
-                          VBaseClassDecl->getTagKind() == RecordDecl::TK_class,
-                          UniqueVbases[i]->getAccessSpecifier(), QT);
+        CXXBaseSpecifier(VBaseClassDecl->getSourceRange(), true,
+                         VBaseClassDecl->getTagKind() == RecordDecl::TK_class,
+                         UniqueVbases[i]->getAccessSpecifier(), QT);
     }
   }
 }

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=76783&r1=76782&r2=76783&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jul 22 15:55:49 2009
@@ -497,7 +497,7 @@
 
       // Delete the duplicate base class specifier; we're going to
       // overwrite its pointer later.
-      delete Bases[idx];
+      Context.Deallocate(Bases[idx]);
 
       Invalid = true;
     } else {
@@ -513,7 +513,7 @@
   // Delete the remaining (good) base class specifiers, since their
   // data has been copied into the CXXRecordDecl.
   for (unsigned idx = 0; idx < NumGoodBases; ++idx)
-    delete Bases[idx];
+    Context.Deallocate(Bases[idx]);
 
   return Invalid;
 }

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=76783&r1=76782&r2=76783&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Jul 22 15:55:49 2009
@@ -1080,6 +1080,7 @@
   // Translate the parser's template argument list in our AST format.
   llvm::SmallVector<TemplateArgument, 16> TemplateArgs;
   translateTemplateArguments(TemplateArgsIn, TemplateArgLocs, TemplateArgs);
+  TemplateArgsIn.release();
   
   return BuildTemplateIdExpr(Template, TemplateNameLoc, LAngleLoc,
                              TemplateArgs.data(), TemplateArgs.size(),





More information about the cfe-commits mailing list