[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 11:59:23 PDT 2022


owenpan added a comment.

Can you fix the format of the summary?



================
Comment at: clang/unittests/Format/FormatTest.cpp:5024
                style);
+
   verifyFormat("#if 1\n"
----------------
Don't add an empty line here.


================
Comment at: clang/unittests/Format/FormatTest.cpp:5045
+
+  style.ColumnLimit = 40;
+  style.IndentPPDirectives = FormatStyle::PPDIS_None;
----------------
Do you need it?


================
Comment at: clang/unittests/Format/FormatTest.cpp:5047
+  style.IndentPPDirectives = FormatStyle::PPDIS_None;
+  verifyFormat("#ifdef foo\n"
+               "#define bar() \\\n"
----------------
Do you need to enclose the macro definition in `#ifdef`/`#endif`?


================
Comment at: clang/unittests/Format/FormatTest.cpp:5054-5056
+               "#ifdef foo\n"
+               "#define bar() if (A) { B(); } C();\n"
+               "#endif",
----------------
You can delete them.


================
Comment at: clang/unittests/Format/FormatTest.cpp:5066-5068
+               "#ifdef foo\n"
+               "#define bar() if (A) { B(); } C();\n"
+               "#endif",
----------------
Delete them or change to multiline format like lines 5048-5052.


================
Comment at: clang/unittests/Format/FormatTest.cpp:5078-5080
+               "#ifdef foo\n"
+               "#define bar() if (A) { B(); } C();\n"
+               "#endif",
----------------
Same here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137181



More information about the cfe-commits mailing list