Follow IWYU pragma: export transitively
At the moment, we only follow one level of IWYU export pragmas (probably due to the way old IWYU tool behaves). We're receiving user complaints because of this, and should consider traversing the pragma transitively. E.g.,
foo.h
#include "bar.h" // IWYU pragma: export
bar.h
#include "baz.h" // IWYU pragma: export
baz.h
#pragma once
void foo();
main.cc
#include "foo.h"
void func() {
foo();
}
will currently suggest including "baz.h", which is wrong.
cc @kadircet
@llvm/issue-subscribers-clang-include-cleaner
FWIW, I was checking the behavior in include-what-you-use tool, and it seems to respect these transitively. So we should do that too for compatibility reasons (also I think it's more sensible. IIRC, we didn't do it initially because we thought include-what-you-use didn't treat transitive includes, but apparently we were confused).
fixed with c3ad4b7636022