This is an archive of the discontinued LLVM Phabricator instance.

Unify DependencyFileGenerator class and DependencyCollector interface
ClosedPublic

Authored by arphaman on Jun 13 2019, 11:26 AM.

Details

Summary

This NFCI patch makes DependencyFileGenerator a DependencyCollector as it was intended when DependencyCollector was introduced. The missing PP overrides are added to the DependencyCollector as well.

This change will allow clang-scan-deps to access the produced dependencies without writing them out to .d files to disk, so that it will be able collate them and report them to the user.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Jun 13 2019, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2019, 11:26 AM
arphaman updated this revision to Diff 204611.Jun 13 2019, 1:01 PM

Fix the missing word in the comment.

aganea added inline comments.
clang/include/clang/Frontend/Utils.h
118 ↗(On Diff #204611)

s/depdenency/dependency/

clang/lib/Frontend/DependencyFile.cpp
78 ↗(On Diff #204611)

Given that llvm::sys::path::remove_leading_dotslash is not called here, but it is for the function above, could you end up with two entries in DependencyCollector::Seen when DependencyCollector::sawDependency is overriden?

165 ↗(On Diff #204611)

Why !IsMissing wasn't considered before? Just wondering.

arphaman updated this revision to Diff 205438.Jun 18 2019, 2:51 PM
arphaman marked 3 inline comments as done.

Address review comments.

clang/lib/Frontend/DependencyFile.cpp
78 ↗(On Diff #204611)

I think I understand the case you're describing, essentially a file skipped that has a "./foo.h" will be inserted as "foo.h", which might collide with a missing "foo.h" in DependencyCollector::Seen.

I don't think this is a problem as a skipped file must still resolve to a file on disk/vfs. Therefore, if it's found, it can't be missing, so it would be impossible for such collision to occur.

165 ↗(On Diff #204611)

Hmm, I think that's an oversight, I thought I needed it but it looks like without it we will match the previous behavior. I removed that check.

aganea accepted this revision.Jun 19 2019, 7:46 AM

LGTM.

This revision is now accepted and ready to land.Jun 19 2019, 7:46 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2019, 10:04 AM