r209567 - CXXInfo memory should be released after calling the destructor

Yaron Keren yaron.keren at gmail.com
Sat May 24 00:19:25 PDT 2014


Author: yrnkrn
Date: Sat May 24 02:19:25 2014
New Revision: 209567

URL: http://llvm.org/viewvc/llvm-project?rev=209567&view=rev
Log:
CXXInfo memory should be released after calling the destructor
instead of before. The wrong order had no effect since Deallocate() 
does nothing right now, but we may replace allocator in the future.


Modified:
    cfe/trunk/lib/AST/RecordLayout.cpp

Modified: cfe/trunk/lib/AST/RecordLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayout.cpp?rev=209567&r1=209566&r2=209567&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayout.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayout.cpp Sat May 24 02:19:25 2014
@@ -21,8 +21,8 @@ void ASTRecordLayout::Destroy(ASTContext
   if (FieldOffsets)
     Ctx.Deallocate(FieldOffsets);
   if (CXXInfo) {
-    Ctx.Deallocate(CXXInfo);
     CXXInfo->~CXXRecordLayoutInfo();
+    Ctx.Deallocate(CXXInfo);
   }
   this->~ASTRecordLayout();
   Ctx.Deallocate(this);





More information about the cfe-commits mailing list