[LLVMbugs] [Bug 14845] New: Need something like CF_CONSUMES_THIS to indicate CF_CONSUMED on 'this'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 8 02:18:47 PST 2013


             Bug #: 14845
           Summary: Need something like CF_CONSUMES_THIS to indicate
                    CF_CONSUMED on 'this'
           Product: clang
           Version: 3.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: daniel.eggert at hoerbuch.dk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

__attribute__((cf_consumed)) can be specified on an argument, but in C++ the
'this' argument is implicit, so there's no way to add
__attribute__((cf_consumed)) to it. In ObjC that's solved by adding
__attribute__((ns_consumes_self)) to the method. In C++ when a method
'consumes' the 'this' argument, we'd need a __attribute__((cf_consumes_this)).

A situation with CF where this is needed:

#import <CoreText/CoreText.h>
struct __CTFont {
    void release(void) const {
        if (this != NULL) {
void foo(void)
    CTFontRef f = CTFontCreateWithName((__bridge CFStringRef) @"MyFont", 12,

Which confuses the static analyser, because it doesn't pick up the fact, that
release() consumes 'f'.

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