rsmith added a comment.

In https://reviews.llvm.org/D51333#1220878, @christylee wrote:

> In https://reviews.llvm.org/D51333#1219938, @rsmith wrote:
>
> > Instead of guessing whether the corrected filename would be valid, why not 
> > strip off the leading and trailing non-alphanumeric characters, look up the 
> > resulting filename, and find out? If we did that, then not only could we be 
> > a lot more confident that we'd found the file that was intended, but we 
> > could also recover from the error by including the trimmed filename.
>
>
> Should we lookup the stripped filename and then error out on a warning along 
> the lines of "'<hello,h>' file not found, did you mean 'hello,h'",  or 
> attempt to continue to compile using the file we found (i.e. "hello.h").  I'm 
> learning towards the former because I'm worried the latter might be "too 
> clever", in case the developers actually think <hello.h> and hello.h are two 
> different files.


I think we should issue a (non-fatal) error along the lines of "<hello.h> not 
found; did you mean "hello.h"?" with a `FixItHint`, and carry on by including 
the file we believe they meant. The chance of hitting a false positive by doing 
this seems extremely remote to me, so I'm not worried about it being "too 
clever" and doing the wrong thing. (You'd not only need for the developer to 
intend to use a file whose name starts or ends with an odd character, but also 
for that file to not exist and a file whose name is the same but with said 
character(s) removed to actually exist.)


https://reviews.llvm.org/D51333



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to