[LLVMbugs] [Bug 15717] New: FixIt: Wrong (suggested) location of the dereference operator in block enumerations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 10 05:25:32 PDT 2013


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

            Bug ID: 15717
           Summary: FixIt: Wrong (suggested) location of the dereference
                    operator in block enumerations
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hagi.dd at web.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10333
  --> http://llvm.org/bugs/attachment.cgi?id=10333&action=edit
FixIt inserts the operator at the wrong location

When using Cocoa's array block enumeration (enumerateObjectsUsingBlock:
selector), the default/autocompleted code block looks like this:

[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        // code
    }];

However, you can change the type of the input parameters to avoid casting
within the block, e.g., if you iterate over NSString objects:

[array enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop)
{
        // code
    }];

If you forget to add the dereference operator between 'NSString' and 'obj',
Clang detects the issue, but suggests the wrong FixIt solution – the FixIt
inserts the dereference operator in front of the type name. I've attached a
screenshot of the situation in Xcode.

Expected Result: Put the dereference operator in front of the parameter name.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130410/f95b721a/attachment.html>


More information about the llvm-bugs mailing list