HomePhabricator

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

Description

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

Summary:
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 &lt;a.h>&#10;&#10;#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.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60199

Details

Committed
krasimirApr 3 2019, 8:16 AM
Reviewer
ioeric
Differential Revision
D60199: [clang-format] Do not emit replacements while regrouping if Cpp includes are OK
Branches
Unknown
Tags
Unknown