Index: cfe/trunk/lib/Format/TokenAnnotator.cpp =================================================================== --- cfe/trunk/lib/Format/TokenAnnotator.cpp +++ cfe/trunk/lib/Format/TokenAnnotator.cpp @@ -2480,6 +2480,9 @@ return false; if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) return false; + if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) + // Objective-C dictionary literal -> no space after opening brace. + return false; if (Right.is(tok::r_brace) && Right.MatchingParen && Right.MatchingParen->endsSequence(TT_DictLiteral, tok::at)) // Objective-C dictionary literal -> no space before closing brace. Index: cfe/trunk/unittests/Format/FormatTestObjC.cpp =================================================================== --- cfe/trunk/unittests/Format/FormatTestObjC.cpp +++ cfe/trunk/unittests/Format/FormatTestObjC.cpp @@ -1021,8 +1021,17 @@ " a12345 = @{a12345 : a12345};\n" "}"); verifyFormat("int Foo() {\n" + " a12345 = @{a12345 : @(a12345)};\n" + "}"); + verifyFormat("int Foo() {\n" " a12345 = @{(Foo *)a12345 : @(a12345)};\n" "}"); + verifyFormat("int Foo() {\n" + " a12345 = @{@(a12345) : a12345};\n" + "}"); + verifyFormat("int Foo() {\n" + " a12345 = @{@(a12345) : @YES};\n" + "}"); Style.SpacesInContainerLiterals = false; verifyFormat("int Foo() {\n" " b12345 = @{b12345: b12345};\n"