From 7302a74fb4e753ee1c1b5fefb8f61b90a3cf0d9a Mon Sep 17 00:00:00 2001
From: Yaron Keren <yaron.keren@gmail.com>
Date: Sat, 24 May 2014 07:19:25 +0000
Subject: [PATCH] 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209567 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/AST/RecordLayout.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/AST/RecordLayout.cpp b/lib/AST/RecordLayout.cpp
index 38e28d44d0f..b2c244e3790 100644
--- a/lib/AST/RecordLayout.cpp
+++ b/lib/AST/RecordLayout.cpp
@@ -21,8 +21,8 @@ void ASTRecordLayout::Destroy(ASTContext &Ctx) {
   if (FieldOffsets)
     Ctx.Deallocate(FieldOffsets);
   if (CXXInfo) {
-    Ctx.Deallocate(CXXInfo);
     CXXInfo->~CXXRecordLayoutInfo();
+    Ctx.Deallocate(CXXInfo);
   }
   this->~ASTRecordLayout();
   Ctx.Deallocate(this);
-- 
GitLab