Open
Description
This can come up in distributed build systems with content-addressed filesystems, where identical files (often empty files) end up hard-linked to the same file.
Consider:
$ touch /tmp/foo.h
$ ln /tmp/foo.h /tmp/bar.h
$ cat > /tmp/a.cc
#include "/tmp/foo.h"
#include "/tmp/bar.h"
void f();
$ clang-cl -c /tmp/a.cc -showIncludes
Note: including file: /tmp/foo.h
Note: including file: /tmp/foo.h
The second include line should refer to bar.h
.
This is a problem for systems which rely on the output of /showIncludes
to discover all compilation inputs.
Interestingly, the -MD
option does not seem to have this problem:
$ clang -MD -c /tmp/a.cc && cat a.d
a.o: /tmp/a.cc /tmp/foo.h /tmp/bar.h
This all seems related to the discussion in https://reviews.llvm.org/D135220#3862893 about FileManager
merging files based on inode.