Index: clang/lib/Format/QualifierAlignmentFixer.cpp =================================================================== --- clang/lib/Format/QualifierAlignmentFixer.cpp +++ clang/lib/Format/QualifierAlignmentFixer.cpp @@ -407,6 +407,8 @@ assert(QualifierToken != tok::identifier && "Unrecognised Qualifier"); for (AnnotatedLine *Line : AnnotatedLines) { + if (Line->InPPDirective) + continue; FormatToken *First = Line->First; assert(First); if (First->Finalized) Index: clang/unittests/Format/QualifierFixerTest.cpp =================================================================== --- clang/unittests/Format/QualifierFixerTest.cpp +++ clang/unittests/Format/QualifierFixerTest.cpp @@ -815,6 +815,7 @@ ReplacementCount = 0; EXPECT_EQ(ReplacementCount, 0); verifyFormat("static const uint32 foo[] = {0, 31};", Style); + verifyFormat("#define MACRO static const", Style); EXPECT_EQ(ReplacementCount, 0); }