[LLVMbugs] [Bug 11698] New: Add warning on capturing guaranteed nil scope in ARC mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 3 14:54:01 PST 2012


             Bug #: 11698
           Summary: Add warning on capturing guaranteed nil scope in ARC
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: tjw at me.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 7836
  --> http://llvm.org/bugs/attachment.cgi?id=7836

For initializers where the caller is allowed to do one-time setup
configuration, you might write one of the following faulty blocks of code
before getting to the correct version.

The first case is caught since the nil initialization as part of -fobjc-arc
isn't confirmed until the end of the variable declaration (or some such), and
we get a warning about capturing uninitialized scope.

Neither of these catches the problem in the second snippet of code:

    clang -c -Wall -fobjc-arc foo.m
    clang --analyze -Wall -fobjc-arc foo.m

But, it would be reasonable to issue a warning that you are capturing
guaranteed nil scope and then reading from it (w/o having previously written if
it is declared with __block).

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