[PATCH] D30882: Add a callback for __has_include and use it for dependency scanning
Pete Cooper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 23 09:50:19 PDT 2018
pete added a comment.
In https://reviews.llvm.org/D30882#1075461, @dexonsmith wrote:
> In https://reviews.llvm.org/D30882#1075407, @ddunbar wrote:
> > In https://reviews.llvm.org/D30882#1074822, @dexonsmith wrote:
> > > I don't think this is quite right. I know at least `make`-based incremental builds wouldn't deal well with this.
> > This is actually not a novel problem w.r.t. this patch. The exact same situation comes up with Makefile-included .d files and when one of the referenced headers is removed.
> > This is typically solved somewhere in the build system, for example Make has `-include`, and Ninja and llbuild have explicit support for this situation.
> Of course, yes, I was wrong. Thanks for the correction.
> > I agree we might want to tread cautiously on how we change the .d output, but in this case I think it might be safe.
> > If we decide this isn't safe, then we may want to consider a new flag which tracks *all* anti-dependencies (file's for which Clang checked existence but did not exist), and include that here. The major concern with that approach is it is a much larger list, and while it would support being substantially more correct, it is also well beyond what people currently expect out of the build system + compiler generated deps approaches.
> Even though this is likely safe, it seems really noisy. Consider the case where someone has `__has_include(<missing>)` -- we'll get an entry for every `-I`, `-F`, `-isystem`, and `-iframework`. If we're going to add that noise, I prefer a separate flag that covers all anti-dependencies.
Oh, that actually wasn't my intention when I wrote it.
Honestly I didn't expect it to log anything for missing paths at all, as we don't currently log all the missing (but attempted) paths for regular #include's.
Would it be ok to turn this on by default, without a flag, only in the case of the path actually existing, and only the found path being the one we add to the .d?
More information about the cfe-commits