HomePhabricator

[clang-format] Do not emit replacements if Java imports are OK

Description

[clang-format] Do not emit replacements if Java imports are OK

Summary:
Currently clang-format would always emit a replacement for a block of Java imports even if it is correctly formatted:

% cat /tmp/Aggregator.java
import X;
% clang-format /tmp/Aggregator.java
import X;
% clang-format -output-replacements-xml /tmp/Aggregator.java
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='0' length='9'>import X;</replacement>
</replacements>
%

This change makes clang-format not emit replacements in this case. Note that
there is logic to not emit replacements in this case for C++.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

Details

Committed
krasimirFeb 20 2019, 3:44 AM
Reviewer
ioeric
Differential Revision
D58436: [clang-format] Do not emit replacements if Java imports are OK
Branches
Unknown
Tags
Unknown