[LLVMbugs] [Bug 12264] New: clang --objc-rewriter leaks __block variables

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 13 15:03:25 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12264

             Bug #: 12264
           Summary: clang --objc-rewriter leaks __block variables
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: madcoder at debian.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


when a __block variable goes out of scope, _Block_object_dispose(object,
BLOCK_FIELD_IS_BYREF) must be called on it. the rewriter doesn't generate that,
meaning that __block variables leak when any capturing block has been copied
around.

Since the rewriter generates c++, a simple patch is to generate a destructor
for the struct __Block_byref* that is ~__Block_byref_$foo() {
_Block_object_dispose(this, 8); }

This way, RAII will take care of this.

This bug is present in any version of clang that I know about.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list