Jinjie-Huang wrote:

> Both libcxx and glibc ship stdio.h. How do you handle #include <stdio.h>? 

For current approach, this diagnostics is also performed for system headers 
like <stdio.h>. Because the Clang driver is theoretically supposed to 
automatically specify the system header search paths, so there seems not 
supposed to have multiple duplications(and this search priority is lower than 
those manually specified by the user)? If the user specifies additional search 
paths, and a stdio.h file happens to exist under that paths, this will cause 
the compiler to select the stdio.h from the user-specified path.  This case 
seems need to be diagnosed and produce a warning?

> Probing every search path also has a potential syscall performance issue.

I observed that the currently use: "getFileMgr().getFileRef(FileName)" should 
have an internal caching mechanism, which might be helpful here. My initial 
thought was that the cost of file searching is much lower than file loading, so 
if this diagnostics is valuable, the cost might be acceptable.

Perhaps I can consider introducing this search cost only when the user 
explicitly enables it with -Wheader-shadowing.


https://github.com/llvm/llvm-project/pull/162491
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to