[llvm] r272077 - IR: Call dropAllReferences from GlobalVariable's destructor.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 17:13:40 PDT 2016


Author: pcc
Date: Tue Jun  7 19:13:39 2016
New Revision: 272077

URL: http://llvm.org/viewvc/llvm-project?rev=272077&view=rev
Log:
IR: Call dropAllReferences from GlobalVariable's destructor.

We were previously failing to do this and as a result failing to drop
attached metadata.

Not sure if there's a good way to test this. An in-progress patch exposed this
problem by allocating a GlobalVariable at the same address as a previously
allocated GlobalVariable.

Differential Revision: http://reviews.llvm.org/D21109

Modified:
    llvm/trunk/include/llvm/IR/GlobalVariable.h

Modified: llvm/trunk/include/llvm/IR/GlobalVariable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/GlobalVariable.h?rev=272077&r1=272076&r2=272077&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/GlobalVariable.h (original)
+++ llvm/trunk/include/llvm/IR/GlobalVariable.h Tue Jun  7 19:13:39 2016
@@ -65,6 +65,8 @@ public:
                  bool isExternallyInitialized = false);
 
   ~GlobalVariable() override {
+    dropAllReferences();
+
     // FIXME: needed by operator delete
     setGlobalVariableNumOperands(1);
   }




More information about the llvm-commits mailing list