[PATCH] D115879: [clang-format] extern with new line brace without indentation
    Owen Pan via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Dec 17 09:23:02 PST 2021
    
    
  
owenpan accepted this revision.
owenpan added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1291-1293
+            ((Style.IndentExternBlock == FormatStyle::IEBS_Indent) ||
+             (Style.BraceWrapping.AfterExternBlock &&
+              Style.IndentExternBlock == FormatStyle::IEBS_AfterExternBlock))
----------------
Nit: the outer parens are unnecessary?
================
Comment at: clang/unittests/Format/FormatTest.cpp:3804
   Style.BraceWrapping.AfterExternBlock = true;
-  verifyFormat("extern \"C\"\n{ /*13*/\n}", Style);
+  Style.IndentExternBlock = FormatStyle::IEBS_Indent;
+  verifyFormat("extern \"C\"\n"
----------------
I would remove either line 3801 or 3804.
================
Comment at: clang/unittests/Format/FormatTest.cpp:3825
+  Style.BraceWrapping.AfterExternBlock = true;
+  Style.IndentExternBlock = FormatStyle::IEBS_NoIndent;
+  verifyFormat("extern \"C\"\n"
----------------
Nit: you can remove this line.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115879/new/
https://reviews.llvm.org/D115879
    
    
More information about the cfe-commits
mailing list