[PATCH] D50535: Fix selective formatting of ObjC scope

Jacek Olesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 10:25:31 PDT 2018


jolesiak added a comment.

Nice! That looks very promising.

It still fails when we pass a longer range (maybe mimicking `PreviousRBrace` will help), e.g.:
Base code:

  @protocol A
   @optional
  // comment
  - (void)f;
  @end
  MACRO

formatted with `clang-format -lines=3:6 file.m` gives:

  @protocol A
   @optional
   // comment
   - (void)f;
   @end
   MACRO

This is not happening for Cpp, e.g.:
Base code:

  class A {
   void f ();
  // comment
  void g ();
  };
  MACRO

running `clang-format -lines=3:6 file.cpp` gives:

  class A {
   void f ();
   // comment
   void g ();
  };
  MACRO

I think it would be good to add all these tests to unit tests, but I see that an interface to pass line ranges is not very pleasant.


Repository:
  rC Clang

https://reviews.llvm.org/D50535





More information about the cfe-commits mailing list