LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 22647 - clang-format type casts in dictionaries on wrong line
Summary: clang-format type casts in dictionaries on wrong line
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-20 11:26 PST by gebeleysis
Modified: 2015-10-11 22:19 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments
The clang-format used to reproduce this issue (1.86 KB, application/octet-stream)
2015-02-20 11:26 PST, gebeleysis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gebeleysis 2015-02-20 11:26:38 PST
Created attachment 13917 [details]
The clang-format used to reproduce this issue

When defining a dictionary with keys that have a typecast the formatting is off, concatenating the typecast to the previous line instead of having it prefix the key.

What I would like to see:
    NSDictionary *passwordQuery = @{
        (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
        (__bridge id)kSecReturnData: (__bridge id)kCFBooleanTrue,
        (__bridge id)kSecReturnAttributes: (__bridge id)kCFBooleanTrue,
    };

Actual formatting:
    NSDictionary *passwordQuery = @{
        (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, (__bridge id)
        kSecReturnData: (__bridge id)kCFBooleanTrue, (__bridge id)
        kSecReturnAttributes: (__bridge id)kCFBooleanTrue,
    };

See attached the format file used.
Comment 1 Aaron Voisine 2015-09-06 21:30:32 PDT
Also seeing this bug. Working around it for now by enclosing the mis-formatted expression in parens.
Comment 2 Daniel Jasper 2015-10-11 22:19:42 PDT
Fixed by r250010.