[PATCH] D142804: [clang-format] Support clang-format on/off line comments as prefixes

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 29 11:16:23 PST 2023


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/Format.cpp:3901
+  return Comment.startswith(Prefix) &&
+         (Comment.size() == Size || isblank(Comment[Size]));
+}
----------------
owenpan wrote:
> HazardyKnusperkeks wrote:
> > rymiel wrote:
> > > Should the space be required? What about `// clang-format off: reasoning` or similar?
> > > 
> > > Also, should this be documented?
> > > Should the space be required? What about `// clang-format off: reasoning` or similar?
> > > 
> > > Also, should this be documented?
> > 
> > +1
> > Should the space be required? What about `// clang-format off: reasoning` or similar?
> 
> On second thought, we should make it more restrictive to avoid regressions. How about //requiring// a colon, i.e. `// clang-format off:` (but not `// clang-format off :`)?
>  
> > Also, should this be documented?
> 
> Yep.
> 
> > Should the space be required? What about `// clang-format off: reasoning` or similar?
> 
> On second thought, we should make it more restrictive to avoid regressions. How about //requiring// a colon, i.e. `// clang-format off:` (but not `// clang-format off :`)?
>  

That's fine by me. But why not also `/**/`?


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

https://reviews.llvm.org/D142804



More information about the cfe-commits mailing list