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

Wrong header picked for forward-declared symbol in the presence IWYU-private pragma.

Open VitaNuo opened this issue 3 years ago • 2 comments

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.

VitaNuo avatar Jul 31 '23 08:07 VitaNuo

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

llvmbot avatar Jul 31 '23 08:07 llvmbot

duplicate of https://github.com/llvm/llvm-project/issues/62172

kadircet avatar Sep 06 '23 07:09 kadircet