llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Traverse friend declarations.

Open VitaNuo opened this issue 3 years ago • 2 comments

foo.h

namespace internal {
void Factory();
}  

main.cc

#include foo.h
class Example {
  friend void internal::Factory();
};

The foo.h header is marked unused. This is probably due to the include-cleaner library not traversing friend declarations.

VitaNuo avatar Aug 03 '23 11:08 VitaNuo

@llvm/issue-subscribers-clang-include-cleaner

llvmbot avatar Aug 03 '23 11:08 llvmbot

Another similar problem:

// fwd.h
namespace ns {
  struct X;
}

// use.cpp
#include "fwd.h" // <-- unused
struct ns::X { };

ilya-biryukov avatar Aug 03 '23 12:08 ilya-biryukov