Skip to content

Commit

Permalink
[clang-format] Don't format qualifiers in PPDirective
Browse files Browse the repository at this point in the history
Fixes #54513

Differential Revision: https://reviews.llvm.org/D122548
  • Loading branch information
owenca committed Mar 28, 2022
1 parent d394f9f commit eee536d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Format/QualifierAlignmentFixer.cpp
Expand Up @@ -407,6 +407,8 @@ LeftRightQualifierAlignmentFixer::analyze(
assert(QualifierToken != tok::identifier && "Unrecognised Qualifier");

for (AnnotatedLine *Line : AnnotatedLines) {
if (Line->InPPDirective)
continue;
FormatToken *First = Line->First;
assert(First);
if (First->Finalized)
Expand Down
1 change: 1 addition & 0 deletions clang/unittests/Format/QualifierFixerTest.cpp
Expand Up @@ -815,6 +815,7 @@ TEST_F(QualifierFixerTest, NoOpQualifierReplacements) {
ReplacementCount = 0;
EXPECT_EQ(ReplacementCount, 0);
verifyFormat("static const uint32 foo[] = {0, 31};", Style);
verifyFormat("#define MACRO static const", Style);
EXPECT_EQ(ReplacementCount, 0);
}

Expand Down

0 comments on commit eee536d

Please sign in to comment.