summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineFormatter.cpp
diff options
context:
space:
mode:
authorPaul Hoad <mydeveloperday@gmail.com>2019-03-20 20:49:43 +0000
committerPaul Hoad <mydeveloperday@gmail.com>2019-03-20 20:49:43 +0000
commit701a0d7e47ca48e43a2bbdfbdd31065a9f9552a6 (patch)
tree81b6b9474ae5f0aa06f45a04643a6e6c0480548b /clang/lib/Format/UnwrappedLineFormatter.cpp
parent6e66512758d70dd7853719a88e6e824b6344ec9b (diff)
downloadbcm5719-llvm-701a0d7e47ca48e43a2bbdfbdd31065a9f9552a6.tar.gz
bcm5719-llvm-701a0d7e47ca48e43a2bbdfbdd31065a9f9552a6.zip
[clang-format] BeforeHash added to IndentPPDirectives
Summary: The option BeforeHash added to IndentPPDirectives. Fixes Bug 36019. https://bugs.llvm.org/show_bug.cgi?id=36019 Reviewers: djasper, klimek, krasimir, sammccall, mprobst, Nicola, MyDeveloperDay Reviewed By: klimek, MyDeveloperDay Subscribers: kadircet, MyDeveloperDay, mnussbaum, geleji, ufna, cfe-commits Patch by to-mix. Differential Revision: https://reviews.llvm.org/D52150 llvm-svn: 356613
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index f14e3851c8d..5d8142a1cfb 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1178,8 +1178,10 @@ void UnwrappedLineFormatter::formatFirstToken(
if (Newlines)
Indent = NewlineIndent;
- // Preprocessor directives get indented after the hash, if indented.
- if (Line.Type == LT_PreprocessorDirective || Line.Type == LT_ImportStatement)
+ // Preprocessor directives get indented before the hash only if specified
+ if (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
+ (Line.Type == LT_PreprocessorDirective ||
+ Line.Type == LT_ImportStatement))
Indent = 0;
Whitespaces->replaceWhitespace(RootToken, Newlines, Indent, Indent,
OpenPOWER on IntegriCloud