owenpan marked 2 inline comments as done.
owenpan added inline comments.
================
Comment at: clang/unittests/Format/FormatTest.cpp:6371-6380
+  verifyFormat("#if FOO\n"
+               "int a = 1;\n"
+               "#else\n"
+               "int ab = 2;\n"
+               "#endif\n"
+               "#ifdef BAR\n"
+               "int abc = 3;\n"
----------------
HazardyKnusperkeks wrote:
> owenpan wrote:
> > clang-format breaks the above into two separate sets:
> > ```
> > #if FOO
> > int a = 1;
> > #else
> > #endif
> > #if BAR
> > int abc = 3;
> > #else
> > #endif
> > ```
> > and:
> > ```
> > #if FOO
> > #else
> > int ab = 2;
> > #endif
> > #if BAR
> > #else
> > int abcd = 4;
> > #endif
> > ```
> > After it finishes with the first set, the preprocessor directives are 
> > marked as `Finalized`. Then, while the second set is being processed, the 
> > directives should //not// be skipped when tokens are added to the `Change` 
> > set. Otherwise, we would end up with the `Change` set below without any 
> > "scope" context:
> > ```
> > int ab = 2;
> > int abcd = 4;
> > ```
> Fascinating. But wouldn't the better fix be that the directives are not 
> marked as finalized?
I tried that first, but it broke a lot of unit tests. I'll give it another try 
when I have time. :)


================
Comment at: clang/unittests/Format/FormatTestComments.cpp:4319
 /\
-/ 
+/
   )",
----------------
HazardyKnusperkeks wrote:
> owenpan wrote:
> > HazardyKnusperkeks wrote:
> > > Unrelated?
> > My editor strips trailing whitespaces on save. I'll leave the fix in 
> > because it's not worth doing it in a separate patch.
> Okay, but that wasn't really trailing, it was part of a string.
Yeah. Fixed in e9acf00. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150057

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

Reply via email to