Hi clang-devs,
[ esp @thakis @rnk for touching this last ]
We have a surprised user basically doing this:
$ mkdir NOX
$ chmod a-x NOX
$ touch ISFILE
$ mkdir GOOD
$ touch GOOD/header.h
$ echo '#include <header.h>' | clang -INOX -IISFILE -INO -IGOOD -x c++ -fsyntax-only -
<stdin>:1:10: fatal error: cannot open file 'NOX/header.h': Permission denied
#include <header.h>
^
1 error generated.
HeaderSearch::getFileAndSuggestModule()
allows the -IISFILE
and -INO
(i.e. directory doesn’t exist) cases but errors out on the -INOX
case.
To me, the approach seems inconsistent. As a user I might not care about some -Ifoo
causing trouble as long as there’s another -Ibar
pointing to the header just fine. I could imagine that if the header cannot be found at all, then issuing the diagnostics encountered during the search could be helpful. I.e. this:
$ echo '#include <header.h>' | clang -INOX -IISFILE -INO -IGOOD -x c++ -fsyntax-only - # finds GOOD/header.h
$ echo '#include <nope.h>' | clang -INOX -IISFILE -INO -IGOOD -x c++ -fsyntax-only -
<stdin>:1:10: fatal error: 'nope.h' file not found
#include <nope.h>
^~~~~~~~
<stdin>:1:10: info: -INOX: permission denied
<stdin>:1:10: info: -IISFILE: not a directory
<stdin>:1:10: info: -INO: not found
Would that be an improvement that I should propose for review, or are there good reasons to keep the current behavior?
Cheers, Axel