Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -2425,6 +2425,9 @@ if (Left.MatchingParen && Left.MatchingParen->is(TT_ProtoExtensionLSquare) && Right.isOneOf(tok::l_brace, tok::less)) return !Style.Cpp11BracedListStyle; + // A percent is probably part of a formatting specification, such as %lld. + if (Left.is(tok::percent)) + return false; } else if (Style.Language == FormatStyle::LK_JavaScript) { if (Left.is(TT_JsFatArrow)) return true; Index: unittests/Format/FormatTestProto.cpp =================================================================== --- unittests/Format/FormatTestProto.cpp +++ unittests/Format/FormatTestProto.cpp @@ -432,5 +432,11 @@ "};"); } +TEST_F(FormatTestProto, NoSpaceAfterPercent) { + verifyFormat("option (MyProto.options) = {\n" + " key: %lld\n" + "};"); +} + } // end namespace tooling } // end namespace clang Index: unittests/Format/FormatTestTextProto.cpp =================================================================== --- unittests/Format/FormatTestTextProto.cpp +++ unittests/Format/FormatTestTextProto.cpp @@ -386,5 +386,9 @@ " }\n" "}"); } + +TEST_F(FormatTestTextProto, NoSpaceAfterPercent) { + verifyFormat("key: %d"); +} } // end namespace tooling } // end namespace clang