tl;dr: Should the Tooling TR provide guidance on how to determine header unit identity?


The compiler is only supposed to import / include a header unit once, no matter how many times it sees the directive.  This is similar to the popular vendor extension “#pragma once”.  Like “#pragma once”, the compiler needs to be able to tell when a header unit is the same.  This is tricky.  In a single TU, #include “foo.h” could refer to two different header units.  #include “bar.h”, import <bar.h>, and #include <dir/bar.h> could all refer to the same header unit.


The different compilers use different approached for determining identity.  Some use the file path (this breaks with hard links).  Some use the file identity / inode (network shares can break this).  I believe some even use the file contents (seems slow?).  Should the Tooling TR recommend an approach for identity comparison, or are we happy leaving this up to the implementers?