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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 00:40:31 PDT 2023


MyDeveloperDay requested changes to this revision.
MyDeveloperDay added a comment.

I know it might not seem an obvious use case but there really isn't a requirement to not include header files more than once.. imaging if I have

  #define ARCH "win32"
  #include "MyDataStructThatContainsPlaformSpecificNamesUsingARCH.h"
  #define ARCH "win64"
  #include "MyDataStructThatContainsPlaformSpecificNamesUsingARCH.h"

Its not nice, but just because I include it twice doesn't mean its wrong? This change would break code written that way.



================
Comment at: clang/unittests/Format/SortIncludesTest.cpp:927
 
-TEST_F(SortIncludesTest, DeduplicateLocallyInEachBlock) {
   EXPECT_EQ("#include <a>\n"
----------------
Please don't change existing tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143870



More information about the cfe-commits mailing list