[PATCH] D60199: [clang-format] Do not emit replacements while regrouping if Cpp includes are OK

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 3 07:03:14 PDT 2019


krasimir created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
krasimir added a reviewer: ioeric.

Currently clang-format would always emit a replacement for multi-block #include
sections if `IBS_Regroup`, even if the sections are correct:

  % cat ~/test.h
  #include <a.h>
  
  #include "b.h"
  % bin/clang-format --output-replacements-xml -style=google ~/test.h
  <?xml version='1.0'?>
  <replacements xml:space='preserve' incomplete_format='false'>
  <replacement offset='0' length='30'>#include <a.h>

#include "b.h"</replacement>
  </replacements>
  %

This change makes clang-format not emit replacements in this case.
The logic is similar to the one implemented for Java in r354452.


Repository:
  rC Clang

https://reviews.llvm.org/D60199

Files:
  lib/Format/Format.cpp
  unittests/Format/SortIncludesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60199.193485.patch
Type: text/x-patch
Size: 7891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190403/daa2cffa/attachment.bin>


More information about the cfe-commits mailing list