[PATCH] D143870: [clang-format] Remove all include duplicates not only those in the same block

Fabian Keßler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 12 17:14:11 PST 2023


Febbe created this revision.
Herald added a project: All.
Febbe requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change aims to remove all duplicate include directives, 
instead of only those, which are in the same block.

This change might be a bit controversial, since it will also remove includes, which are in custom splitted blocks like:

  #include "a.h"
  /* some code */
  
  // following include must stay!:
  #include "a.h"

This is a follow up patch for D143691 <https://reviews.llvm.org/D143691>, but can be freestanding.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143870

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143870.496816.patch
Type: text/x-patch
Size: 5016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230213/44b14732/attachment.bin>


More information about the cfe-commits mailing list