[PATCH] D134379: [clangd] IncludeCleaner: handle using namespace

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 11:57:44 PDT 2022


sammccall added a comment.

Is test.h meaningfully used in that example?
Yes, the code is going to fail to compile without it, but it seems like the "spirit" of IWYU would say to delete both the include and the using directive.

My concern about marking it used is that namespaces are typically redeclared in *every* header, and this effectively disables the feature on large swaths of code:

  // foo.h
  namespace myproj { void foo(); }
  
  // bar.h
  namespace myproj { void bar(); }
  
  // main.cc
  #include "foo.h"
  #include "bar.h" // not meaningfully used
  
  using namespace myproj;
  int main() {
   foo();
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134379



More information about the cfe-commits mailing list