[PATCH] D122548: [clang-format] Don't format qualifiers in PPDirective
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 14:28:43 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeee536dd3185: [clang-format] Don't format qualifiers in PPDirective (authored by owenpan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122548/new/
https://reviews.llvm.org/D122548
Files:
clang/lib/Format/QualifierAlignmentFixer.cpp
clang/unittests/Format/QualifierFixerTest.cpp
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);
}
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122548.418707.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220328/205c2933/attachment.bin>
More information about the cfe-commits
mailing list