Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -1350,8 +1350,14 @@ Current.Type = TT_BinaryOperator; } else if (isStartOfName(Current) && (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { - Contexts.back().FirstStartOfName = &Current; - Current.Type = TT_StartOfName; + const FormatToken *Next = Current.Next; + bool NonMacroIdentifier = + Next && Next->Tok.getIdentifierInfo() && + Next->TokenText != Next->TokenText.upper(); + if (!NonMacroIdentifier) { + Contexts.back().FirstStartOfName = &Current; + Current.Type = TT_StartOfName; + } } else if (Current.is(tok::semi)) { // Reset FirstStartOfName after finding a semicolon so that a for loop // with multiple increment statements is not confused with a for loop Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -10575,6 +10575,13 @@ " unsigned c;\n" "}", Alignment); + + // See PR37175 + FormatStyle Style = getMozillaStyle(); + Style.AlignConsecutiveDeclarations = true; + EXPECT_EQ("DECOR1 DECOR2 uint32_t\n" + "f1(int arg1, int arg2);", + format("DECOR1 DECOR2 uint32_t f1 (int arg1, int arg2);", Style)); } TEST_F(FormatTest, LinuxBraceBreaking) {