This is an archive of the discontinued LLVM Phabricator instance.

[clang][driver] Ensure we don't accumulate entries in -MJ files
ClosedPublic

Authored by jansvoboda11 on Jun 17 2022, 2:31 PM.

Details

Summary

Previously, each job would overwrite the -MJ file. This didn't quite work for Clang invocations with multiple architectures, which got fixed in D121997 by always appending to the -MJ file. That's not correct either, since the file would grow indefinitely on subsequent Clang invocations. This patch ensures the driver always removes the file before jobs fill it in by appending.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Jun 17 2022, 2:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 2:31 PM
jansvoboda11 requested review of this revision.Jun 17 2022, 2:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2022, 2:31 PM
MaskRay accepted this revision.Jun 17 2022, 2:50 PM

LGTM.

clang/test/Driver/compilation_database_multiarch.c
15

CHECK-EMPTY can match EOF.

This revision is now accepted and ready to land.Jun 17 2022, 2:50 PM

Thanks for the review!

clang/test/Driver/compilation_database_multiarch.c
15

It can, but it's not really strict. It will match an empty line, but that might be followed by some non-empty lines, which I'd like this test to explicitly disallow.

This revision was landed with ongoing or failed builds.Jun 17 2022, 3:01 PM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.Jun 17 2022, 4:16 PM
clang/test/Driver/compilation_database_multiarch.c
15

OK. I think CHECk-NOT: {{.}} works as well once the last byte before \n is matched.

tschuett added a comment.EditedJun 19 2022, 6:17 AM

There are now several JSON fragments per file? Previously, there was one fragment per file.

This will fail now:
https://sarcasm.github.io/notes/dev/compilation-database.html#clang

There are now several JSON fragments per file? Previously, there was one fragment per file.

This will fail now:
https://sarcasm.github.io/notes/dev/compilation-database.html#clang

There are on MacOS when building fat binaries (for both x86_64 and AArch64).