[PATCH] D148484: [clang-format] Correctly format goto labels followed by blocks

sstwcw via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 08:24:18 PDT 2023


sstwcw marked 3 inline comments as done.
sstwcw added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4525
-    const FormatToken *Next = Right.getNextNonComment();
-    if (!Next || Next->is(tok::semi))
       return false;
----------------
MyDeveloperDay wrote:
> how is the semi case handled or is it not needed
It is not needed anymore.  It was added to handle a semicolon following a goto label. Now the type `TT_GotoLabelColon` includes the case.


================
Comment at: clang/unittests/Format/FormatTest.cpp:3020-3024
   verifyFormat("{\n"
                "  some_code();\n"
-               "test_label:;\n"
-               "  int i = 0;\n"
-               "}");
----------------
HazardyKnusperkeks wrote:
> Why did you remove that?
It was an accident.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148484



More information about the cfe-commits mailing list