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

Mark Zeren via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 06:08:19 PST 2018


mzeren-vmw added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:244
   PPBranchLevel = -1;
-  IfNdefCondition = nullptr;
-  FoundIncludeGuardStart = false;
-  IncludeGuardRejected = false;
+  IncludeGuard = IG_Inited;
+  IncludeGuardToken = nullptr;
----------------
Hm. From self review, I think this should be:

    IncludeGuard = Style.IndentPPDirectives == FormatStyle::PPDIS_None ? IG_Rejected : IG_Inited;


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


Repository:
  rC Clang

https://reviews.llvm.org/D42035





More information about the cfe-commits mailing list