[PATCH] D42035: [clang-format] Fixup #include guard indents after parseFile()

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 01:36:19 PST 2018


krasimir accepted this revision.
krasimir added a comment.
This revision is now accepted and ready to land.

Looks good! Thank you!



================
Comment at: lib/Format/UnwrappedLineParser.cpp:244
   PPBranchLevel = -1;
-  IfNdefCondition = nullptr;
-  FoundIncludeGuardStart = false;
-  IncludeGuardRejected = false;
+  IncludeGuard = IG_Inited;
+  IncludeGuardToken = nullptr;
----------------
mzeren-vmw wrote:
> Hm. From self review, I think this should be:
> 
>     IncludeGuard = Style.IndentPPDirectives == FormatStyle::PPDIS_None ? IG_Rejected : IG_Inited;
Makes sense.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:736
   bool MaybeIncludeGuard = IfNDef;
-  if (!IncludeGuardRejected && !FoundIncludeGuardStart && MaybeIncludeGuard) {
+  if (IncludeGuard == IG_Inited && MaybeIncludeGuard) {
     for (auto &Line : Lines) {
----------------
mzeren-vmw wrote:
> technically I could drop the braces opened on this line. Would you like me to do that?
I like the braces.


Repository:
  rC Clang

https://reviews.llvm.org/D42035





More information about the cfe-commits mailing list