llvm-project
llvm-project copied to clipboard
Wrong header picked for forward-declared symbol in the presence IWYU-private pragma.
unrelated_name.h
struct Foo {};
internal_header.h
// IWYU pragma: private, include "public.h"
struct Foo;
all.h
#include "internal_header.h"
#include "unrelated_name.h"
user.cc
#include "all.h"
Foo *f; // triggers an include for "public.h" and not "unrelated_header.h"
Note that renaming unrelated_header.h to foo.h would not have the problem, since foo.h and the symbol Foo have similar names.
@llvm/issue-subscribers-clang-include-cleaner
duplicate of https://github.com/llvm/llvm-project/issues/62172