sstwcw added a comment.

This patch fixes the regression caused by 2183fe2 
<https://reviews.llvm.org/rG2183fe2160fbcb754893e98829f2bff4d0fccfa3> while 
introducing a new regression.  But in my opinion the new regression is less of 
a problem than the old one.  Therefore I think it is okay.

Take this piece of code similar to the example in 71814b4.

before

  void SomeFunction(int param1,
                    template <
  #ifdef A
  #if 0
  #endif
                        MyType<Some>>
  #else
                        Type1, Type2>
  #endif
                    param2,
                    param3) {
    f();
  }

after

  void SomeFunction(int param1,
                    template <
  #ifdef A
  #if 0
  #endif
                        MyType<Some>>
  #else
                    Type1,
                    Type2 >
  #endif
                        param2,
                    param3) {
    f();
  }



================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1150
   }
-  PPChainBranchIndex.push(0);
+  if (!Unreachable)
+    PPChainBranchIndex.push(0);
----------------
Can you add a comment here saying this line is a nasty hack which breaks the 
assumption that `PPChainBranchIndex` should have as many entries as the number 
of nestings of preprocessor branches and we should probably come up with a 
better way?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137052/new/

https://reviews.llvm.org/D137052

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to