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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to