[PATCH] D92753: [clang-format] Add IndentPragma style to eliminate common clang-format off scenario
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 7 03:53:57 PST 2020
njames93 added a comment.
Should this be controlled on a case by case basis, maybe control indentation using a regex over the pragma arguments, WDYT?
================
Comment at: clang/docs/ClangFormatStyleOptions.rst:1923-1924
+
+ When ``false``, pragmas are flushed left or follow IndentPPDirectives
+ When ``true``, pragmas are indented to the current scope level
+
----------------
Please add full stops at the end of these sentences.
================
Comment at: clang/docs/ClangFormatStyleOptions.rst:1928
+
+ false: vs false:
+
----------------
================
Comment at: clang/include/clang/Format/Format.h:1533-1534
+ ///
+ /// When ``false``, pragmas are flushed left or follow IndentPPDirectives
+ /// When ``true``, pragmas are indented to the current scope level
+ /// \code
----------------
Please add full stops at the end of these sentences.
================
Comment at: clang/include/clang/Format/Format.h:1536
+ /// \code
+ /// false: vs false:
+ ///
----------------
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:594
+ State.Line->First->startsSequence(tok::hash, tok::pp_pragma);
+ // If indenting pragmas remove the extra space for the #
+ if (Style.IndentPragmas && isPragmaLine) {
----------------
Full stop.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:595-597
+ if (Style.IndentPragmas && isPragmaLine) {
+ Spaces--;
+ }
----------------
Can elide these braces.
================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:1248
+ case FormatStyle::PPDIS_BeforeHash: {
+ // if we want to indent pragmas
+ bool isPragmaLine = RootToken.startsSequence(tok::hash, tok::pp_pragma);
----------------
Capital letter at the start of comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92753/new/
https://reviews.llvm.org/D92753
More information about the cfe-commits
mailing list